Open
Bug 1607662
Opened 5 years ago
Updated 1 year ago
[jsdbg2] Passing completion values through onPop handlers doesn't work in generators
Categories
(Core :: JavaScript Engine, defect, P3)
Core
JavaScript Engine
Tracking
()
NEW
People
(Reporter: jimb, Unassigned)
References
(Blocks 1 open bug)
Details
A user of the Debugger API should be able to assume that if their onPop handler simply returns the completion value it was passed as its resumption value, that will have no effect on execution. This works on ordinary functions, but not generators:
var g = newGlobal({ newCompartment: true });
var dbg1 = new Debugger(g);
var dbg2 = new Debugger(g);
g.eval(`
function* f() {
debugger;
}
`);
dbg1.onDebuggerStatement = dbg2.onDebuggerStatement = (frame) => {
frame.onPop = (completion) => {
return completion;
};
};
print(uneval(g.f().next()));
This prints:
({value:{value:{value:(void 0), done:true}, done:true}, done:true})
Each Debugger's onPop handler re-wraps the iterator result object received from the prior handler, so we get a triply-nested result object.
Perhaps the onPop handler for a generator shouldn't get the iterator result object; rather, it should get the value of the result object.
Comment 1•5 years ago
|
||
I ran into this too and apparently forgot to file it, woops. I 100% agree that completion should only be the value and not the iterator result object.
Updated•5 years ago
|
Priority: -- → P3
Updated•3 years ago
|
Severity: normal → S3
Updated•1 year ago
|
Blocks: js-debugger
You need to log in
before you can comment on or make changes to this bug.
Description
•