summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/baseline/bug836742.js
blob: d2f1d68ac3e120927860862b42c6716f9e7ba35c (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();
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);