summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/testEarlyReturnOnCall.js
blob: f783f5a1f0b958a53621da6a51bb3d76a5c84bd3 (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
var g = newGlobal({newCompartment: true});
g.eval("var success = false");
g.eval("function ponies() {}");
g.eval("function foo() { ponies(); success = false }");

var dbg = new Debugger(g);
dbg.onEnterFrame = function(frame) {
    // The goal here is force an early return on the 'call' instruction,
    // which should be the 3rd step (callgname, undefined, call)
    var step = 0;
    frame.onStep = function() {
        ++step;
        if (step == 2) {
            g.success = true;
            return;
        }
        if (step == 3)
            return { return: undefined }
    }
    frame.onPop = function() { new Error(); /* boom */ }
}

g.foo();
assertEq(g.success, true);