Debian Codegraph @

js/src/jit-test/tests/baseline/bug836742.js

raw
1 // Ensure the correct frame is passed to exception unwind hooks.
2 var g = newGlobal({newCompartment: true});
3 g.debuggeeGlobal = this;
4 g.eval("(" + function () {
5 frames = [];
6 var dbg = Debugger(debuggeeGlobal);
7 dbg.onEnterFrame = function(frame) {
8 frames.push(frame);
9 };
10 dbg.onExceptionUnwind = function(frame) {
11 assertEq(frames.indexOf(frame), frames.length - 1);
12 frames.pop();
13 assertEq(frame, dbg.getNewestFrame());
14 }
15 } + ")()");
16
17 function f(n) {
18 debugger;
19 n--;
20 if (n > 0) {
21 f(n);
22 } else {
23 assertEq(g.frames.length, 10);
24 throw "fit";
25 }
26 }
27 try {
28 f(10);
29 assertEq(0, 1);
30 } catch (e) {
31 assertEq(e, "fit");
32 }
33 assertEq(g.frames.length, 0);