js/src/jit-test/tests/debug/breakpoint-01.js

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 // Basic breakpoint test.
     3 var g = newGlobal();
     4 g.s = '';
     5 var handler = {
     6     hit: function (frame) {
     7         assertEq(this, handler);
     8         g.s += '1';
     9     }
    10 };
    11 var dbg = Debugger(g);
    12 dbg.onDebuggerStatement = function (frame) {
    13     g.s += '0';
    14     var line0 = frame.script.getOffsetLine(frame.offset);
    15     var offs = frame.script.getLineOffsets(line0 + 2);
    16     for (var i = 0; i < offs.length; i++)
    17         frame.script.setBreakpoint(offs[i], handler);
    18 };
    19 g.eval("debugger;\n" +
    20        "s += 'a';\n" +  // line0 + 1
    21        "s += 'b';\n");  // line0 + 2
    22 assertEq(g.s, "0a1b");

mercurial