diff options
author | davidot <davidot@serenityos.org> | 2021-10-03 13:27:26 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-03 17:42:05 +0200 |
commit | ac808a261f593566f88c7b17de96a5215bb86773 (patch) | |
tree | c8fe12a7af33a72dd381dc63311ff2abea22c98c /Userland | |
parent | f4f139773557d6254966617c45c5c34291d3aed9 (diff) | |
download | serenity-ac808a261f593566f88c7b17de96a5215bb86773.zip |
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
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibJS/Interpreter.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
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<Interpreter> {}, 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, |