summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-terminated-02.js
blob: 86323db5cbbd04c031fa153324f4d1652abe73d7 (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
// Check `.terminated` functionality for async functions.

const g = newGlobal({ newCompartment: true });
const dbg = new Debugger(g);

g.eval(`
async function f(){
  await Promise.resolve();
}
`);

let frame;
dbg.onEnterFrame = function(f) {
  frame = f;
  assertEq(frame.terminated, false);
};

(async () => {
  const promise = g.f();

  assertEq(frame instanceof Debugger.Frame, true);
  assertEq(frame.terminated, false);

  await promise;

  assertEq(frame.terminated, true);
})();