summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-constructing-02.js
blob: b1c0c846a719b67a280de56ea588271235a86408 (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
// Debugger.Frame.prototype.constructing on an async function.

load(libdir + "asserts.js");

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

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

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

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

  assertEq(frame.constructing, false);
  frame = null;

  await promise;

  assertEq(!!frame, true);
  // Throws because the frame has terminated.
  assertThrowsInstanceOf(() => frame.constructing, Error);
})();