Debian Codegraph @

js/src/jit-test/tests/debug/onEnterFrame-async-resumption-11.js

raw
1 // If the async function's promise is already resolved, any attempt to return
2 // a differerent return value gets ignored.
3
4 let g = newGlobal({newCompartment: true});
5 g.eval(`
6 async function f() {
7 throw "ok";
8 }
9 `);
10
11 let dbg = new Debugger(g);
12
13 let hits = 0;
14 dbg.onEnterFrame = frame => {
15 frame.onPop = () => {
16 hits += 1;
17
18 // Normal functions can override the return value, but async functions
19 // have already resolved their promise, so this return request will get
20 // ignored.
21 return {return: "FAIL"};
22 };
23 };
24
25 g.f().catch(x => {
26 assertEq(hits, 1);
27 assertEq(x, "ok");
28 });