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.
1 Function.prototype.callX = Function.prototype.call;
2 var x;
3 function f() {
4 x = f.caller;
5 return x;
6 }
8 function g() {
9 return f.callX(null);
10 }
12 function h1() {
13 // native
14 return ([0].map(f))[0];
15 }
17 function h2() {
18 // self-hosted
19 x = null;
20 [0].forEach(f);
21 return x;
22 }
24 function k() {
25 x = null;
26 [0, 1].sort(f);
27 return x;
28 }
30 function l() {
31 return f();
32 }
34 assertEq(g(), g);
35 assertEq(h1(), h1);
36 assertEq(h2(), h2);
37 assertEq(k(), k);
38 assertEq(l(), l);
40 var baz;
41 var foo = {callX: function() { return "m"; }};
42 function bar() {
43 return baz.caller;
44 }
45 function m() {
46 return baz.callX(null);
47 }
49 baz = foo;
50 assertEq(m(), "m");
51 baz = bar;
52 assertEq(m(), m);
53 assertEq(m(), m);