summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-older-generators-05.js
blob: 61267a84437b24283e56fabb35d109c918b15dcc (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
// Test that Debugger.Frame.prototype.older works on suspended async generators.

load(libdir + "asserts.js");

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

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

let frame;
dbg.onEnterFrame = f => {
  frame = f;
  dbg.onEnterFrame = undefined;
};

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

  assertEq(frame.older, null);

  const promise = it.next();

  assertEq(frame.older, null);

  await promise;

  assertThrowsInstanceOf(() => frame.older, Error);
})();