mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 765907 - Don't save frame variables of dead generators in the debugger (r=billm)
This commit is contained in:
parent
0526922dc1
commit
44fc2c4d2b
@ -1,16 +1,24 @@
|
||||
var g = newGlobal('new-compartment');
|
||||
var dbg = new Debugger(g);
|
||||
|
||||
|
||||
var hits = 0;
|
||||
dbg.onDebuggerStatement = function(frame) {
|
||||
++hits;
|
||||
frame.older.eval("escaped = function() { return y }");
|
||||
}
|
||||
|
||||
g.escaped = undefined;
|
||||
g.eval("function h() { debugger }");
|
||||
g.eval("(function () { var y = 42; h(); yield })().next();");
|
||||
assertEq(g.eval("escaped()"), 42);
|
||||
var arr = [];
|
||||
const N = 10;
|
||||
|
||||
for (var i = 0; i < N; ++i) {
|
||||
g.escaped = undefined;
|
||||
g.eval("function h() { debugger }");
|
||||
g.eval("(function () { var y = {p:42}; h(); yield })().next();");
|
||||
assertEq(g.eval("escaped().p"), 42);
|
||||
arr.push(g.escaped);
|
||||
}
|
||||
|
||||
gc();
|
||||
assertEq(g.eval("escaped()"), 42);
|
||||
|
||||
for (var i = 0; i < N; ++i)
|
||||
arr[i]();
|
||||
|
@ -1522,16 +1522,10 @@ DebugScopes::sweep()
|
||||
* As explained in onGeneratorFrameChange, liveScopes includes
|
||||
* suspended generator frames. Since a generator can be finalized while
|
||||
* its scope is live, we must explicitly detect finalized generators.
|
||||
* Since the scope is still live, we simulate the onPop* call by
|
||||
* copying unaliased variables into the scope object.
|
||||
*/
|
||||
if (JSGenerator *gen = fp->maybeSuspendedGenerator(rt)) {
|
||||
JS_ASSERT(gen->state == JSGEN_NEWBORN || gen->state == JSGEN_OPEN);
|
||||
if (!IsObjectMarked(&gen->obj)) {
|
||||
if (scope->isCall())
|
||||
scope->asCall().copyUnaliasedValues(fp);
|
||||
else if (scope->isBlock())
|
||||
scope->asClonedBlock().copyUnaliasedValues(fp);
|
||||
e.removeFront();
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user