js/src/jit-test/tests/debug/Frame-onStep-01.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-01.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,24 @@
     1.4 +// Simple Debugger.Frame.prototype.onStep test.
     1.5 +// Test that onStep fires often enough to see all four values of a.
     1.6 +
     1.7 +var g = newGlobal();
     1.8 +g.a = 0;
     1.9 +g.eval("function f() {\n" +
    1.10 +       "    a += 2;\n" +
    1.11 +       "    a += 2;\n" +
    1.12 +       "    a += 2;\n" +
    1.13 +       "    return a;\n" +
    1.14 +       "}\n");
    1.15 +
    1.16 +var dbg = Debugger(g);
    1.17 +var seen = [0, 0, 0, 0, 0, 0, 0];
    1.18 +dbg.onEnterFrame = function (frame) {
    1.19 +    frame.onStep = function () {
    1.20 +        assertEq(arguments.length, 0);
    1.21 +        assertEq(this, frame);
    1.22 +        seen[g.a] = 1;
    1.23 +    };
    1.24 +}
    1.25 +
    1.26 +g.f();
    1.27 +assertEq(seen.join(""), "1010101");

mercurial