1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:28:11 +00:00

LibWeb+Browser+Ladybird: Use JS::SafeFunction for EventLoop callbacks

This automatically protects captured objects from being GC'd before the
callback runs.
This commit is contained in:
Sam Atkins 2023-04-21 12:13:04 +01:00 committed by Linus Groh
parent 892470a912
commit 6d93e03211
11 changed files with 19 additions and 19 deletions

View file

@ -51,7 +51,7 @@ EventLoop& main_thread_event_loop()
}
// https://html.spec.whatwg.org/multipage/webappapis.html#spin-the-event-loop
void EventLoop::spin_until(Function<bool()> goal_condition)
void EventLoop::spin_until(JS::SafeFunction<bool()> goal_condition)
{
// FIXME: 1. Let task be the event loop's currently running task.

View file

@ -37,7 +37,7 @@ public:
TaskQueue& microtask_queue() { return m_microtask_queue; }
TaskQueue const& microtask_queue() const { return m_microtask_queue; }
void spin_until(Function<bool()> goal_condition);
void spin_until(JS::SafeFunction<bool()> goal_condition);
void process();
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#termination-nesting-level