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 | var BadSyntaxStrings = [ |
michael@0 | 7 | "function foo1() { \"use strict\"; try {} catch (eval) {} }", |
michael@0 | 8 | "function foo2() { \"use strict\"; let eval = 9; foo(); }", |
michael@0 | 9 | "function foo3() { \"use strict\"; for (let eval = 3;;) { foo(); }}", |
michael@0 | 10 | "function foo4() { \"use strict\"; for (let eval in {a:1}) { foo(); }}", |
michael@0 | 11 | "function foo5() { \"use strict\"; for (let eval of [1, 2, 3]) { foo(); }}", |
michael@0 | 12 | "function foo6() { \"use strict\"; var eval = 12; }", |
michael@0 | 13 | "function foo7() { \"use strict\"; for (var eval = 3;;) { foo(); }}", |
michael@0 | 14 | "function foo8() { \"use strict\"; for (var eval in {a:1}) { foo(); }}", |
michael@0 | 15 | "function foo9() { \"use strict\"; for (var eval of [1, 2, 3]) { foo(); }}", |
michael@0 | 16 | "function foo10() { \"use strict\"; const eval = 12; }", |
michael@0 | 17 | "function foo11() { \"use strict\"; for (const eval = 3;;) { foo(); }}", |
michael@0 | 18 | "function foo12() { \"use strict\"; return [eval for (eval of [1, 2, 3])]; }", |
michael@0 | 19 | "function foo13() { \"use strict\"; return [eval for (eval in {a:3})]; }", |
michael@0 | 20 | "function foo14() { \"use strict\"; return (eval for (eval of [1, 2, 3])); }", |
michael@0 | 21 | "function foo15() { \"use strict\"; return (eval for (eval in {a:3})); }" |
michael@0 | 22 | ]; |
michael@0 | 23 | |
michael@0 | 24 | function testString(s, i) { |
michael@0 | 25 | var gotSyntaxError = -1; |
michael@0 | 26 | try { |
michael@0 | 27 | eval(s); |
michael@0 | 28 | } catch(err) { |
michael@0 | 29 | if (err instanceof SyntaxError) |
michael@0 | 30 | gotSyntaxError = i; |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | assertEq(gotSyntaxError, i); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | for (var i = 0; i < BadSyntaxStrings.length; i++) |
michael@0 | 37 | testString(BadSyntaxStrings[i], i); |
michael@0 | 38 | |
michael@0 | 39 | reportCompare(true, true); |