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

mercurial