Bug 1331585 - Allow falsy "done" values for IteratorClose due to exception during array destructuring

Issue #74
This commit is contained in:
janekptacijarabaci 2018-03-25 14:48:34 +02:00 committed by Roy Tam
commit 4ac4296fce
3 changed files with 25 additions and 8 deletions

View file

@ -1205,8 +1205,9 @@ ProcessTryNotes(JSContext* cx, EnvironmentIter& ei, InterpreterRegs& regs)
// stack. The iterator object is second from the top.
MOZ_ASSERT(tn->stackDepth > 1);
Value* sp = regs.spForStackDepth(tn->stackDepth);
MOZ_ASSERT(sp[-1].isBoolean());
if (sp[-1].isFalse()) {
RootedValue doneValue(cx, sp[-1]);
bool done = ToBoolean(doneValue);
if (!done) {
RootedObject iterObject(cx, &sp[-2].toObject());
if (!IteratorCloseForException(cx, iterObject)) {
SettleOnTryNote(cx, tn, ei, regs);