Debian Codegraph @

js/src/jit-test/tests/debug/Frame-older-02.js

raw
1 // An explicit async stack should interrupt a Debugger.Frame chain.
2
3 var g = newGlobal({ newCompartment: true });
4 var dbg = new Debugger(g);
5 let done = false;
6 dbg.onDebuggerStatement = function (frame) {
7 // The frame has no "older" frame because the explicit async stack
8 // attached to the async function takes priority over the real
9 // parent frame that is tracked in the frame iterator.
10 assertEq(!!frame.older, false);
11
12 done = true;
13 };
14
15 g.eval(`
16 let draining = false;
17 async function run() {
18 await Promise.resolve();
19
20 // Make sure that the test is running within "drainJobQueue()".
21 assertEq(draining, true);
22 debugger;
23 }
24
25 (function main() {
26 run();
27
28 // Force resumption of the "run" function.
29 draining = true;
30 drainJobQueue();
31 draining = false;
32 })();
33 `);
34 assertEq(done, true);