summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-older-02.js
blob: c5f772e46c9e640806aad4d9c2367b6f74e040cb (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
33
34
// An explicit async stack should interrupt a Debugger.Frame chain.

var g = newGlobal({ newCompartment: true });
var dbg = new Debugger(g);
let done = false;
dbg.onDebuggerStatement = function (frame) {
  // The frame has no "older" frame because the explicit async stack
  // attached to the async function takes priority over the real
  // parent frame that is tracked in the frame iterator.
  assertEq(!!frame.older, false);

  done = true;
};

g.eval(`
let draining = false;
async function run() {
  await Promise.resolve();

  // Make sure that the test is running within "drainJobQueue()".
  assertEq(draining, true);
  debugger;
}

(function main() {
  run();

  // Force resumption of the "run" function.
  draining = true;
  drainJobQueue();
  draining = false;
})();
`);
assertEq(done, true);