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 /*
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/licenses/publicdomain/
4 */
6 var BUGNUMBER = 805121;
7 var summary = "Be more careful with string math to avoid wrong results";
9 print(BUGNUMBER + ": " + summary);
11 /******************************************************************************/
13 function puff(x, n)
14 {
15 while(x.length < n)
16 x += x;
17 return x.substring(0, n);
18 }
20 var x = puff("1", 1 << 20);
21 var rep = puff("$1", 1 << 16);
23 try
24 {
25 var y = x.replace(/(.+)/g, rep);
26 assertEq(y.length, Math.pow(2, 36));
27 }
28 catch (e)
29 {
30 // OOM also acceptable
31 }
33 /******************************************************************************/
35 if (typeof reportCompare === "function")
36 reportCompare(true, true);
38 print("Tests complete");