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

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 promise = g.f();

  assertEq(frame.older, null);

  await promise;

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