mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 12:18:25 +00:00
LibWeb: Run queued promise jobs after callbacks
We now run queued promise jobs after calling event handler, timer, and requestAnimationFrame() callbacks - this is a bit ad-hoc, but I don't want to switch LibWeb to use an event loop right now - this works just fine, too. We might want to revisit this at a later point and do tasks and microtasks properly.
This commit is contained in:
committed by
Andreas Kling
parent
f418115f1b
commit
ade3adcc7a
@@ -109,6 +109,8 @@ 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>)
|
||||
@@ -143,6 +145,8 @@ 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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user