From 049b75512350bd283e2325d09c83f655d713d8fa Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 24 Oct 2021 23:52:39 +0200 Subject: [PATCH] LibJS: Make bytecode interpreter leave unwind context immediately We were missing some "break" statements, causing us to actually finish executing everything within "try" blocks before actually jumping to the "catch" and/or "finally" blocks. --- Userland/Libraries/LibJS/Bytecode/Interpreter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index 49ef47c048..c562e9cc54 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -88,12 +88,15 @@ Value Interpreter::run(Executable const& executable, BasicBlock const* entry_poi accumulator() = vm().exception()->value(); vm().clear_exception(); will_jump = true; - } else if (unwind_context.finalizer) { + break; + } + if (unwind_context.finalizer) { block = unwind_context.finalizer; m_unwind_contexts.take_last(); will_jump = true; m_saved_exception = Handle::create(vm().exception()); vm().clear_exception(); + break; } } if (m_pending_jump.has_value()) {