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 | // Interaction of eval with generator expressions. |
michael@0 | 2 | function a1() { |
michael@0 | 3 | var a = 10; |
michael@0 | 4 | var g = (for (y of [0]) eval('var a=42;')); |
michael@0 | 5 | g.next(); |
michael@0 | 6 | return a; |
michael@0 | 7 | } |
michael@0 | 8 | assertEq(a1(), 10); |
michael@0 | 9 | |
michael@0 | 10 | function a2() { |
michael@0 | 11 | var a = 10; |
michael@0 | 12 | (for (y of [0]) eval('a=42')).next(); |
michael@0 | 13 | return a; |
michael@0 | 14 | } |
michael@0 | 15 | assertEq(a2(), 42) |
michael@0 | 16 | |
michael@0 | 17 | // Arguments and this. |
michael@0 | 18 | function b1() { |
michael@0 | 19 | return [for (arg of (for (i of [0, 1, 2]) arguments[i])) arg]; |
michael@0 | 20 | } |
michael@0 | 21 | assertDeepEq(b1('a', 'b', 'c'), ['a', 'b', 'c']); |
michael@0 | 22 | |
michael@0 | 23 | function b2() { |
michael@0 | 24 | return [for (x of (for (i of [0]) this)) x]; |
michael@0 | 25 | } |
michael@0 | 26 | var b2o = { b2: b2 } |
michael@0 | 27 | assertDeepEq(b2o.b2(), [b2o]) |
michael@0 | 28 | |
michael@0 | 29 | // Assignment to eval or arguments. |
michael@0 | 30 | function c1() { |
michael@0 | 31 | return [for (arg of (for (i of [0, 1, 2]) arguments = i)) arg]; |
michael@0 | 32 | } |
michael@0 | 33 | assertDeepEq(c1(), [0, 1, 2]); |
michael@0 | 34 | |
michael@0 | 35 | function c2() { |
michael@0 | 36 | "use strict"; |
michael@0 | 37 | return eval('[for (arg of (for (i of [0, 1, 2]) arguments = i)) arg]'); |
michael@0 | 38 | } |
michael@0 | 39 | assertThrows(c2, SyntaxError); |
michael@0 | 40 | |
michael@0 | 41 | function c3() { |
michael@0 | 42 | return [for (arg of (for (i of [0, 1, 2]) eval = i)) arg]; |
michael@0 | 43 | } |
michael@0 | 44 | assertDeepEq(c3(), [0, 1, 2]); |
michael@0 | 45 | |
michael@0 | 46 | function c4() { |
michael@0 | 47 | "use strict"; |
michael@0 | 48 | return eval('[for (arg of (for (i of [0, 1, 2]) eval = i)) arg]'); |
michael@0 | 49 | } |
michael@0 | 50 | assertThrows(c4, SyntaxError); |
michael@0 | 51 | |
michael@0 | 52 | reportCompare(null, null, "test"); |