/* * Copyright (c) 2021-2022, Andreas Kling * Copyright (c) 2021, Luke Wilde * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace Web::Bindings { struct WebEngineCustomData final : public JS::VM::CustomData { virtual ~WebEngineCustomData() override = default; virtual void spin_event_loop_until(Function goal_condition) override; HTML::EventLoop event_loop; // FIXME: These should only be on similar-origin window agents, but we don't currently differentiate agent types. // https://dom.spec.whatwg.org/#mutation-observer-compound-microtask-queued-flag bool mutation_observer_microtask_queued { false }; // https://dom.spec.whatwg.org/#mutation-observer-list // FIXME: This should be a set. Vector> mutation_observers; OwnPtr root_execution_context; }; struct WebEngineCustomJobCallbackData final : public JS::JobCallback::CustomData { WebEngineCustomJobCallbackData(HTML::EnvironmentSettingsObject& incumbent_settings, OwnPtr active_script_context) : incumbent_settings(incumbent_settings) , active_script_context(move(active_script_context)) { } virtual ~WebEngineCustomJobCallbackData() override = default; HTML::EnvironmentSettingsObject& incumbent_settings; OwnPtr active_script_context; }; HTML::ClassicScript* active_script(); JS::VM& main_thread_vm(); void queue_mutation_observer_microtask(DOM::Document&); NonnullOwnPtr create_a_new_javascript_realm(JS::VM&, Function create_global_object, Function create_global_this_value); }