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-call-replacer-once.js';
5 //-----------------------------------------------------------------------------
6 var BUGNUMBER = 584909;
7 var summary = "Call replacer function exactly once per value";
9 print(BUGNUMBER + ": " + summary);
11 /**************
12 * BEGIN TEST *
13 **************/
15 var factor = 1;
16 function replacer(k, v)
17 {
18 if (k === "")
19 return v;
21 return v * ++factor;
22 }
24 var obj = { a: 1, b: 2, c: 3 };
26 assertEq(JSON.stringify(obj, replacer), '{"a":2,"b":6,"c":12}');
27 assertEq(factor, 4);
29 /******************************************************************************/
31 if (typeof reportCompare === "function")
32 reportCompare(true, true);
34 print("Tests complete");