浏览代码

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.
Linus Groh 3 年之前
父节点
当前提交
58c34012dd
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Userland/Libraries/LibJS/Interpreter.cpp

+ 2 - 2
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.
     //        the VM in a cleaner state after executing. For example it does still store the exception.
     vm.stop_unwind();
     vm.stop_unwind();
 
 
-    vm.pop_execution_context();
-
     // At this point we may have already run any queued promise jobs via on_call_stack_emptied,
     // 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.
     // in which case this is a no-op.
     vm.run_queued_promise_jobs();
     vm.run_queued_promise_jobs();
 
 
     vm.run_queued_finalization_registry_cleanup_jobs();
     vm.run_queued_finalization_registry_cleanup_jobs();
 
 
+    vm.pop_execution_context();
+
     vm.finish_execution_generation();
     vm.finish_execution_generation();
 }
 }