js/src/jit-test/tests/debug/Script-clearBreakpoint-04.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 // clearBreakpoint clears breakpoints for the current Debugger object only.
     3 var g = newGlobal();
     5 var hits = 0;
     6 var handler = {
     7     hit: function (frame) {
     8         hits++;
     9         frame.script.clearBreakpoint(handler);
    10     }
    11 };
    13 function attach(i) {
    14     var dbg = Debugger(g);
    15     dbg.onDebuggerStatement = function (frame) {
    16         var s = frame.script;
    17         var offs = s.getLineOffsets(g.line0 + 2);
    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        "Math.sin(0);\n");   // line0 + 2
    28 assertEq(hits, 4);

mercurial