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.
1 // Any copyright is dedicated to the Public Domain.
2 // http://creativecommons.org/licenses/publicdomain/
4 //-----------------------------------------------------------------------------
5 print("Test for correct implementation of |Date == boolean| and vice versa");
7 /**************
8 * BEGIN TEST *
9 **************/
11 Date.prototype.toString = function() { return 1; };
12 Date.prototype.valueOf = function() { return 0; };
14 /*
15 * ES5 11.9.3 doesn't directly handle obj == boolean. Instead it translates it
16 * as follows:
17 *
18 * obj == boolean
19 * ↳ obj == ToNumber(boolean), per step 7
20 * ↳ ToPrimitive(obj) == ToNumber(boolean), per step 9
21 *
22 * ToPrimitive calls [[DefaultValue]] with no hint. For Date objects this is
23 * treated as if it were instead called with hint String. That calls toString,
24 * which returns 1, so Date objects here should compare equal to true and
25 * unequal to false.
26 */
27 assertEq(new Date == true, true);
28 assertEq(new Date == false, false);
30 /* == is symmetric. */
31 assertEq(true == new Date, true);
32 assertEq(false == new Date, false);
34 /******************************************************************************/
36 if (typeof reportCompare === "function")
37 reportCompare(true, true);
39 print("Tests complete");