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 var gTestfile = 'stringify-replacer-array-skipped-element.js';
5 //-----------------------------------------------------------------------------
6 var BUGNUMBER = 648471;
7 var summary =
8 "Better/more correct handling for replacer arrays with getter array index " +
9 "properties";
11 print(BUGNUMBER + ": " + summary);
13 /**************
14 * BEGIN TEST *
15 **************/
17 assertEq(JSON.stringify({ 3: 3, 4: 4 },
18 ["3", { toString: function() { return "4" } }]),
19 '{"3":3}');
21 assertEq(JSON.stringify({ 3: 3, true: 4 }, ["3", true]),
22 '{"3":3}');
24 assertEq(JSON.stringify({ 3: 3, true: 4 }, ["3", "true", true]),
25 '{"3":3,"true":4}');
27 assertEq(JSON.stringify({ 3: 3, true: 4 }, ["3", true, "true"]),
28 '{"3":3,"true":4}');
30 assertEq(JSON.stringify({ 3: 3, false: 4 }, ["3", false]),
31 '{"3":3}');
33 assertEq(JSON.stringify({ 3: 3, false: 4 }, ["3", "false", false]),
34 '{"3":3,"false":4}');
36 assertEq(JSON.stringify({ 3: 3, false: 4 }, ["3", false, "false"]),
37 '{"3":3,"false":4}');
39 assertEq(JSON.stringify({ 3: 3, undefined: 4 }, ["3", undefined]),
40 '{"3":3}');
42 assertEq(JSON.stringify({ 3: 3, undefined: 4 }, ["3", "undefined", undefined]),
43 '{"3":3,"undefined":4}');
45 assertEq(JSON.stringify({ 3: 3, undefined: 4 }, ["3", undefined, "undefined"]),
46 '{"3":3,"undefined":4}');
48 assertEq(JSON.stringify({ 3: 3, null: 4 }, ["3", null]),
49 '{"3":3}');
51 assertEq(JSON.stringify({ 3: 3, null: 4 }, ["3", "null", null]),
52 '{"3":3,"null":4}');
54 assertEq(JSON.stringify({ 3: 3, null: 4 }, ["3", null, "null"]),
55 '{"3":3,"null":4}');
57 /******************************************************************************/
59 if (typeof reportCompare === "function")
60 reportCompare(true, true);
62 print("Tests complete");