summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/onEnterFrame-async-resumption-09.js
blob: 4a3bd52c3bb0f98c83640142b6288875eeae9aa3 (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
29
30
31
32
33
// Resume execution of async generator when initially yielding.

let g = newGlobal({newCompartment: true});
let dbg = new Debugger();
let gw = dbg.addDebuggee(g);

g.eval(`
    async function* f() {
        await 123;
        return "ponies";
    }
`);

let counter = 0;
dbg.onEnterFrame = frame => {
    frame.onPop = completion => {
        if (counter++ === 0) {
            let genObj = completion.return.unsafeDereference();

            genObj.next().then(({value, done}) => {
                assertEq(value, "ponies");
                assertEq(done, true);
            });
        }
    };
};

let it = g.f();

it.next().then(({value, done}) => {
    assertEq(value, undefined);
    assertEq(done, true);
});