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