2021-02-03 10:41:07 +01:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2021-2022, Andreas Kling <andreas@ladybird.org>
|
2023-03-29 23:46:18 +01:00
|
|
|
* Copyright (c) 2021-2023, Luke Wilde <lukew@serenityos.org>
|
2021-02-03 10:41:07 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-02-03 10:41:07 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibJS/Forward.h>
|
2022-02-06 03:32:26 +00:00
|
|
|
#include <LibJS/Runtime/JobCallback.h>
|
2021-09-19 22:10:49 +02:00
|
|
|
#include <LibJS/Runtime/VM.h>
|
2023-03-29 23:46:18 +01:00
|
|
|
#include <LibWeb/DOM/Element.h>
|
2022-07-11 16:37:51 +01:00
|
|
|
#include <LibWeb/DOM/MutationObserver.h>
|
2021-09-08 23:09:18 +02:00
|
|
|
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
2025-01-04 23:12:55 +13:00
|
|
|
#include <LibWeb/HTML/Scripting/Agent.h>
|
2021-02-03 10:41:07 +01:00
|
|
|
|
|
|
|
namespace Web::Bindings {
|
|
|
|
|
2022-02-06 03:32:26 +00:00
|
|
|
struct WebEngineCustomJobCallbackData final : public JS::JobCallback::CustomData {
|
2024-10-25 16:27:26 +13:00
|
|
|
WebEngineCustomJobCallbackData(JS::Realm& incumbent_realm, OwnPtr<JS::ExecutionContext> active_script_context)
|
|
|
|
: incumbent_realm(incumbent_realm)
|
2022-02-06 03:32:26 +00:00
|
|
|
, active_script_context(move(active_script_context))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-03-14 13:21:51 -06:00
|
|
|
virtual ~WebEngineCustomJobCallbackData() override = default;
|
2022-02-06 03:32:26 +00:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<JS::Realm> incumbent_realm;
|
2022-02-06 03:32:26 +00:00
|
|
|
OwnPtr<JS::ExecutionContext> active_script_context;
|
|
|
|
};
|
|
|
|
|
2022-10-24 19:39:35 +01:00
|
|
|
HTML::Script* active_script();
|
2023-03-17 10:56:59 -04:00
|
|
|
|
2025-04-24 15:22:25 +12:00
|
|
|
enum class AgentType : u8 {
|
|
|
|
SimilarOriginWindow,
|
|
|
|
DedicatedWorker,
|
|
|
|
SharedWorker,
|
|
|
|
ServiceWorker,
|
|
|
|
Worklet,
|
|
|
|
};
|
|
|
|
|
|
|
|
void initialize_main_thread_vm(AgentType);
|
2021-02-03 10:41:07 +01:00
|
|
|
JS::VM& main_thread_vm();
|
2023-03-17 10:56:59 -04:00
|
|
|
|
2023-02-25 10:44:51 -07:00
|
|
|
void queue_mutation_observer_microtask(DOM::Document const&);
|
2024-05-17 17:09:20 -07:00
|
|
|
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);
|
2024-11-15 04:01:23 +13:00
|
|
|
void invoke_custom_element_reactions(Vector<GC::Root<DOM::Element>>& element_queue);
|
2021-02-03 10:41:07 +01:00
|
|
|
|
|
|
|
}
|