Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | // Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | // http://creativecommons.org/licenses/publicdomain/ |
michael@0 | 3 | |
michael@0 | 4 | //----------------------------------------------------------------------------- |
michael@0 | 5 | var BUGNUMBER = 732669; |
michael@0 | 6 | var summary = "Primitive values don't box correctly"; |
michael@0 | 7 | |
michael@0 | 8 | print(BUGNUMBER + ": " + summary); |
michael@0 | 9 | |
michael@0 | 10 | /************** |
michael@0 | 11 | * BEGIN TEST * |
michael@0 | 12 | **************/ |
michael@0 | 13 | |
michael@0 | 14 | var t; |
michael@0 | 15 | function returnThis() { return this; } |
michael@0 | 16 | |
michael@0 | 17 | // Boolean |
michael@0 | 18 | |
michael@0 | 19 | Boolean.prototype.method = returnThis; |
michael@0 | 20 | t = true.method(); |
michael@0 | 21 | assertEq(t !== Boolean.prototype, true); |
michael@0 | 22 | assertEq(t.toString(), "true"); |
michael@0 | 23 | |
michael@0 | 24 | Object.defineProperty(Boolean.prototype, "property", { get: returnThis, configurable: true }); |
michael@0 | 25 | t = false.property; |
michael@0 | 26 | assertEq(t !== Boolean.prototype, true); |
michael@0 | 27 | assertEq(t.toString(), "false"); |
michael@0 | 28 | |
michael@0 | 29 | delete Boolean.prototype.method; |
michael@0 | 30 | delete Boolean.prototype.property; |
michael@0 | 31 | |
michael@0 | 32 | |
michael@0 | 33 | // Number |
michael@0 | 34 | |
michael@0 | 35 | Number.prototype.method = returnThis; |
michael@0 | 36 | t = 5..method(); |
michael@0 | 37 | assertEq(t !== Number.prototype, true); |
michael@0 | 38 | assertEq(t.toString(), "5"); |
michael@0 | 39 | |
michael@0 | 40 | Object.defineProperty(Number.prototype, "property", { get: returnThis, configurable: true }); |
michael@0 | 41 | t = 17..property; |
michael@0 | 42 | assertEq(t !== Number.prototype, true); |
michael@0 | 43 | assertEq(t.toString(), "17"); |
michael@0 | 44 | |
michael@0 | 45 | delete Number.prototype.method; |
michael@0 | 46 | delete Number.prototype.property; |
michael@0 | 47 | |
michael@0 | 48 | |
michael@0 | 49 | // String |
michael@0 | 50 | |
michael@0 | 51 | String.prototype.method = returnThis; |
michael@0 | 52 | t = "foo".method(); |
michael@0 | 53 | assertEq(t !== String.prototype, true); |
michael@0 | 54 | assertEq(t.toString(), "foo"); |
michael@0 | 55 | |
michael@0 | 56 | Object.defineProperty(String.prototype, "property", { get: returnThis, configurable: true }); |
michael@0 | 57 | t = "bar".property; |
michael@0 | 58 | assertEq(t !== String.prototype, true); |
michael@0 | 59 | assertEq(t.toString(), "bar"); |
michael@0 | 60 | |
michael@0 | 61 | delete String.prototype.method; |
michael@0 | 62 | delete String.prototype.property; |
michael@0 | 63 | |
michael@0 | 64 | |
michael@0 | 65 | // Object |
michael@0 | 66 | |
michael@0 | 67 | Object.prototype.method = returnThis; |
michael@0 | 68 | |
michael@0 | 69 | t = true.method(); |
michael@0 | 70 | assertEq(t !== Object.prototype, true); |
michael@0 | 71 | assertEq(t !== Boolean.prototype, true); |
michael@0 | 72 | assertEq(t.toString(), "true"); |
michael@0 | 73 | |
michael@0 | 74 | t = 42..method(); |
michael@0 | 75 | assertEq(t !== Object.prototype, true); |
michael@0 | 76 | assertEq(t !== Number.prototype, true); |
michael@0 | 77 | assertEq(t.toString(), "42"); |
michael@0 | 78 | |
michael@0 | 79 | t = "foo".method(); |
michael@0 | 80 | assertEq(t !== Object.prototype, true); |
michael@0 | 81 | assertEq(t !== String.prototype, true); |
michael@0 | 82 | assertEq(t.toString(), "foo"); |
michael@0 | 83 | |
michael@0 | 84 | Object.defineProperty(Object.prototype, "property", { get: returnThis, configurable: true }); |
michael@0 | 85 | |
michael@0 | 86 | t = false.property; |
michael@0 | 87 | assertEq(t !== Object.prototype, true); |
michael@0 | 88 | assertEq(t !== Boolean.prototype, true); |
michael@0 | 89 | assertEq(t.toString(), "false"); |
michael@0 | 90 | |
michael@0 | 91 | t = 8675309..property; |
michael@0 | 92 | assertEq(t !== Object.prototype, true); |
michael@0 | 93 | assertEq(t !== Number.prototype, true); |
michael@0 | 94 | assertEq(t.toString(), "8675309"); |
michael@0 | 95 | |
michael@0 | 96 | t = "bar".property; |
michael@0 | 97 | assertEq(t !== Object.prototype, true); |
michael@0 | 98 | assertEq(t !== String.prototype, true); |
michael@0 | 99 | assertEq(t.toString(), "bar"); |
michael@0 | 100 | |
michael@0 | 101 | /******************************************************************************/ |
michael@0 | 102 | |
michael@0 | 103 | if (typeof reportCompare === "function") |
michael@0 | 104 | reportCompare(true, true); |
michael@0 | 105 | |
michael@0 | 106 | print("Tests complete"); |