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 // A closure's .environment keeps the lexical environment alive even if the closure is destroyed.
3 var N = 4;
4 var g = newGlobal();
5 g.eval("function add(a) { return function (b) { return eval('a + b'); }; }");
6 var dbg = new Debugger;
7 var gw = dbg.addDebuggee(g);
8 var aw = gw.getOwnPropertyDescriptor("add").value;
10 // Create N closures and collect environments.
11 var arr = [];
12 for (var i = 0; i < N; i++)
13 arr[i] = aw.call(null, i).return.environment;
15 // Test that they work now.
16 function check() {
17 for (var i = 0; i < N; i++) {
18 assertEq(arr[i].find("b"), null);
19 assertEq(arr[i].find("a"), arr[i]);
20 }
21 }
22 check();
24 // Test that they work after gc.
25 gc();
26 gc({});
27 g.gc(g);
28 check();