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 | // Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | // http://creativecommons.org/licenses/publicdomain/ |
michael@0 | 3 | // Contributor: Jim Blandy |
michael@0 | 4 | |
michael@0 | 5 | if (typeof findReferences == "function") { |
michael@0 | 6 | |
michael@0 | 7 | function makeGenerator(c) { eval(c); yield function generatorClosure() { return x; }; } |
michael@0 | 8 | var generator = makeGenerator('var x = 42'); |
michael@0 | 9 | var closure = generator.next(); |
michael@0 | 10 | referencesVia(closure, 'parent; generator object', generator); |
michael@0 | 11 | |
michael@0 | 12 | var o = {}; |
michael@0 | 13 | |
michael@0 | 14 | assertEq(function f() { |
michael@0 | 15 | return referencesVia(null, 'arguments', arguments) || |
michael@0 | 16 | referencesVia(null, 'baseline-args-obj', arguments); |
michael@0 | 17 | }(), true); |
michael@0 | 18 | |
michael@0 | 19 | var rvalueCorrect; |
michael@0 | 20 | |
michael@0 | 21 | function finallyHoldsRval() { |
michael@0 | 22 | try { |
michael@0 | 23 | return o; |
michael@0 | 24 | } finally { |
michael@0 | 25 | rvalueCorrect = referencesVia(null, 'rval', o) || |
michael@0 | 26 | referencesVia(null, 'baseline-rval', o); |
michael@0 | 27 | } |
michael@0 | 28 | } |
michael@0 | 29 | rvalueCorrect = false; |
michael@0 | 30 | finallyHoldsRval(); |
michael@0 | 31 | assertEq(rvalueCorrect, true); |
michael@0 | 32 | |
michael@0 | 33 | // Because we don't distinguish between JavaScript stack marking and C++ |
michael@0 | 34 | // stack marking (both use the conservative scanner), we can't really write |
michael@0 | 35 | // the following tests meaningfully: |
michael@0 | 36 | // generator frame -> generator object |
michael@0 | 37 | // stack frame -> local variables |
michael@0 | 38 | // stack frame -> this |
michael@0 | 39 | // stack frame -> callee |
michael@0 | 40 | // for(... in x) loop's reference to x |
michael@0 | 41 | |
michael@0 | 42 | reportCompare(true, true); |
michael@0 | 43 | } else { |
michael@0 | 44 | reportCompare(true, true, "test skipped: findReferences is not a function"); |
michael@0 | 45 | } |