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 // test frame.eval in non-top frames
3 var g = newGlobal();
4 var N = g.N = 12; // must be even
5 assertEq(N % 2, 0);
6 var dbg = new Debugger(g);
7 var hits = 0;
8 dbg.onDebuggerStatement = function (frame) {
9 var n = frame.eval("n").return;
10 if (n === 0) {
11 for (var i = 0; i <= N; i++) {
12 assertEq(frame.type, 'call');
13 assertEq(frame.callee.name, i % 2 === 0 ? 'even' : 'odd');
14 assertEq(frame.eval("n").return, i);
15 frame = frame.older;
16 }
17 assertEq(frame.type, 'call');
18 assertEq(frame.callee.name, undefined);
19 frame = frame.older;
20 assertEq(frame.type, 'eval');
21 hits++;
22 }
23 };
25 var result = g.eval("(" + function () {
26 function odd(n) { return n > 0 && !even(n - 1); }
27 function even(n) { debugger; return n == 0 || !odd(n - 1); }
28 return even(N);
29 } + ")();");
30 assertEq(result, true);
31 assertEq(hits, 1);