mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 23:38:38 +09:00
parent
aa954171ae
commit
d36d40760a
7 changed files with 322 additions and 135 deletions
|
|
@ -1171,19 +1171,13 @@ ProcessTryNotes(JSContext* cx, EnvironmentIter& ei, InterpreterRegs& regs)
|
|||
SettleOnTryNote(cx, tn, ei, regs);
|
||||
return FinallyContinuation;
|
||||
|
||||
case JSTRY_FOR_IN:
|
||||
case JSTRY_ITERCLOSE: {
|
||||
case JSTRY_FOR_IN: {
|
||||
/* This is similar to JSOP_ENDITER in the interpreter loop. */
|
||||
DebugOnly<jsbytecode*> pc = regs.fp()->script()->main() + tn->start + tn->length;
|
||||
MOZ_ASSERT_IF(tn->kind == JSTRY_FOR_IN, JSOp(*pc) == JSOP_ENDITER);
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_ENDITER);
|
||||
Value* sp = regs.spForStackDepth(tn->stackDepth);
|
||||
RootedObject obj(cx, &sp[-1].toObject());
|
||||
bool ok;
|
||||
if (tn->kind == JSTRY_FOR_IN)
|
||||
ok = UnwindIteratorForException(cx, obj);
|
||||
else
|
||||
ok = IteratorCloseForException(cx, obj);
|
||||
if (!ok) {
|
||||
if (!UnwindIteratorForException(cx, obj)) {
|
||||
// We should only settle on the note only if
|
||||
// UnwindIteratorForException itself threw, as
|
||||
// onExceptionUnwind should be called anew with the new
|
||||
|
|
@ -1195,6 +1189,33 @@ ProcessTryNotes(JSContext* cx, EnvironmentIter& ei, InterpreterRegs& regs)
|
|||
break;
|
||||
}
|
||||
|
||||
case JSTRY_ITERCLOSE: {
|
||||
// The iterator object is at the top of the stack.
|
||||
Value* sp = regs.spForStackDepth(tn->stackDepth);
|
||||
RootedObject iterObject(cx, &sp[-1].toObject());
|
||||
if (!IteratorCloseForException(cx, iterObject)) {
|
||||
SettleOnTryNote(cx, tn, ei, regs);
|
||||
return ErrorReturnContinuation;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case JSTRY_DESTRUCTURING_ITERCLOSE: {
|
||||
// Whether the destructuring iterator is done is at the top of the
|
||||
// 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()) {
|
||||
RootedObject iterObject(cx, &sp[-2].toObject());
|
||||
if (!IteratorCloseForException(cx, iterObject)) {
|
||||
SettleOnTryNote(cx, tn, ei, regs);
|
||||
return ErrorReturnContinuation;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case JSTRY_FOR_OF:
|
||||
case JSTRY_LOOP:
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue