Bug 1539654 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

The following script should print out two completions (one for the await, and one for the return), but only prints one:

let g = newGlobal({newCompartment: true});
g.eval(`
    async function f() {
        debugger;
        await Promise.resolve(3);
        return "ok";
    }
`);

let dbg = Debugger(g);
dbg.onDebuggerStatement = frame => {
    frame.onPop = completion => {
        print(`completion: ${uneval(completion)}`);
    };
};

g.dis(g.f);
g.f().then(value => { print(`callback`); });
The following script should print out two completions (one for the await, and one for the return), but only prints one:
```
let g = newGlobal({newCompartment: true});
g.eval(`
    async function f() {
        debugger;
        await Promise.resolve(3);
        return "ok";
    }
`);

let dbg = Debugger(g);
dbg.onDebuggerStatement = frame => {
    frame.onPop = completion => {
        print(`completion: ${uneval(completion)}`);
    };
};

g.dis(g.f);
g.f().then(value => { print(`callback`); });
```

Back to Bug 1539654 Comment 0