summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/onEnterFrame-async-resumption-12.js
blob: 28ad0c4c44ca2037e8df237e7ea7567534cf6844 (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() {
        return "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().then(x => {
    assertEq(hits, 1);
    assertEq(x, "ok");
});