summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-10-08 23:22:50 +0100
committerLinus Groh <mail@linusgroh.de>2021-10-09 14:29:20 +0100
commit58c34012dd5fd48e2e3800d6f374ecc82e91da1e (patch)
tree4862451b0049821d104b2fb91f3878ad2776db17
parent72f5252826c83f38520fff8899b6f1b4cb0c6fe5 (diff)
downloadserenity-58c34012dd5fd48e2e3800d6f374ecc82e91da1e.zip
LibJS: Pop execution context after running queued jobs in run()
These would crash starting with the next commit otherwise, calling a function always requires the running execution context to exist.
-rw-r--r--Userland/Libraries/LibJS/Interpreter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Interpreter.cpp b/Userland/Libraries/LibJS/Interpreter.cpp
index dc7a20a0a3..27220abdda 100644
--- a/Userland/Libraries/LibJS/Interpreter.cpp
+++ b/Userland/Libraries/LibJS/Interpreter.cpp
@@ -67,14 +67,14 @@ void Interpreter::run(GlobalObject& global_object, const Program& program)
// 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,
// in which case this is a no-op.
vm.run_queued_promise_jobs();
vm.run_queued_finalization_registry_cleanup_jobs();
+ vm.pop_execution_context();
+
vm.finish_execution_generation();
}