summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/onEnterFrame-async-resumption-11.js
blob: 32adf64d857d301260e157df807222e9ff64ab9f (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
// If the async function's promise is already resolved, any attempt to return
// a differerent return value gets ignored.

let g = newGlobal({newCompartment: true});
g.eval(`
    async function f() {
        throw "ok";
    }
`);

let dbg = new Debugger(g);

let hits = 0;
dbg.onEnterFrame = frame => {
    frame.onPop = () => {
        hits += 1;

        // Normal functions can override the return value, but async functions
        // have already resolved their promise, so this return request will get
        // ignored.
        return {return: "FAIL"};
    };
};

g.f().catch(x => {
    assertEq(hits, 1);
    assertEq(x, "ok");
});