summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-terminated-04.js
blob: 74d00c8a5b91dc5f3539120954e76307f834e418 (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
// Check `.terminated` functionality for async generator 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 it = g.f();

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

  const promise = it.next();

  assertEq(frame.terminated, false);

  await promise;

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