mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-18 16:57:29 +03:00
LibWeb: Return the ID of queued global events
This will allow callers to track the event.
This commit is contained in:
parent
3a50cadddf
commit
4806cf9527
Notes:
sideshowbarker
2024-07-17 05:18:58 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/4806cf9527 Pull-request: https://github.com/SerenityOS/serenity/pull/23681
@ -339,7 +339,7 @@ void EventLoop::process()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task
|
||||
void queue_global_task(HTML::Task::Source source, JS::Object& global_object, JS::SafeFunction<void()> steps)
|
||||
int queue_global_task(HTML::Task::Source source, JS::Object& global_object, JS::SafeFunction<void()> steps)
|
||||
{
|
||||
// 1. Let event loop be global's relevant agent's event loop.
|
||||
auto& global_custom_data = verify_cast<Bindings::WebEngineCustomData>(*global_object.vm().custom_data());
|
||||
@ -354,6 +354,8 @@ void queue_global_task(HTML::Task::Source source, JS::Object& global_object, JS:
|
||||
|
||||
// 3. Queue a task given source, event loop, document, and steps.
|
||||
event_loop.task_queue().add(HTML::Task::create(source, document, move(steps)));
|
||||
|
||||
return event_loop.task_queue().last_added_task()->id();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/#queue-a-microtask
|
||||
|
@ -116,7 +116,7 @@ private:
|
||||
};
|
||||
|
||||
EventLoop& main_thread_event_loop();
|
||||
void queue_global_task(HTML::Task::Source, JS::Object&, JS::SafeFunction<void()> steps);
|
||||
int queue_global_task(HTML::Task::Source, JS::Object&, JS::SafeFunction<void()> steps);
|
||||
void queue_a_microtask(DOM::Document const*, JS::SafeFunction<void()> steps);
|
||||
void perform_a_microtask_checkpoint();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user