mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-31 19:47:32 +09:00
Bug 1346862 - Fix IteratorClose due to non-local jumps being catchable by try statements inside for-of
Issue #74
This commit is contained in:
parent
5bf58e6044
commit
8af5664922
7 changed files with 113 additions and 18 deletions
|
|
@ -2065,7 +2065,11 @@ class ForOfLoopControl : public LoopControl
|
|||
|
||||
bool emitIteratorClose(BytecodeEmitter* bce,
|
||||
CompletionKind completionKind = CompletionKind::Normal) {
|
||||
return bce->emitIteratorClose(completionKind, allowSelfHosted_);
|
||||
ptrdiff_t start = bce->offset();
|
||||
if (!bce->emitIteratorClose(completionKind, allowSelfHosted_))
|
||||
return false;
|
||||
ptrdiff_t end = bce->offset();
|
||||
return bce->tryNoteList.append(JSTRY_FOR_OF_ITERCLOSE, 0, start, end);
|
||||
}
|
||||
|
||||
bool emitPrepareForNonLocalJump(BytecodeEmitter* bce, bool isTarget) {
|
||||
|
|
@ -2614,17 +2618,6 @@ BytecodeEmitter::emitUint32Operand(JSOp op, uint32_t operand)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BytecodeEmitter::flushPops(int* npops)
|
||||
{
|
||||
MOZ_ASSERT(*npops != 0);
|
||||
if (!emitUint16Operand(JSOP_POPN, *npops))
|
||||
return false;
|
||||
|
||||
*npops = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class NonLocalExitControl
|
||||
|
|
@ -2718,8 +2711,9 @@ NonLocalExitControl::prepareForNonLocalJump(BytecodeEmitter::NestableControl* ta
|
|||
bool emitIteratorCloseAtTarget = emitIteratorClose && kind_ != Continue;
|
||||
|
||||
auto flushPops = [&npops](BytecodeEmitter* bce) {
|
||||
if (npops && !bce->flushPops(&npops))
|
||||
if (npops && !bce->emitUint16Operand(JSOP_POPN, npops))
|
||||
return false;
|
||||
npops = 0;
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue