From ac808a261f593566f88c7b17de96a5215bb86773 Mon Sep 17 00:00:00 2001 From: davidot Date: Sun, 3 Oct 2021 13:27:26 +0200 Subject: [PATCH] LibJS: Fix that the interpreter did not clear the unwind status This meant that if some program threw an uncaught exception VM still had unwind_until set. This caused any further programs to not execute correctly. This will be fixed more thoroughly once we use Completions in the AST. Fixes #10323 --- Userland/Libraries/LibJS/Interpreter.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibJS/Interpreter.cpp b/Userland/Libraries/LibJS/Interpreter.cpp index e3864cbc97..dc7a20a0a3 100644 --- a/Userland/Libraries/LibJS/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Interpreter.cpp @@ -63,6 +63,10 @@ void Interpreter::run(GlobalObject& global_object, const Program& program) auto value = program.execute(*this, global_object); vm.set_last_value(Badge {}, value.value_or(js_undefined())); + // FIXME: We unconditionally stop the unwind here this should be done using completions leaving + // the VM in a cleaner state after executing. For example it does still store the exception. + vm.stop_unwind(); + vm.pop_execution_context(); // At this point we may have already run any queued promise jobs via on_call_stack_emptied,