summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-onStep-02.js
blob: 6e02449bc7c8ce5d1da8de452c5cddd94437cdd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Setting frame.onStep to undefined turns off single-stepping.

var g = newGlobal();
g.a = 0;
g.eval("function f() {\n" +
       "    a++;\n" +
       "    a++;\n" +
       "    a++;\n" +
       "    a++;\n" +
       "    return a;\n" +
       "}\n");

var dbg = Debugger(g);
var seen = [0, 0, 0, 0, 0];
dbg.onEnterFrame = function (frame) {
    seen[g.a] = 1;
    frame.onStep = function () {
        seen[g.a] = 1;
        if (g.a === 2) {
            frame.onStep = undefined;
            assertEq(frame.onStep, undefined);
        }
    };
}

g.f();
assertEq(seen.join(","), "1,1,1,0,0");