2020-04-01 18:53:28 +02:00
|
|
|
/*
|
2024-08-04 16:36:50 +02:00
|
|
|
* Copyright (c) 2020-2024, Andreas Kling <andreas@ladybird.org>
|
2023-01-18 17:41:12 +00:00
|
|
|
* Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
|
2020-04-01 18:53:28 +02:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-04-01 18:53:28 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Badge.h>
|
|
|
|
#include <AK/RefPtr.h>
|
2022-09-07 20:30:31 +02:00
|
|
|
#include <AK/TypeCasts.h>
|
2024-11-15 04:01:23 +13:00
|
|
|
#include <LibGC/Heap.h>
|
2024-03-18 16:22:27 +13:00
|
|
|
#include <LibURL/URL.h>
|
2022-09-24 15:39:23 -06:00
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2023-03-05 20:13:00 +00:00
|
|
|
#include <LibWeb/Bindings/WindowGlobalMixin.h>
|
2020-10-18 13:43:44 +02:00
|
|
|
#include <LibWeb/DOM/EventTarget.h>
|
2022-08-28 13:42:07 +02:00
|
|
|
#include <LibWeb/Forward.h>
|
2022-09-24 14:02:47 +01:00
|
|
|
#include <LibWeb/HTML/CrossOrigin/CrossOriginPropertyDescriptorMap.h>
|
2021-09-22 16:39:15 +02:00
|
|
|
#include <LibWeb/HTML/GlobalEventHandlers.h>
|
2023-02-28 00:23:53 +00:00
|
|
|
#include <LibWeb/HTML/MimeType.h>
|
2023-08-22 15:50:49 +02:00
|
|
|
#include <LibWeb/HTML/Navigable.h>
|
2023-02-28 00:23:53 +00:00
|
|
|
#include <LibWeb/HTML/Plugin.h>
|
2023-05-08 07:39:05 +02:00
|
|
|
#include <LibWeb/HTML/ScrollOptions.h>
|
2024-10-17 08:46:48 -04:00
|
|
|
#include <LibWeb/HTML/StructuredSerializeOptions.h>
|
2024-11-08 16:35:16 +13:00
|
|
|
#include <LibWeb/HTML/UniversalGlobalScope.h>
|
2022-06-27 19:48:54 +01:00
|
|
|
#include <LibWeb/HTML/WindowEventHandlers.h>
|
2023-03-06 11:08:15 +00:00
|
|
|
#include <LibWeb/HTML/WindowOrWorkerGlobalScope.h>
|
2023-03-06 23:38:44 +00:00
|
|
|
#include <LibWeb/RequestIdleCallback/IdleRequest.h>
|
2024-08-04 16:36:50 +02:00
|
|
|
#include <LibWeb/WebIDL/Types.h>
|
2020-04-01 18:53:28 +02:00
|
|
|
|
2022-03-07 23:08:26 +01:00
|
|
|
namespace Web::HTML {
|
2020-04-01 18:53:28 +02:00
|
|
|
|
2022-03-31 21:55:01 +02:00
|
|
|
class IdleCallback;
|
2021-09-13 02:03:06 +02:00
|
|
|
|
2023-03-06 20:53:49 +00:00
|
|
|
// https://w3c.github.io/csswg-drafts/cssom-view/#dictdef-scrolltooptions
|
|
|
|
struct ScrollToOptions : public ScrollOptions {
|
|
|
|
Optional<double> left;
|
|
|
|
Optional<double> top;
|
|
|
|
};
|
|
|
|
|
2023-11-06 20:22:56 +00:00
|
|
|
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#windowpostmessageoptions
|
|
|
|
struct WindowPostMessageOptions : public StructuredSerializeOptions {
|
|
|
|
String target_origin { "/"_string };
|
|
|
|
};
|
|
|
|
|
2024-12-03 20:31:14 +13:00
|
|
|
// https://html.spec.whatwg.org/multipage/webappapis.html#specifier-resolution-record
|
|
|
|
// A specifier resolution record is a struct. It has the following items:
|
|
|
|
struct SpecifierResolution {
|
|
|
|
// A serialized base URL
|
|
|
|
// A string-or-null that represents the base URL of the specifier, when one exists.
|
|
|
|
Optional<String> serialized_base_url;
|
|
|
|
|
|
|
|
// A specifier
|
|
|
|
// A string representing the specifier.
|
|
|
|
String specifier;
|
|
|
|
|
|
|
|
// A specifier as a URL
|
|
|
|
// A URL-or-null that represents the URL in case of a URL-like module specifier.
|
|
|
|
//
|
|
|
|
// Spec-Note: Implementations can replace specifier as a URL with a boolean that indicates
|
|
|
|
// that the specifier is either bare or URL-like that is special.
|
|
|
|
bool specifier_is_null_or_url_like_that_is_special { false };
|
|
|
|
};
|
|
|
|
|
2020-10-18 13:43:44 +02:00
|
|
|
class Window final
|
2022-08-28 13:42:07 +02:00
|
|
|
: public DOM::EventTarget
|
2023-03-11 18:11:20 +00:00
|
|
|
, public GlobalEventHandlers
|
|
|
|
, public WindowEventHandlers
|
2023-03-06 11:08:15 +00:00
|
|
|
, public WindowOrWorkerGlobalScopeMixin
|
2024-11-08 16:35:16 +13:00
|
|
|
, public UniversalGlobalScopeMixin
|
2023-03-05 15:52:34 +00:00
|
|
|
, public Bindings::WindowGlobalMixin {
|
2022-08-28 13:42:07 +02:00
|
|
|
WEB_PLATFORM_OBJECT(Window, DOM::EventTarget);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(Window);
|
2022-08-28 13:42:07 +02:00
|
|
|
|
2020-04-01 18:53:28 +02:00
|
|
|
public:
|
2024-11-15 04:01:23 +13:00
|
|
|
[[nodiscard]] static GC::Ref<Window> create(JS::Realm&);
|
2020-04-01 18:53:28 +02:00
|
|
|
|
2022-08-28 13:42:07 +02:00
|
|
|
~Window();
|
2020-10-18 13:43:44 +02:00
|
|
|
|
2024-11-08 16:35:16 +13:00
|
|
|
using UniversalGlobalScopeMixin::atob;
|
|
|
|
using UniversalGlobalScopeMixin::btoa;
|
|
|
|
using UniversalGlobalScopeMixin::queue_microtask;
|
|
|
|
using UniversalGlobalScopeMixin::structured_clone;
|
2023-03-14 07:28:08 -04:00
|
|
|
using WindowOrWorkerGlobalScopeMixin::clear_interval;
|
|
|
|
using WindowOrWorkerGlobalScopeMixin::clear_timeout;
|
2024-04-04 21:48:58 -04:00
|
|
|
using WindowOrWorkerGlobalScopeMixin::create_image_bitmap;
|
2023-03-07 18:15:52 +00:00
|
|
|
using WindowOrWorkerGlobalScopeMixin::fetch;
|
2024-07-04 00:28:49 +09:00
|
|
|
using WindowOrWorkerGlobalScopeMixin::report_error;
|
2023-03-14 07:28:08 -04:00
|
|
|
using WindowOrWorkerGlobalScopeMixin::set_interval;
|
|
|
|
using WindowOrWorkerGlobalScopeMixin::set_timeout;
|
2023-03-06 11:14:45 +00:00
|
|
|
|
2023-03-06 11:08:15 +00:00
|
|
|
// ^DOM::EventTarget
|
2022-08-08 22:29:40 +02:00
|
|
|
virtual bool dispatch_event(DOM::Event&) override;
|
2020-10-18 13:43:44 +02:00
|
|
|
|
2023-03-06 11:08:15 +00:00
|
|
|
// ^WindowOrWorkerGlobalScopeMixin
|
2024-12-03 02:37:33 +13:00
|
|
|
virtual DOM::EventTarget& this_impl() override { return *this; }
|
|
|
|
virtual DOM::EventTarget const& this_impl() const override { return *this; }
|
2023-03-06 11:08:15 +00:00
|
|
|
|
2023-03-11 16:44:15 +00:00
|
|
|
// ^JS::Object
|
|
|
|
virtual JS::ThrowCompletionOr<bool> internal_set_prototype_of(JS::Object* prototype) override;
|
|
|
|
|
2023-12-15 20:33:16 +01:00
|
|
|
Page& page();
|
|
|
|
Page const& page() const;
|
2021-09-09 13:45:03 +02:00
|
|
|
|
2022-03-05 00:13:13 +01:00
|
|
|
// https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window
|
2022-03-07 23:08:26 +01:00
|
|
|
DOM::Document const& associated_document() const { return *m_associated_document; }
|
|
|
|
DOM::Document& associated_document() { return *m_associated_document; }
|
2022-08-04 21:19:30 +02:00
|
|
|
void set_associated_document(DOM::Document&);
|
2020-04-01 18:53:28 +02:00
|
|
|
|
2022-03-05 00:13:13 +01:00
|
|
|
// https://html.spec.whatwg.org/multipage/window-object.html#window-bc
|
2023-03-11 18:11:20 +00:00
|
|
|
BrowsingContext const* browsing_context() const;
|
|
|
|
BrowsingContext* browsing_context();
|
2022-08-28 13:42:07 +02:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<Navigable> navigable() const;
|
2023-08-22 15:50:49 +02:00
|
|
|
|
2024-12-03 20:31:14 +13:00
|
|
|
ImportMap& import_map() { return m_import_map; }
|
2022-10-23 04:05:46 +02:00
|
|
|
ImportMap const& import_map() const { return m_import_map; }
|
2024-04-13 21:22:05 +01:00
|
|
|
void set_import_map(ImportMap const& import_map) { m_import_map = import_map; }
|
2022-10-23 04:05:46 +02:00
|
|
|
|
2024-12-03 20:31:14 +13:00
|
|
|
void append_resolved_module(SpecifierResolution resolution) { m_resolved_module_set.append(move(resolution)); }
|
|
|
|
Vector<SpecifierResolution> const& resolved_module_set() const { return m_resolved_module_set; }
|
2022-10-23 04:05:46 +02:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
WebIDL::ExceptionOr<GC::Ptr<WindowProxy>> window_open_steps(StringView url, StringView target, StringView features);
|
2024-10-20 08:48:52 -04:00
|
|
|
|
|
|
|
struct OpenedWindow {
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<Navigable> navigable;
|
2024-10-20 08:48:52 -04:00
|
|
|
TokenizedFeature::NoOpener no_opener { TokenizedFeature::NoOpener::No };
|
|
|
|
Navigable::WindowType window_type { Navigable::WindowType::ExistingOrNone };
|
|
|
|
};
|
|
|
|
WebIDL::ExceptionOr<OpenedWindow> window_open_steps_internal(StringView url, StringView target, StringView features);
|
|
|
|
|
2022-08-28 13:42:07 +02:00
|
|
|
DOM::Event* current_event() { return m_current_event.ptr(); }
|
|
|
|
DOM::Event const* current_event() const { return m_current_event.ptr(); }
|
2022-08-08 22:29:40 +02:00
|
|
|
void set_current_event(DOM::Event* event);
|
2020-11-21 18:32:39 +00:00
|
|
|
|
2022-03-08 16:51:33 +00:00
|
|
|
Optional<CSS::MediaFeatureValue> query_media_feature(CSS::MediaFeatureID) const;
|
2021-09-11 00:33:30 +02:00
|
|
|
|
2023-04-09 11:17:42 +02:00
|
|
|
void fire_a_page_transition_event(FlyString const& event_name, bool persisted);
|
2021-09-26 12:39:27 +02:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
WebIDL::ExceptionOr<GC::Ref<Storage>> local_storage();
|
|
|
|
WebIDL::ExceptionOr<GC::Ref<Storage>> session_storage();
|
2022-02-08 19:38:29 +01:00
|
|
|
|
2022-03-31 21:55:01 +02:00
|
|
|
void start_an_idle_period();
|
|
|
|
|
2024-05-25 12:34:17 +01:00
|
|
|
// https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation
|
|
|
|
bool has_sticky_activation() const;
|
|
|
|
|
2022-09-19 17:46:34 +02:00
|
|
|
// https://html.spec.whatwg.org/multipage/interaction.html#transient-activation
|
|
|
|
bool has_transient_activation() const;
|
|
|
|
|
2024-05-25 14:24:07 +01:00
|
|
|
// https://html.spec.whatwg.org/multipage/interaction.html#history-action-activation
|
|
|
|
bool has_history_action_activation() const;
|
|
|
|
|
2023-03-05 21:22:34 +00:00
|
|
|
WebIDL::ExceptionOr<void> initialize_web_interfaces(Badge<WindowEnvironmentSettingsObject>);
|
2022-09-24 15:39:23 -06:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
Vector<GC::Ref<Plugin>> pdf_viewer_plugin_objects();
|
|
|
|
Vector<GC::Ref<MimeType>> pdf_viewer_mime_type_objects();
|
2023-02-28 00:23:53 +00:00
|
|
|
|
2023-03-11 16:44:15 +00:00
|
|
|
CrossOriginPropertyDescriptorMap const& cross_origin_property_descriptor_map() const { return m_cross_origin_property_descriptor_map; }
|
|
|
|
CrossOriginPropertyDescriptorMap& cross_origin_property_descriptor_map() { return m_cross_origin_property_descriptor_map; }
|
|
|
|
|
2023-03-05 16:02:35 +00:00
|
|
|
// JS API functions
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<WindowProxy> window() const;
|
|
|
|
GC::Ref<WindowProxy> self() const;
|
|
|
|
GC::Ref<DOM::Document const> document() const;
|
2023-03-05 19:02:16 +00:00
|
|
|
String name() const;
|
|
|
|
void set_name(String const&);
|
2023-12-04 19:52:04 +01:00
|
|
|
String status() const;
|
2024-03-30 10:04:31 +00:00
|
|
|
void close();
|
|
|
|
bool closed() const;
|
2023-12-04 19:52:04 +01:00
|
|
|
void set_status(String const&);
|
2024-11-15 04:01:23 +13:00
|
|
|
[[nodiscard]] GC::Ref<Location> location();
|
|
|
|
GC::Ref<History> history() const;
|
|
|
|
GC::Ref<Navigation> navigation();
|
2024-12-05 10:56:47 +01:00
|
|
|
void stop();
|
2023-03-06 22:25:04 +00:00
|
|
|
void focus();
|
2024-03-30 10:04:31 +00:00
|
|
|
void blur();
|
2023-03-05 18:36:43 +00:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<WindowProxy> frames() const;
|
2023-09-03 22:50:40 +02:00
|
|
|
u32 length();
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<WindowProxy const> top() const;
|
|
|
|
GC::Ptr<WindowProxy const> opener() const;
|
2024-03-12 23:39:59 +00:00
|
|
|
WebIDL::ExceptionOr<void> set_opener(JS::Value);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<WindowProxy const> parent() const;
|
|
|
|
GC::Ptr<DOM::Element const> frame_element() const;
|
|
|
|
WebIDL::ExceptionOr<GC::Ptr<WindowProxy>> open(Optional<String> const& url, Optional<String> const& target, Optional<String> const& features);
|
2023-03-05 18:48:45 +00:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
[[nodiscard]] GC::Ref<Navigator> navigator();
|
|
|
|
[[nodiscard]] GC::Ref<CloseWatcherManager> close_watcher_manager();
|
2023-03-05 17:55:03 +00:00
|
|
|
|
2023-03-05 16:02:35 +00:00
|
|
|
void alert(String const& message = {});
|
2023-03-05 17:21:24 +00:00
|
|
|
bool confirm(Optional<String> const& message);
|
2023-03-05 17:28:17 +00:00
|
|
|
Optional<String> prompt(Optional<String> const& message, Optional<String> const& default_);
|
2023-03-05 16:02:35 +00:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
WebIDL::ExceptionOr<void> post_message(JS::Value message, String const&, Vector<GC::Root<JS::Object>> const&);
|
2023-11-06 20:22:56 +00:00
|
|
|
WebIDL::ExceptionOr<void> post_message(JS::Value message, WindowPostMessageOptions const&);
|
2023-03-05 17:36:59 +00:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
Variant<GC::Root<DOM::Event>, JS::Value> event() const;
|
2023-03-06 19:50:29 +00:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
[[nodiscard]] GC::Ref<CSS::CSSStyleDeclaration> get_computed_style(DOM::Element&, Optional<String> const& pseudo_element) const;
|
2023-03-06 22:18:29 +00:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
WebIDL::ExceptionOr<GC::Ref<CSS::MediaQueryList>> match_media(String const& query);
|
|
|
|
[[nodiscard]] GC::Ref<CSS::Screen> screen();
|
|
|
|
[[nodiscard]] GC::Ptr<CSS::VisualViewport> visual_viewport();
|
2023-03-06 19:51:05 +00:00
|
|
|
|
2023-03-06 19:51:33 +00:00
|
|
|
i32 inner_width() const;
|
|
|
|
i32 inner_height() const;
|
|
|
|
|
2024-02-21 04:17:27 -05:00
|
|
|
void move_to(long, long) const;
|
|
|
|
void move_by(long, long) const;
|
|
|
|
void resize_to(long, long) const;
|
|
|
|
void resize_by(long, long) const;
|
|
|
|
|
2023-03-06 19:51:44 +00:00
|
|
|
double scroll_x() const;
|
|
|
|
double scroll_y() const;
|
2023-03-06 20:53:49 +00:00
|
|
|
void scroll(ScrollToOptions const&);
|
|
|
|
void scroll(double x, double y);
|
2023-03-06 21:17:19 +00:00
|
|
|
void scroll_by(ScrollToOptions);
|
|
|
|
void scroll_by(double x, double y);
|
2023-03-06 19:51:44 +00:00
|
|
|
|
2023-03-06 21:38:09 +00:00
|
|
|
i32 screen_x() const;
|
|
|
|
i32 screen_y() const;
|
2023-03-06 22:02:09 +00:00
|
|
|
i32 outer_width() const;
|
|
|
|
i32 outer_height() const;
|
2023-03-06 22:10:10 +00:00
|
|
|
double device_pixel_ratio() const;
|
2023-03-06 21:38:09 +00:00
|
|
|
|
2024-10-30 20:13:31 -04:00
|
|
|
AnimationFrameCallbackDriver& animation_frame_callback_driver();
|
|
|
|
bool has_animation_frame_callbacks();
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
WebIDL::UnsignedLong request_animation_frame(GC::Ref<WebIDL::CallbackType>);
|
2024-08-04 16:36:50 +02:00
|
|
|
void cancel_animation_frame(WebIDL::UnsignedLong handle);
|
2023-03-07 18:12:58 +00:00
|
|
|
|
2023-03-06 23:38:44 +00:00
|
|
|
u32 request_idle_callback(WebIDL::CallbackType&, RequestIdleCallback::IdleRequestOptions const&);
|
2023-03-06 23:43:25 +00:00
|
|
|
void cancel_idle_callback(u32 handle);
|
2023-03-06 23:38:44 +00:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<Selection::Selection> get_selection() const;
|
2023-03-06 22:34:48 +00:00
|
|
|
|
2024-04-14 07:38:10 +01:00
|
|
|
void capture_events();
|
|
|
|
void release_events();
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
[[nodiscard]] GC::Ref<CustomElementRegistry> custom_elements();
|
2023-03-29 23:46:18 +01:00
|
|
|
|
2024-05-29 10:07:37 -06:00
|
|
|
HighResolutionTime::DOMHighResTimeStamp last_activation_timestamp() const { return m_last_activation_timestamp; }
|
2023-05-31 00:13:56 +02:00
|
|
|
void set_last_activation_timestamp(HighResolutionTime::DOMHighResTimeStamp timestamp) { m_last_activation_timestamp = timestamp; }
|
|
|
|
|
2024-05-29 10:53:55 -06:00
|
|
|
void consume_user_activation();
|
|
|
|
|
2024-05-29 10:07:37 -06:00
|
|
|
HighResolutionTime::DOMHighResTimeStamp last_history_action_activation_timestamp() const { return m_last_history_action_activation_timestamp; }
|
2024-05-25 14:21:02 +01:00
|
|
|
void set_last_history_action_activation_timestamp(HighResolutionTime::DOMHighResTimeStamp timestamp) { m_last_history_action_activation_timestamp = timestamp; }
|
|
|
|
|
2024-05-29 10:14:40 -06:00
|
|
|
void consume_history_action_user_activation();
|
|
|
|
|
2023-11-23 12:22:23 -05:00
|
|
|
static void set_inspector_object_exposed(bool);
|
2023-07-21 11:59:49 +02:00
|
|
|
static void set_internals_object_exposed(bool);
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
[[nodiscard]] OrderedHashMap<FlyString, GC::Ref<Navigable>> document_tree_child_navigable_target_name_property_set();
|
2023-09-18 21:56:11 -06:00
|
|
|
|
2024-01-09 16:05:03 -07:00
|
|
|
[[nodiscard]] Vector<FlyString> supported_property_names() const override;
|
2024-07-25 17:36:10 +12:00
|
|
|
[[nodiscard]] JS::Value named_item_value(FlyString const&) const override;
|
2023-09-19 13:32:13 -06:00
|
|
|
|
2024-06-25 22:52:01 +01:00
|
|
|
bool find(String const& string);
|
|
|
|
|
2020-04-01 18:53:28 +02:00
|
|
|
private:
|
2022-08-28 13:42:07 +02:00
|
|
|
explicit Window(JS::Realm&);
|
|
|
|
|
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
2024-01-03 10:10:47 +01:00
|
|
|
virtual void finalize() override;
|
2020-04-01 18:53:28 +02:00
|
|
|
|
2021-09-22 16:39:15 +02:00
|
|
|
// ^HTML::GlobalEventHandlers
|
2024-11-15 04:01:23 +13:00
|
|
|
virtual GC::Ptr<DOM::EventTarget> global_event_handlers_to_event_target(FlyString const&) override { return *this; }
|
2021-09-22 16:39:15 +02:00
|
|
|
|
2022-06-27 19:48:54 +01:00
|
|
|
// ^HTML::WindowEventHandlers
|
2024-11-15 04:01:23 +13:00
|
|
|
virtual GC::Ptr<DOM::EventTarget> window_event_handlers_to_event_target() override { return *this; }
|
2022-06-27 19:48:54 +01:00
|
|
|
|
2022-03-31 21:55:01 +02:00
|
|
|
void invoke_idle_callbacks();
|
|
|
|
|
2023-09-19 16:40:42 -06:00
|
|
|
struct [[nodiscard]] NamedObjects {
|
2024-11-15 04:01:23 +13:00
|
|
|
Vector<GC::Ref<Navigable>> navigables;
|
|
|
|
Vector<GC::Ref<DOM::Element>> elements;
|
2023-09-19 16:40:42 -06:00
|
|
|
};
|
|
|
|
NamedObjects named_objects(StringView name);
|
|
|
|
|
2023-11-06 20:22:56 +00:00
|
|
|
WebIDL::ExceptionOr<void> window_post_message_steps(JS::Value, WindowPostMessageOptions const&);
|
|
|
|
|
2021-09-09 13:55:31 +02:00
|
|
|
// https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<DOM::Document> m_associated_document;
|
2021-09-09 13:55:31 +02:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<DOM::Event> m_current_event;
|
2020-06-27 18:30:29 +02:00
|
|
|
|
2024-12-03 20:31:14 +13:00
|
|
|
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-global-import-map
|
|
|
|
// A global object has an import map, initially an empty import map.
|
2022-10-23 04:05:46 +02:00
|
|
|
ImportMap m_import_map;
|
|
|
|
|
2024-12-03 20:31:14 +13:00
|
|
|
// https://html.spec.whatwg.org/multipage/webappapis.html#resolved-module-set
|
|
|
|
// A global object has a resolved module set, a set of specifier resolution records, initially empty.
|
|
|
|
//
|
|
|
|
// Spec-Note: The resolved module set ensures that module specifier resolution returns the same result when called
|
|
|
|
// multiple times with the same (referrer, specifier) pair. It does that by ensuring that import map rules
|
|
|
|
// that impact the specifier in its referrer's scope cannot be defined after its initial resolution. For
|
|
|
|
// now, only Window global objects have their module set data structures modified from the initial empty one.
|
|
|
|
Vector<SpecifierResolution> m_resolved_module_set;
|
2022-10-23 04:05:46 +02:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<CSS::Screen> m_screen;
|
|
|
|
GC::Ptr<Navigator> m_navigator;
|
|
|
|
GC::Ptr<Location> m_location;
|
|
|
|
GC::Ptr<CloseWatcherManager> m_close_watcher_manager;
|
2021-09-13 02:03:06 +02:00
|
|
|
|
2023-08-23 10:58:09 -06:00
|
|
|
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#window-navigation-api
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<Navigation> m_navigation;
|
2023-08-23 10:58:09 -06:00
|
|
|
|
2023-03-29 23:46:18 +01:00
|
|
|
// https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-api
|
2024-12-18 15:58:36 +00:00
|
|
|
// Each Window object has an associated custom element registry (a CustomElementRegistry object).
|
|
|
|
// It is set to a new CustomElementRegistry object when the Window object is created.
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<CustomElementRegistry> m_custom_element_registry;
|
2023-03-29 23:46:18 +01:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<AnimationFrameCallbackDriver> m_animation_frame_callback_driver;
|
2022-03-31 21:55:01 +02:00
|
|
|
|
|
|
|
// https://w3c.github.io/requestidlecallback/#dfn-list-of-idle-request-callbacks
|
2023-03-06 14:17:01 +01:00
|
|
|
Vector<NonnullRefPtr<IdleCallback>> m_idle_request_callbacks;
|
2022-03-31 21:55:01 +02:00
|
|
|
// https://w3c.github.io/requestidlecallback/#dfn-list-of-runnable-idle-callbacks
|
2023-03-06 14:17:01 +01:00
|
|
|
Vector<NonnullRefPtr<IdleCallback>> m_runnable_idle_callbacks;
|
2022-03-31 21:55:01 +02:00
|
|
|
// https://w3c.github.io/requestidlecallback/#dfn-idle-callback-identifier
|
|
|
|
u32 m_idle_callback_identifier = 0;
|
2022-08-28 13:42:07 +02:00
|
|
|
|
2023-02-28 00:23:53 +00:00
|
|
|
// https://html.spec.whatwg.org/multipage/system-state.html#pdf-viewer-plugin-objects
|
2024-11-15 04:01:23 +13:00
|
|
|
Vector<GC::Ref<Plugin>> m_pdf_viewer_plugin_objects;
|
2023-02-28 00:23:53 +00:00
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/system-state.html#pdf-viewer-mime-type-objects
|
2024-11-15 04:01:23 +13:00
|
|
|
Vector<GC::Ref<MimeType>> m_pdf_viewer_mime_type_objects;
|
2023-02-28 00:23:53 +00:00
|
|
|
|
2023-03-11 16:44:15 +00:00
|
|
|
// [[CrossOriginPropertyDescriptorMap]], https://html.spec.whatwg.org/multipage/browsers.html#crossoriginpropertydescriptormap
|
|
|
|
CrossOriginPropertyDescriptorMap m_cross_origin_property_descriptor_map;
|
2023-05-31 00:13:56 +02:00
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/interaction.html#user-activation-data-model
|
2024-05-25 16:39:18 +01:00
|
|
|
HighResolutionTime::DOMHighResTimeStamp m_last_activation_timestamp { AK::Infinity<double> };
|
2023-06-23 08:46:46 +12:00
|
|
|
|
2024-05-25 14:21:02 +01:00
|
|
|
// https://html.spec.whatwg.org/multipage/interaction.html#last-history-action-activation-timestamp
|
|
|
|
HighResolutionTime::DOMHighResTimeStamp m_last_history_action_activation_timestamp { AK::Infinity<double> };
|
|
|
|
|
2023-12-04 19:52:04 +01:00
|
|
|
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-window-status
|
|
|
|
// When the Window object is created, the attribute must be set to the empty string. It does not do anything else.
|
|
|
|
String m_status;
|
2020-04-01 18:53:28 +02:00
|
|
|
};
|
|
|
|
|
2021-10-03 16:28:14 +02:00
|
|
|
void run_animation_frame_callbacks(DOM::Document&, double now);
|
|
|
|
|
2020-04-01 18:53:28 +02:00
|
|
|
}
|