summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/onExceptionUnwind-resumption-05.js
blob: 00fe2aae4406b4e272d39399666b95a17e55eae1 (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
// Make sure that stacks in completion values are not lost when an exception
// unwind hook returns undefined.

let g = newGlobal({ newCompartment: true });
g.eval(`
  function foo() {
    bar();
  }
  function bar() {
    throw new Error();
  }
`);

let dbg = Debugger(g);
let unwindHits = 0, popHits = 0;
dbg.onExceptionUnwind = frame => {
  unwindHits++;
  return undefined;
}
dbg.onEnterFrame = frame => {
  frame.onPop = completion => {
    assertEq(completion.stack.functionDisplayName, "bar");
    popHits++;
  };
};

try {
  g.eval("foo()");
} catch (e) {}
assertEq(unwindHits, 3);
assertEq(popHits, 3);
dbg.removeDebuggee(g);