mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 01:32:14 -05:00
64eeda6450
This makes it more convenient to use the 'relvant agent' concept, instead of the awkward dynamic casts we needed to do for every call site. mutation_observers is also changed to hold a GC::Root instead of raw GC::Ptr. Somehow this was not causing problems before, but trips up CI after these changes.
50 lines
1.6 KiB
C++
50 lines
1.6 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/DOM/Element.h>
|
|
#include <LibWeb/DOM/MutationObserver.h>
|
|
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
|
#include <LibWeb/HTML/Scripting/Agent.h>
|
|
|
|
namespace Web::Bindings {
|
|
|
|
struct WebEngineCustomData final : public JS::VM::CustomData {
|
|
virtual ~WebEngineCustomData() override = default;
|
|
|
|
virtual void spin_event_loop_until(GC::Root<GC::Function<bool()>> goal_condition) override;
|
|
|
|
HTML::Agent agent;
|
|
};
|
|
|
|
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();
|
|
|
|
ErrorOr<void> initialize_main_thread_vm(HTML::EventLoop::Type);
|
|
JS::VM& main_thread_vm();
|
|
|
|
void queue_mutation_observer_microtask(DOM::Document const&);
|
|
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);
|
|
void invoke_custom_element_reactions(Vector<GC::Root<DOM::Element>>& element_queue);
|
|
|
|
}
|