js/src/jit-test/tests/debug/Frame-onStep-08.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 // frame.onStep can coexist with breakpoints.
     3 var g = newGlobal();
     4 var dbg = Debugger(g);
     5 var log = '';
     6 dbg.onEnterFrame = function (frame) {
     7     var handler = {hit: function () { log += 'B'; }};
     8     var lines = frame.script.getAllOffsets();
     9     for (var line in lines) {
    10         line = Number(line);
    11         var offs = lines[line];
    12         for (var i = 0; i < offs.length; i++)
    13             frame.script.setBreakpoint(offs[i], handler);
    14     }
    16     frame.onStep = function () { log += 's'; };
    17 };
    19 g.eval("one = 1;\n" +
    20        "two = 2;\n" +
    21        "three = 3;\n" +
    22        "four = 4;\n");
    23 assertEq(g.four, 4);
    25 // Breakpoints hit on all four lines.
    26 assertEq(log.replace(/[^B]/g, ''), 'BBBB');
    28 // onStep was called between each pair of breakpoints.
    29 assertEq(/BB/.exec(log), null);

mercurial