diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 322e9daf3b7..e1489554d19 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -4956,6 +4956,9 @@ BytecodeEmitter::emitForOf(StmtType type, ParseNode *pn, ptrdiff_t top) // For STMT_SPREAD, just pop pc->topStmt. popStatement(); + if (!tryNoteList.append(JSTRY_FOR_OF, stackDepth, top, offset())) + return false; + if (letDecl) { if (!LeaveNestedScope(cx, this, &letStmt)) return false; diff --git a/js/src/jsscript.h b/js/src/jsscript.h index dd08f7adc84..86b14a05dbf 100644 --- a/js/src/jsscript.h +++ b/js/src/jsscript.h @@ -67,6 +67,7 @@ enum JSTryNoteKind { JSTRY_CATCH, JSTRY_FINALLY, JSTRY_ITER, + JSTRY_FOR_OF, JSTRY_LOOP }; diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 96b684c2271..e72051cbb16 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -2184,7 +2184,7 @@ JS_STATIC_ASSERT(JSTRY_CATCH == 0); JS_STATIC_ASSERT(JSTRY_FINALLY == 1); JS_STATIC_ASSERT(JSTRY_ITER == 2); -static const char* const TryNoteNames[] = { "catch", "finally", "iter", "loop" }; +static const char* const TryNoteNames[] = { "catch", "finally", "iter", "for-of", "loop" }; static bool TryNotes(JSContext *cx, HandleScript script, Sprinter *sp)