summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/baseline/bug836742.js
blob: b8e3761c12080f9a72de3b8b8988ec5531a965dd (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
28
29
30
31
32
33
// Ensure the correct frame is passed to exception unwind hooks.
var g = newGlobal({newCompartment: true});
g.debuggeeGlobal = this;
g.eval("(" + function () {
    frames = [];
    var dbg = Debugger(debuggeeGlobal);
    dbg.onEnterFrame = function(frame) {
	frames.push(frame);
    };
    dbg.onExceptionUnwind = function(frame) {
	assertEq(frames.indexOf(frame), frames.length - 1);
	frames.pop();
	assertEq(frame, dbg.getNewestFrame());
    }
} + ")()");

function f(n) {
    debugger;
    n--;
    if (n > 0) {
        f(n);
    } else {
	assertEq(g.frames.length, 10);
        throw "fit";
    }
}
try {
    f(10);
    assertEq(0, 1);
} catch (e) {
    assertEq(e, "fit");
}
assertEq(g.frames.length, 0);