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 | /* |
michael@0 | 2 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | * http://creativecommons.org/licenses/publicdomain/ |
michael@0 | 4 | */ |
michael@0 | 5 | |
michael@0 | 6 | /* |
michael@0 | 7 | * ECMA-262 6th Edition / Draft November 8, 2013 |
michael@0 | 8 | * |
michael@0 | 9 | * 20.2.2 Function Properties of the Math Object |
michael@0 | 10 | */ |
michael@0 | 11 | |
michael@0 | 12 | /* |
michael@0 | 13 | * This custom object will allow us to check if valueOf() is called |
michael@0 | 14 | */ |
michael@0 | 15 | |
michael@0 | 16 | TestNumber.prototype = new Number(); |
michael@0 | 17 | |
michael@0 | 18 | function TestNumber(value) { |
michael@0 | 19 | this.value = value; |
michael@0 | 20 | this.valueOfCalled = false; |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | TestNumber.prototype = { |
michael@0 | 24 | valueOf: function() { |
michael@0 | 25 | this.valueOfCalled = true; |
michael@0 | 26 | return this.value; |
michael@0 | 27 | } |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | // Verify that each TestNumber's flag is set after calling Math func |
michael@0 | 31 | function test(func /*, args */) { |
michael@0 | 32 | var args = Array.prototype.slice.call(arguments, 1); |
michael@0 | 33 | func.apply(null, args); |
michael@0 | 34 | |
michael@0 | 35 | for (var i = 0; i < args.length; ++i) |
michael@0 | 36 | assertEq(args[i].valueOfCalled, true); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | // Note that we are not testing these functions' return values |
michael@0 | 40 | // We only test whether valueOf() is called for each argument |
michael@0 | 41 | |
michael@0 | 42 | // 1. Test Math.atan2() |
michael@0 | 43 | var x = new TestNumber(1); |
michael@0 | 44 | test(Math.atan2, x); |
michael@0 | 45 | |
michael@0 | 46 | var x = new TestNumber(1); |
michael@0 | 47 | var y = new TestNumber(2); |
michael@0 | 48 | test(Math.atan2, y, x); |
michael@0 | 49 | |
michael@0 | 50 | // Remove comment block once patch for bug 896264 is approved |
michael@0 | 51 | /* |
michael@0 | 52 | // 2. Test Math.hypot() |
michael@0 | 53 | var x = new TestNumber(1); |
michael@0 | 54 | test(Math.hypot, x); |
michael@0 | 55 | |
michael@0 | 56 | var x = new TestNumber(1); |
michael@0 | 57 | var y = new TestNumber(2); |
michael@0 | 58 | test(Math.hypot, x, y); |
michael@0 | 59 | |
michael@0 | 60 | var x = new TestNumber(1); |
michael@0 | 61 | var y = new TestNumber(2); |
michael@0 | 62 | var z = new TestNumber(3); |
michael@0 | 63 | test(Math.hypot, x, y, z); |
michael@0 | 64 | */ |
michael@0 | 65 | |
michael@0 | 66 | // Remove comment block once patch for bug 808148 is approved |
michael@0 | 67 | /* |
michael@0 | 68 | // 3. Test Math.imul() |
michael@0 | 69 | var x = new TestNumber(1); |
michael@0 | 70 | test(Math.imul, x); |
michael@0 | 71 | |
michael@0 | 72 | var x = new TestNumber(1); |
michael@0 | 73 | var y = new TestNumber(2); |
michael@0 | 74 | test(Math.imul, x, y); |
michael@0 | 75 | */ |
michael@0 | 76 | |
michael@0 | 77 | // 4. Test Math.max() |
michael@0 | 78 | var x = new TestNumber(1); |
michael@0 | 79 | test(Math.max, x); |
michael@0 | 80 | |
michael@0 | 81 | var x = new TestNumber(1); |
michael@0 | 82 | var y = new TestNumber(2); |
michael@0 | 83 | test(Math.max, x, y); |
michael@0 | 84 | |
michael@0 | 85 | var x = new TestNumber(1); |
michael@0 | 86 | var y = new TestNumber(2); |
michael@0 | 87 | var z = new TestNumber(3); |
michael@0 | 88 | test(Math.max, x, y, z); |
michael@0 | 89 | |
michael@0 | 90 | // 5. Test Math.min() |
michael@0 | 91 | var x = new TestNumber(1); |
michael@0 | 92 | test(Math.min, x); |
michael@0 | 93 | |
michael@0 | 94 | var x = new TestNumber(1); |
michael@0 | 95 | var y = new TestNumber(2); |
michael@0 | 96 | test(Math.min, x, y); |
michael@0 | 97 | |
michael@0 | 98 | var x = new TestNumber(1); |
michael@0 | 99 | var y = new TestNumber(2); |
michael@0 | 100 | var z = new TestNumber(3); |
michael@0 | 101 | test(Math.min, x, y, z); |
michael@0 | 102 | |
michael@0 | 103 | // 6. Test Math.pow() |
michael@0 | 104 | var x = new TestNumber(1); |
michael@0 | 105 | test(Math.pow, x); |
michael@0 | 106 | |
michael@0 | 107 | var x = new TestNumber(1); |
michael@0 | 108 | var y = new TestNumber(2); |
michael@0 | 109 | test(Math.pow, x, y); |
michael@0 | 110 | |
michael@0 | 111 | reportCompare(0, 0, "ok"); |
michael@0 | 112 |