Debian Codegraph @

js/src/jit-test/tests/debug/Frame-onStep-resumption-06.js

raw
1 // |jit-test| error:all-jobs-completed-successfully
2 // Verifiy that onStep's force-return queues the promise microtask to run in
3 // the debuggee's job queue, not the debugger's
4 // AutoDebuggerJobQueueInterruption.
5
6 let g = newGlobal({ newCompartment: true });
7 g.eval(`
8 async function asyncFn(x) {
9 await Promise.resolve();
10 }
11 function enterDebuggee(){}
12 `);
13 const dbg = new Debugger(g);
14
15 (async function() {
16 let it = g.asyncFn();
17
18 // Force-return when the await resumes and steps.
19 dbg.onEnterFrame = frame => {
20 dbg.onEnterFrame = undefined;
21 frame.onStep = () => ({ return: "exit" });
22 };
23
24 const result = await it;
25 assertEq(result, "exit");
26 // If execution here is resumed from the debugger's queue, this call will
27 // trigger DebuggeeWouldRun exception.
28 g.enterDebuggee();
29
30 throw "all-jobs-completed-successfully";
31 })();