mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
LibJS: Add VM::on_call_stack_emptied callback
Instead of having to run queued promise jobs in LibWeb in various places, this allows us to consolidate that into one function - this is very close to how the spec describes it as well ("at some future point in time, when there is no running execution context and the execution context stack is empty, the implementation must [...]"). Eventually this will also be used to log unhandled exceptions, and possibly other actions that require JS execution to have ended.
This commit is contained in:
parent
97d49cb92b
commit
08373090ae
5 changed files with 19 additions and 9 deletions
|
@ -90,8 +90,6 @@ void Window::timer_did_fire(Badge<Timer>, Timer& timer)
|
|||
[[maybe_unused]] auto rc = vm.call(timer.callback(), wrapper());
|
||||
if (vm.exception())
|
||||
vm.clear_exception();
|
||||
vm.run_queued_promise_jobs();
|
||||
VERIFY(!vm.exception());
|
||||
}
|
||||
|
||||
i32 Window::allocate_timer_id(Badge<Timer>)
|
||||
|
@ -126,8 +124,6 @@ i32 Window::request_animation_frame(JS::Function& callback)
|
|||
[[maybe_unused]] auto rc = vm.call(function, JS::js_undefined(), JS::Value(fake_timestamp));
|
||||
if (vm.exception())
|
||||
vm.clear_exception();
|
||||
vm.run_queued_promise_jobs();
|
||||
VERIFY(!vm.exception());
|
||||
GUI::DisplayLink::unregister_callback(link_id);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue