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: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
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 c = 0; |
michael@0 | 8 | |
michael@0 | 9 | function f(a) { |
michael@0 | 10 | const b = a; |
michael@0 | 11 | try { |
michael@0 | 12 | eval('"use strict"; b = 1 + a; c = 1'); |
michael@0 | 13 | assertEq(0, 1); |
michael@0 | 14 | } catch (e) { |
michael@0 | 15 | assertEq(e.name, 'TypeError'); |
michael@0 | 16 | assertEq(0, c); |
michael@0 | 17 | assertEq(a, b); |
michael@0 | 18 | } |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | var w = 42; |
michael@0 | 22 | f(w); |
michael@0 | 23 | |
michael@0 | 24 | c = 2; |
michael@0 | 25 | try { |
michael@0 | 26 | eval('"use strict"; function g(x) { const y = x; y = 1 + x; } c = 3'); |
michael@0 | 27 | assertEq(0, 1); |
michael@0 | 28 | } catch (e) { |
michael@0 | 29 | assertEq(e.name, 'TypeError'); |
michael@0 | 30 | assertEq(2, c); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | c = 4; |
michael@0 | 34 | try { |
michael@0 | 35 | eval('"use strict"; const z = w; z = 1 + w; c = 5'); |
michael@0 | 36 | assertEq(0, 1); |
michael@0 | 37 | } catch (e) { |
michael@0 | 38 | assertEq(e.name, 'TypeError'); |
michael@0 | 39 | assertEq(4, c); |
michael@0 | 40 | assertEq('z' in this, false); |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | reportCompare(0, 0, "ok"); |