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.
michael@0 | 1 | // clearBreakpoint clears breakpoints for the current Debugger object only. |
michael@0 | 2 | |
michael@0 | 3 | var g = newGlobal(); |
michael@0 | 4 | |
michael@0 | 5 | var hits = 0; |
michael@0 | 6 | var handler = { |
michael@0 | 7 | hit: function (frame) { |
michael@0 | 8 | hits++; |
michael@0 | 9 | frame.script.clearBreakpoint(handler); |
michael@0 | 10 | } |
michael@0 | 11 | }; |
michael@0 | 12 | |
michael@0 | 13 | function attach(i) { |
michael@0 | 14 | var dbg = Debugger(g); |
michael@0 | 15 | dbg.onDebuggerStatement = function (frame) { |
michael@0 | 16 | var s = frame.script; |
michael@0 | 17 | var offs = s.getLineOffsets(g.line0 + 2); |
michael@0 | 18 | for (var i = 0; i < offs.length; i++) |
michael@0 | 19 | s.setBreakpoint(offs[i], handler); |
michael@0 | 20 | }; |
michael@0 | 21 | } |
michael@0 | 22 | for (var i = 0; i < 4; i++) |
michael@0 | 23 | attach(i); |
michael@0 | 24 | |
michael@0 | 25 | g.eval("var line0 = Error().lineNumber;\n" + |
michael@0 | 26 | "debugger;\n" + // line0 + 1 |
michael@0 | 27 | "Math.sin(0);\n"); // line0 + 2 |
michael@0 | 28 | assertEq(hits, 4); |