js/src/jit-test/tests/debug/Script-clearBreakpoint-02.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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 breakpoint cleared during dispatch does not fire.
     2 // (Breakpoint dispatch is well-behaved even when breakpoint handlers clear other breakpoints.)
     4 var g = newGlobal();
     5 var dbg = Debugger(g);
     6 var log = '';
     7 dbg.onDebuggerStatement = function (frame) {
     8     var s = frame.script;
     9     function handler(i) {
    10         if (i === 1)
    11             return function () { log += i; s.clearBreakpoint(h[1]); s.clearBreakpoint(h[2]); };
    12         return function () { log += i; };
    13     }
    14     var offs = s.getLineOffsets(g.line0 + 2);
    15     var h = [];
    16     for (var i = 0; i < 4; i++) {
    17         h[i] = {hit: handler(i)};
    18         for (var j = 0; j < offs.length; j++)
    19             s.setBreakpoint(offs[j], h[i]);
    20     }
    21 };
    23 g.eval("var line0 = Error().lineNumber;\n" +
    24        "debugger;\n" +          // line0 + 1
    25        "result = 'ok';\n");     // line0 + 2
    26 assertEq(log, '013');

mercurial