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 // |reftest| skip-if(!xulRuntime.shell) -- needs newGlobal()
2 /*
3 * Any copyright is dedicated to the Public Domain.
4 * http://creativecommons.org/licenses/publicdomain/
5 */
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 608473;
9 var summary =
10 '|var eval = otherWindow.eval; eval(...)| should behave like indirectly ' +
11 'calling that eval from a script in that other window';
13 print(BUGNUMBER + ": " + summary);
15 /**************
16 * BEGIN TEST *
17 **************/
19 var originalEval = eval;
20 var res;
22 function f()
23 {
24 return [this, eval("this")];
25 }
27 var otherGlobalSameCompartment = newGlobal("same-compartment");
29 eval = otherGlobalSameCompartment.eval;
30 res = new f();
31 assertEq(res[0] !== res[1], true);
32 assertEq(res[0] !== this, true);
33 assertEq(res[0] instanceof f, true);
34 assertEq(res[1], otherGlobalSameCompartment);
36 res = f();
37 assertEq(res[0] !== res[1], true);
38 assertEq(res[0], this);
39 assertEq(res[1], otherGlobalSameCompartment);
41 var otherGlobalDifferentCompartment = newGlobal();
43 eval = otherGlobalDifferentCompartment.eval;
44 res = new f();
45 assertEq(res[0] !== res[1], true);
46 assertEq(res[0] !== this, true);
47 assertEq(res[0] instanceof f, true);
48 assertEq(res[1], otherGlobalDifferentCompartment);
50 res = f();
51 assertEq(res[0] !== res[1], true);
52 assertEq(res[0], this);
53 assertEq(res[1], otherGlobalDifferentCompartment);
55 /******************************************************************************/
57 if (typeof reportCompare === "function")
58 reportCompare(true, true);
60 print("All tests passed!");