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 /* Check that strict mode functions get decompiled properly. */
7 function lenient() { return typeof this == "object"; }
8 assertEq(eval(uneval(lenient) + "lenient;")(), true);
10 function strict() { 'use strict'; return typeof this == "undefined"; }
11 print(uneval(strict));
12 assertEq(eval(uneval(strict) + "strict;")(), true);
14 function lenient_outer() {
15 function lenient_inner() {
16 return typeof this == "object";
17 }
18 return lenient_inner;
19 }
20 assertEq(eval(uneval(lenient_outer()) + "lenient_inner;")(), true);
22 function strict_outer() {
23 "use strict";
24 function strict_inner() {
25 return typeof this == "undefined";
26 }
27 return strict_inner;
28 }
29 assertEq(eval(uneval(strict_outer()) + "strict_inner;")(), true);
31 function lenient_outer_closure() {
32 return function lenient_inner_closure() {
33 return typeof this == "object";
34 };
35 }
36 assertEq(eval(uneval(lenient_outer_closure()))(), true);
38 function strict_outer_closure() {
39 "use strict";
40 return function strict_inner_closure() {
41 return typeof this == "undefined";
42 };
43 }
44 assertEq(eval(uneval(strict_outer_closure()))(), true);
46 function lenient_outer_expr() {
47 return function lenient_inner_expr() (typeof this == "object");
48 }
49 assertEq(eval(uneval(lenient_outer_expr()))(), true);
51 /*
52 * This doesn't work, because we have no way to include strict mode
53 * directives in expression closures.
54 *
55 * function strict_outer_expr() {
56 * return function strict_inner_expr() (typeof this == "undefined");
57 * }
58 * assertEq(eval(uneval(strict_outer_expr()))(), true);
59 */
61 reportCompare(true, true);