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 // The decompiler correctly handles for-of loops.
3 function tokens(code) {
4 var arr = [];
5 var s = code.replace(/\w+|[^\s]/g, function (tok) { arr.push(tok); return ""; });
6 assertEq(s.trim(), "", "tokens() should find all tokens in code: " + uneval(code));
7 return arr;
8 }
10 function test(code) {
11 var before = "function f() { " + code + " }";
12 var after = eval("(" + before + ")").toString();
13 assertEq(tokens(before).join(" "), tokens(after).join(" "), "decompiler failed to round-trip");
14 }
16 // statements
17 test("for (a of b) { f(a); }");
18 test("for (a of b) { f(a); g(a); }");
20 // for-of with "in" operator nearby
21 test("for (a of b in c ? c : c.items()) { f(a); }");
23 // destructuring
24 test("for ([a, b] of c) { a.m(b); }");
26 // for-let-of
27 test("for (let a of b) { f(a); }");
28 test("for (let [a, b] of c) { a.m(b); }");
30 // array comprehensions
31 test("return [a for (a of b)];");
32 test("return [[b, a] for ([a, b] of c.items())];");
34 // generator expressions
35 test("return (a for (a of b));");