Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <script> |
michael@0 | 5 | var gTS = window.location.toString; |
michael@0 | 6 | var gGHR = Object.__lookupGetter__.call(window.location, 'href'); |
michael@0 | 7 | function getTests(fromOuter) { |
michael@0 | 8 | |
michael@0 | 9 | function loc() fromOuter ? window.location : location; |
michael@0 | 10 | return { |
michael@0 | 11 | getLocationImplicit: function() { |
michael@0 | 12 | return loc() + ""; |
michael@0 | 13 | }, |
michael@0 | 14 | getLocationExplicit: function() { |
michael@0 | 15 | return loc().toString(); |
michael@0 | 16 | }, |
michael@0 | 17 | getLocationApply1: function() { |
michael@0 | 18 | return gTS.call(loc()); |
michael@0 | 19 | }, |
michael@0 | 20 | getLocationApply2: function() { |
michael@0 | 21 | return gTS.apply(loc(), []); |
michael@0 | 22 | }, |
michael@0 | 23 | getLocationApply3: function() { |
michael@0 | 24 | return Function.call.apply(gTS, [loc()]); |
michael@0 | 25 | }, |
michael@0 | 26 | getLocationViaPrototype: function() { |
michael@0 | 27 | return Location.prototype.toString.call(loc()); |
michael@0 | 28 | }, |
michael@0 | 29 | getHref: function() { |
michael@0 | 30 | return loc().href; |
michael@0 | 31 | }, |
michael@0 | 32 | getHrefViaApply: function() { |
michael@0 | 33 | return Function.call.apply(gGHR, [loc()]); |
michael@0 | 34 | }, |
michael@0 | 35 | getHrefViaPrototype: function() { |
michael@0 | 36 | return Object.getOwnPropertyDescriptor(Location.prototype, 'href').get.call(loc()); |
michael@0 | 37 | } |
michael@0 | 38 | } |
michael@0 | 39 | }; |
michael@0 | 40 | |
michael@0 | 41 | function mungeNames(obj, suffix) { |
michael@0 | 42 | var rv = {}; |
michael@0 | 43 | Object.getOwnPropertyNames(obj) |
michael@0 | 44 | .forEach(function (name) rv[name + suffix] = obj[name]); |
michael@0 | 45 | return rv; |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | function mergeObjects(a, b) { |
michael@0 | 49 | var rv = {}; |
michael@0 | 50 | Object.getOwnPropertyNames(a).forEach(function(name) rv[name] = a[name]); |
michael@0 | 51 | Object.getOwnPropertyNames(b).forEach(function(name) rv[name] = b[name]); |
michael@0 | 52 | return rv; |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | function getAllTests() { |
michael@0 | 56 | var innerTests = getTests(false); |
michael@0 | 57 | var outerTests = getTests(true); |
michael@0 | 58 | return mergeObjects(mungeNames(innerTests, '_inner'), |
michael@0 | 59 | mungeNames(outerTests, '_outer')); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | </script> |
michael@0 | 63 | </head> |
michael@0 | 64 | <body> |
michael@0 | 65 | </body> |
michael@0 | 66 | </html> |