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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/debug/Frame-onStep-08.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,29 @@
     1.4 +// frame.onStep can coexist with breakpoints.
     1.5 +
     1.6 +var g = newGlobal();
     1.7 +var dbg = Debugger(g);
     1.8 +var log = '';
     1.9 +dbg.onEnterFrame = function (frame) {
    1.10 +    var handler = {hit: function () { log += 'B'; }};
    1.11 +    var lines = frame.script.getAllOffsets();
    1.12 +    for (var line in lines) {
    1.13 +        line = Number(line);
    1.14 +        var offs = lines[line];
    1.15 +        for (var i = 0; i < offs.length; i++)
    1.16 +            frame.script.setBreakpoint(offs[i], handler);
    1.17 +    }
    1.18 +
    1.19 +    frame.onStep = function () { log += 's'; };
    1.20 +};
    1.21 +
    1.22 +g.eval("one = 1;\n" +
    1.23 +       "two = 2;\n" +
    1.24 +       "three = 3;\n" +
    1.25 +       "four = 4;\n");
    1.26 +assertEq(g.four, 4);
    1.27 +
    1.28 +// Breakpoints hit on all four lines.
    1.29 +assertEq(log.replace(/[^B]/g, ''), 'BBBB');
    1.30 +
    1.31 +// onStep was called between each pair of breakpoints.
    1.32 +assertEq(/BB/.exec(log), null);

mercurial