Bug 1098947 - Fix scope unwinding bug when closing a legacy generator. r=shu

This commit is contained in:
Jan de Mooij 2014-11-17 21:17:25 +01:00
parent 2bc3fddde6
commit 05fae492cf
2 changed files with 16 additions and 2 deletions

View File

@ -0,0 +1,11 @@
function f() {
try {
let foo = 3;
for (var i=0; i<50; i++)
yield i + foo;
} catch(e) {}
}
var it = f();
for (var i=0; i<40; i++)
it.next();
it.close();

View File

@ -544,8 +544,11 @@ HandleClosingGeneratorReturn(JSContext *cx, const JitFrameIterator &frame, jsbyt
cx->clearPendingException();
frame.baselineFrame()->setReturnValue(UndefinedValue());
if (frame.baselineFrame()->isDebuggee() && unwoundScopeToPc)
frame.baselineFrame()->setUnwoundScopeOverridePc(unwoundScopeToPc);
if (unwoundScopeToPc) {
if (frame.baselineFrame()->isDebuggee())
frame.baselineFrame()->setUnwoundScopeOverridePc(unwoundScopeToPc);
pc = unwoundScopeToPc;
}
ForcedReturn(cx, frame, pc, rfe, calledDebugEpilogue);
}