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 | // Properties cleared in the middle of a single function constructor. |
michael@0 | 3 | |
michael@0 | 4 | function foo(x, y) { |
michael@0 | 5 | this.f = 0; |
michael@0 | 6 | this.g = x + y; |
michael@0 | 7 | this.h = 2; |
michael@0 | 8 | } |
michael@0 | 9 | |
michael@0 | 10 | var called = false; |
michael@0 | 11 | var a = 0; |
michael@0 | 12 | var b = {valueOf: function() { Object.defineProperty(Object.prototype, 'g', {set: function() { called = true }}) }}; |
michael@0 | 13 | var c = new foo(a, b); |
michael@0 | 14 | |
michael@0 | 15 | assertEq(called, true); |
michael@0 | 16 | assertEq(c.g, undefined); |
michael@0 | 17 | |
michael@0 | 18 | // Properties cleared in the middle of a constructor callee. |
michael@0 | 19 | |
michael@0 | 20 | function foo2(x, y) { |
michael@0 | 21 | this.a = 0; |
michael@0 | 22 | this.b = 1; |
michael@0 | 23 | bar2.call(this, x, y); |
michael@0 | 24 | this.c = 2; |
michael@0 | 25 | } |
michael@0 | 26 | function bar2(x, y) { |
michael@0 | 27 | this.d = x + y; |
michael@0 | 28 | this.e = 3; |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | var called2 = false; |
michael@0 | 32 | var xa = 0; |
michael@0 | 33 | var xb = {valueOf: function() { Object.defineProperty(Object.prototype, 'e', {set: function() { called2 = true }}) }}; |
michael@0 | 34 | var xc = new foo2(xa, xb); |
michael@0 | 35 | |
michael@0 | 36 | assertEq(called2, true); |
michael@0 | 37 | assertEq(xc.e, undefined); |
michael@0 | 38 | assertEq(xc.c, 2); |
michael@0 | 39 | |
michael@0 | 40 | // Properties cleared after a constructor callee. |
michael@0 | 41 | |
michael@0 | 42 | function foo3() { |
michael@0 | 43 | this.aa = 0; |
michael@0 | 44 | this.bb = 1; |
michael@0 | 45 | bar3.call(this); |
michael@0 | 46 | this.cc = 2; |
michael@0 | 47 | baz(); |
michael@0 | 48 | xbar3.call(this); |
michael@0 | 49 | this.dd = 3; |
michael@0 | 50 | } |
michael@0 | 51 | function bar3() { |
michael@0 | 52 | this.ee = 4; |
michael@0 | 53 | } |
michael@0 | 54 | function xbar3() { |
michael@0 | 55 | this.ff = 5; |
michael@0 | 56 | } |
michael@0 | 57 | function baz() { |
michael@0 | 58 | eval("xbar3.call = function() { called3 = true }"); |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | var called3 = false; |
michael@0 | 62 | var c3 = new foo3(); |
michael@0 | 63 | assertEq(c3.cc, 2); |
michael@0 | 64 | assertEq(c3.ee, 4); |
michael@0 | 65 | assertEq(c3.ff, undefined); |
michael@0 | 66 | assertEq(c3.dd, 3); |
michael@0 | 67 | assertEq(called3, true); |