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 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* |
michael@0 | 3 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 4 | * http://creativecommons.org/licenses/publicdomain/ |
michael@0 | 5 | */ |
michael@0 | 6 | |
michael@0 | 7 | var v="global"; |
michael@0 | 8 | function f(a) { |
michael@0 | 9 | // This eval could extend f's call object. However, the call object has |
michael@0 | 10 | // not yet been marked as a delegate at this point, so no scope chain |
michael@0 | 11 | // purge takes place when it is extended. |
michael@0 | 12 | eval(a); |
michael@0 | 13 | let (b=3) { |
michael@0 | 14 | // This eval causes the cloned block object to be added to the |
michael@0 | 15 | // scope chain. The block needs a unique shape: its parent call |
michael@0 | 16 | // could acquire bindings for anything without affecting the global |
michael@0 | 17 | // object's shape, so it's up to the block's shape to mismatch all |
michael@0 | 18 | // property cache entries for prior blocks. |
michael@0 | 19 | eval(""); |
michael@0 | 20 | return v; |
michael@0 | 21 | }; |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | // Call the function once, to cache a reference to the global v from within |
michael@0 | 25 | // f's lexical block. |
michael@0 | 26 | assertEq("global", f("")); |
michael@0 | 27 | |
michael@0 | 28 | // Call the function again, adding a binding to the call, and ensure that |
michael@0 | 29 | // we do not see any property cache entry created by the previous reference |
michael@0 | 30 | // that would direct us to the global definition. |
michael@0 | 31 | assertEq("local", f("var v='local'")); |
michael@0 | 32 | |
michael@0 | 33 | // Similarly,but with a doubly-nested block; make sure everyone gets marked. |
michael@0 | 34 | function f2(a) { |
michael@0 | 35 | eval(a); |
michael@0 | 36 | let (b=3) { |
michael@0 | 37 | let (c=4) { |
michael@0 | 38 | eval(""); |
michael@0 | 39 | return v; |
michael@0 | 40 | }; |
michael@0 | 41 | }; |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | assertEq("global", f2("")); |
michael@0 | 45 | assertEq("local", f2("var v='local'")); |
michael@0 | 46 | |
michael@0 | 47 | reportCompare(true, true); |