mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
The microtask is conceptually global and fires pending observers at the agent level. As such, it doesn't make sense for it to be associated with any specific document.
45 lines
1.4 KiB
C++
45 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2021-2022, Andreas Kling <andreas@ladybird.org>
|
|
* Copyright (c) 2021-2023, Luke Wilde <lukew@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibJS/Forward.h>
|
|
#include <LibJS/Runtime/JobCallback.h>
|
|
#include <LibJS/Runtime/VM.h>
|
|
#include <LibWeb/Bindings/AgentType.h>
|
|
#include <LibWeb/DOM/Element.h>
|
|
#include <LibWeb/DOM/MutationObserver.h>
|
|
#include <LibWeb/Export.h>
|
|
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
|
#include <LibWeb/HTML/Scripting/Agent.h>
|
|
|
|
namespace Web::Bindings {
|
|
|
|
struct WebEngineCustomJobCallbackData final : public JS::JobCallback::CustomData {
|
|
WebEngineCustomJobCallbackData(JS::Realm& incumbent_realm, OwnPtr<JS::ExecutionContext> active_script_context)
|
|
: incumbent_realm(incumbent_realm)
|
|
, active_script_context(move(active_script_context))
|
|
{
|
|
}
|
|
|
|
virtual ~WebEngineCustomJobCallbackData() override = default;
|
|
|
|
GC::Ref<JS::Realm> incumbent_realm;
|
|
OwnPtr<JS::ExecutionContext> active_script_context;
|
|
};
|
|
|
|
HTML::Script* active_script();
|
|
|
|
WEB_API void initialize_main_thread_vm(AgentType);
|
|
WEB_API JS::VM& main_thread_vm();
|
|
|
|
void queue_mutation_observer_microtask();
|
|
WEB_API NonnullOwnPtr<JS::ExecutionContext> create_a_new_javascript_realm(JS::VM&, Function<JS::Object*(JS::Realm&)> create_global_object, Function<JS::Object*(JS::Realm&)> create_global_this_value);
|
|
WEB_API void invoke_custom_element_reactions(Vector<GC::Weak<DOM::Element>>& element_queue);
|
|
|
|
}
|