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 // getLineOffsets correctly places the various parts of a ForStatement.
3 var g = newGlobal();
4 var dbg = Debugger(g);
5 dbg.onDebuggerStatement = function (frame) {
6 function handler(line) {
7 return {hit: function (frame) { g.log += "" + line; }};
8 }
10 var s = frame.eval("f").return.script;
11 for (var line = 2; line <= 6; line++) {
12 var offs = s.getLineOffsets(g.line0 + line);
13 var h = handler(line);
14 for (var i = 0; i < offs.length; i++) {
15 assertEq(s.getOffsetLine(offs[i]), g.line0 + line);
16 s.setBreakpoint(offs[i], h);
17 }
18 }
19 };
21 g.log = '';
22 g.eval("var line0 = Error().lineNumber;\n" +
23 "function f(n) {\n" + // line0 + 1
24 " for (var i = 0;\n" + // line0 + 2
25 " i < n;\n" + // line0 + 3
26 " i++)\n" + // line0 + 4
27 " log += '.';\n" + // line0 + 5
28 " log += '!';\n" + // line0 + 6
29 "}\n" +
30 "debugger;\n");
31 assertEq(g.log, "");
32 g.f(3);
33 assertEq(g.log, "235.435.435.436!");