diff --git a/Userland/Libraries/LibWeb/Bindings/HostDefined.h b/Userland/Libraries/LibWeb/Bindings/HostDefined.h deleted file mode 100644 index 911df1b09c4..00000000000 --- a/Userland/Libraries/LibWeb/Bindings/HostDefined.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2022, Andrew Kaster - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include -#include -#include -#include - -namespace Web::Bindings { - -struct HostDefined : public JS::Realm::HostDefined { - HostDefined(JS::NonnullGCPtr eso, JS::NonnullGCPtr intrinsics, JS::NonnullGCPtr page) - : environment_settings_object(eso) - , intrinsics(intrinsics) - , page(page) - { - } - virtual ~HostDefined() override = default; - virtual void visit_edges(JS::Cell::Visitor& visitor) override; - - JS::NonnullGCPtr environment_settings_object; - JS::NonnullGCPtr intrinsics; - JS::NonnullGCPtr page; -}; - -[[nodiscard]] inline HTML::EnvironmentSettingsObject& host_defined_environment_settings_object(JS::Realm& realm) -{ - return *verify_cast(realm.host_defined())->environment_settings_object; -} - -[[nodiscard]] inline HTML::EnvironmentSettingsObject const& host_defined_environment_settings_object(JS::Realm const& realm) -{ - return *verify_cast(realm.host_defined())->environment_settings_object; -} - -[[nodiscard]] inline Page& host_defined_page(JS::Realm& realm) -{ - return *verify_cast(realm.host_defined())->page; -} - -} diff --git a/Userland/Libraries/LibWeb/Bindings/Intrinsics.h b/Userland/Libraries/LibWeb/Bindings/Intrinsics.h index 8dfd13bd786..23ecb5b505e 100644 --- a/Userland/Libraries/LibWeb/Bindings/Intrinsics.h +++ b/Userland/Libraries/LibWeb/Bindings/Intrinsics.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #define WEB_SET_PROTOTYPE_FOR_INTERFACE_WITH_CUSTOM_NAME(interface_class, interface_name) \ do { \ @@ -84,7 +84,7 @@ private: [[nodiscard]] inline Intrinsics& host_defined_intrinsics(JS::Realm& realm) { - return *verify_cast(realm.host_defined())->intrinsics; + return *verify_cast(realm.host_defined())->intrinsics; } template diff --git a/Userland/Libraries/LibWeb/Bindings/HostDefined.cpp b/Userland/Libraries/LibWeb/Bindings/PrincipalHostDefined.cpp similarity index 80% rename from Userland/Libraries/LibWeb/Bindings/HostDefined.cpp rename to Userland/Libraries/LibWeb/Bindings/PrincipalHostDefined.cpp index 4dd279eecf7..a5c2c60a51d 100644 --- a/Userland/Libraries/LibWeb/Bindings/HostDefined.cpp +++ b/Userland/Libraries/LibWeb/Bindings/PrincipalHostDefined.cpp @@ -6,14 +6,14 @@ #include #include -#include #include +#include #include #include namespace Web::Bindings { -void HostDefined::visit_edges(JS::Cell::Visitor& visitor) +void PrincipalHostDefined::visit_edges(JS::Cell::Visitor& visitor) { JS::Realm::HostDefined::visit_edges(visitor); visitor.visit(environment_settings_object); diff --git a/Userland/Libraries/LibWeb/Bindings/PrincipalHostDefined.h b/Userland/Libraries/LibWeb/Bindings/PrincipalHostDefined.h new file mode 100644 index 00000000000..d0d465a0aba --- /dev/null +++ b/Userland/Libraries/LibWeb/Bindings/PrincipalHostDefined.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022, Andrew Kaster + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include +#include +#include + +namespace Web::Bindings { + +struct PrincipalHostDefined : public JS::Realm::HostDefined { + PrincipalHostDefined(JS::NonnullGCPtr eso, JS::NonnullGCPtr intrinsics, JS::NonnullGCPtr page) + : environment_settings_object(eso) + , intrinsics(intrinsics) + , page(page) + { + } + virtual ~PrincipalHostDefined() override = default; + virtual void visit_edges(JS::Cell::Visitor& visitor) override; + + JS::NonnullGCPtr environment_settings_object; + JS::NonnullGCPtr intrinsics; + JS::NonnullGCPtr page; +}; + +[[nodiscard]] inline HTML::EnvironmentSettingsObject& principal_host_defined_environment_settings_object(JS::Realm& realm) +{ + return *verify_cast(realm.host_defined())->environment_settings_object; +} + +[[nodiscard]] inline HTML::EnvironmentSettingsObject const& principal_host_defined_environment_settings_object(JS::Realm const& realm) +{ + return *verify_cast(realm.host_defined())->environment_settings_object; +} + +[[nodiscard]] inline Page& principal_host_defined_page(JS::Realm& realm) +{ + return *verify_cast(realm.host_defined())->page; +} + +} diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index b022eb040a4..0812e4ed72a 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -16,13 +16,13 @@ set(SOURCES ARIA/RoleType.cpp ARIA/StateAndProperties.cpp Bindings/AudioConstructor.cpp - Bindings/HostDefined.cpp Bindings/ImageConstructor.cpp Bindings/Intrinsics.cpp Bindings/LocationConstructor.cpp Bindings/MainThreadVM.cpp Bindings/OptionConstructor.cpp Bindings/PlatformObject.cpp + Bindings/PrincipalHostDefined.cpp Clipboard/Clipboard.cpp Clipboard/ClipboardEvent.cpp Crypto/Crypto.cpp diff --git a/Userland/Libraries/LibWeb/Clipboard/Clipboard.cpp b/Userland/Libraries/LibWeb/Clipboard/Clipboard.cpp index 06f9d8d2426..f2e224e1621 100644 --- a/Userland/Libraries/LibWeb/Clipboard/Clipboard.cpp +++ b/Userland/Libraries/LibWeb/Clipboard/Clipboard.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index f1b61e2d776..f22d272868d 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -383,7 +383,7 @@ JS::NonnullGCPtr Document::create_for_fragment_parsing(JS::Realm& real Document::Document(JS::Realm& realm, const URL::URL& url, TemporaryDocumentForFragmentParsing temporary_document_for_fragment_parsing) : ParentNode(realm, *this, NodeType::DOCUMENT_NODE) - , m_page(Bindings::host_defined_page(realm)) + , m_page(Bindings::principal_host_defined_page(realm)) , m_style_computer(make(*this)) , m_url(url) , m_temporary_document_for_fragment_parsing(temporary_document_for_fragment_parsing) @@ -1649,7 +1649,7 @@ Color Document::visited_link_color() const HTML::EnvironmentSettingsObject& Document::relevant_settings_object() const { // Then, the relevant settings object for a platform object o is the environment settings object of the relevant Realm for o. - return Bindings::host_defined_environment_settings_object(realm()); + return Bindings::principal_host_defined_environment_settings_object(realm()); } // https://dom.spec.whatwg.org/#dom-document-createelement @@ -4171,7 +4171,7 @@ void Document::start_intersection_observing_a_lazy_loading_element(Element& elem // Spec Note: This allows for fetching the image during scrolling, when it does not yet — but is about to — intersect the viewport. auto options = IntersectionObserver::IntersectionObserverInit {}; - auto wrapped_callback = realm.heap().allocate_without_realm(callback, Bindings::host_defined_environment_settings_object(realm)); + auto wrapped_callback = realm.heap().allocate_without_realm(callback, Bindings::principal_host_defined_environment_settings_object(realm)); m_lazy_load_intersection_observer = IntersectionObserver::IntersectionObserver::construct_impl(realm, wrapped_callback, options).release_value_but_fixme_should_propagate_errors(); } diff --git a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp index 00180f63ad9..63440573e2f 100644 --- a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp @@ -590,7 +590,7 @@ void EventTarget::activate_event_handler(FlyString const& name, HTML::EventHandl 0, "", &realm); // NOTE: As per the spec, the callback context is arbitrary. - auto callback = realm.heap().allocate_without_realm(*callback_function, Bindings::host_defined_environment_settings_object(realm)); + auto callback = realm.heap().allocate_without_realm(*callback_function, Bindings::principal_host_defined_environment_settings_object(realm)); // 5. Let listener be a new event listener whose type is the event handler event type corresponding to eventHandler and callback is callback. auto listener = realm.heap().allocate_without_realm(); diff --git a/Userland/Libraries/LibWeb/Fetch/Body.cpp b/Userland/Libraries/LibWeb/Fetch/Body.cpp index 69abea24488..76bd196e2e9 100644 --- a/Userland/Libraries/LibWeb/Fetch/Body.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Body.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include diff --git a/Userland/Libraries/LibWeb/Fetch/FetchMethod.cpp b/Userland/Libraries/LibWeb/Fetch/FetchMethod.cpp index 42679f5e0bf..05067f95d35 100644 --- a/Userland/Libraries/LibWeb/Fetch/FetchMethod.cpp +++ b/Userland/Libraries/LibWeb/Fetch/FetchMethod.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/FetchedDataReceiver.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/FetchedDataReceiver.cpp index 8540cb1a4e9..c8b98d4c252 100644 --- a/Userland/Libraries/LibWeb/Fetch/Fetching/FetchedDataReceiver.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Fetching/FetchedDataReceiver.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include #include diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp index ae4fc188418..94ad38f4e87 100644 --- a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp @@ -1833,7 +1833,7 @@ WebIDL::ExceptionOr> http_network_or_cache_fet // with the user agent’s cookie store and httpRequest’s current URL. auto cookies = ([&] { // FIXME: Getting to the page client reliably is way too complicated, and going via the document won't work in workers. - auto document = Bindings::host_defined_environment_settings_object(realm).responsible_document(); + auto document = Bindings::principal_host_defined_environment_settings_object(realm).responsible_document(); if (!document) return String {}; return document->page().client().page_did_request_cookie(http_request->current_url(), Cookie::Source::Http); @@ -2193,7 +2193,7 @@ WebIDL::ExceptionOr> nonstandard_resource_load auto request = fetch_params.request(); - auto& page = Bindings::host_defined_page(realm); + auto& page = Bindings::principal_host_defined_page(realm); // NOTE: Using LoadRequest::create_for_url_on_page here will unconditionally add cookies as long as there's a page available. // However, it is up to http_network_or_cache_fetch to determine if cookies should be added to the request. diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/IncrementalReadLoopReadRequest.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/IncrementalReadLoopReadRequest.cpp index 932aaf48040..0ec13989c9c 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/IncrementalReadLoopReadRequest.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/IncrementalReadLoopReadRequest.cpp @@ -5,7 +5,6 @@ */ #include -#include #include #include diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp index aa9880c7410..a5c54ed7fc3 100644 --- a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp @@ -341,7 +341,7 @@ JS::NonnullGCPtr Blob::get_stream() // onto the realm's VM, and we need an incumbent realm which is pushed onto the incumbent realm stack // by HTML::prepare_to_run_callback(). auto& realm = stream->realm(); - auto& environment_settings = Bindings::host_defined_environment_settings_object(realm); + auto& environment_settings = Bindings::principal_host_defined_environment_settings_object(realm); realm.vm().push_execution_context(environment_settings.realm_execution_context()); HTML::prepare_to_run_callback(realm); ScopeGuard const guard = [&realm] { diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp index 13b143f7213..f38aac0aa00 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp @@ -210,7 +210,7 @@ WebIDL::ExceptionOr BrowsingContext auto load_timing_info = DOM::DocumentLoadTimingInfo(); load_timing_info.navigation_start_time = HighResolutionTime::coarsen_time( unsafe_context_creation_time, - verify_cast(Bindings::host_defined_environment_settings_object(window->realm())).cross_origin_isolated_capability() == CanUseCrossOriginIsolatedAPIs::Yes); + verify_cast(Bindings::principal_host_defined_environment_settings_object(window->realm())).cross_origin_isolated_capability() == CanUseCrossOriginIsolatedAPIs::Yes); // 15. Let document be a new Document, with: auto document = HTML::HTMLDocument::create(window->realm()); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp index 444b84167c9..d619365dcfc 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp @@ -124,7 +124,7 @@ WebIDL::ExceptionOr HTMLDialogElement::show_modal() return JS::js_undefined(); }, 0, "", &realm()); - auto cancel_callback = realm().heap().allocate_without_realm(*cancel_callback_function, Bindings::host_defined_environment_settings_object(realm())); + auto cancel_callback = realm().heap().allocate_without_realm(*cancel_callback_function, Bindings::principal_host_defined_environment_settings_object(realm())); m_close_watcher->add_event_listener_without_options(HTML::EventNames::cancel, DOM::IDLEventListener::create(realm(), cancel_callback)); // - closeAction being to close the dialog given this and null. auto close_callback_function = JS::NativeFunction::create( @@ -134,7 +134,7 @@ WebIDL::ExceptionOr HTMLDialogElement::show_modal() return JS::js_undefined(); }, 0, "", &realm()); - auto close_callback = realm().heap().allocate_without_realm(*close_callback_function, Bindings::host_defined_environment_settings_object(realm())); + auto close_callback = realm().heap().allocate_without_realm(*close_callback_function, Bindings::principal_host_defined_environment_settings_object(realm())); m_close_watcher->add_event_listener_without_options(HTML::EventNames::close, DOM::IDLEventListener::create(realm(), close_callback)); // FIXME: 11. Set this's previously focused element to the focused element. diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 6715942fab4..0c3aa861d36 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -896,7 +896,7 @@ void HTMLInputElement::create_text_input_shadow_tree() return JS::js_undefined(); }, 0, "", &realm()); - auto mouseup_callback = realm().heap().allocate_without_realm(*mouseup_callback_function, Bindings::host_defined_environment_settings_object(realm())); + auto mouseup_callback = realm().heap().allocate_without_realm(*mouseup_callback_function, Bindings::principal_host_defined_environment_settings_object(realm())); DOM::AddEventListenerOptions mouseup_listener_options; mouseup_listener_options.once = true; @@ -909,7 +909,7 @@ void HTMLInputElement::create_text_input_shadow_tree() return JS::js_undefined(); }, 0, "", &realm()); - auto step_up_callback = realm().heap().allocate_without_realm(*up_callback_function, Bindings::host_defined_environment_settings_object(realm())); + auto step_up_callback = realm().heap().allocate_without_realm(*up_callback_function, Bindings::principal_host_defined_environment_settings_object(realm())); up_button->add_event_listener_without_options(UIEvents::EventNames::mousedown, DOM::IDLEventListener::create(realm(), step_up_callback)); up_button->add_event_listener_without_options(UIEvents::EventNames::mouseup, DOM::IDLEventListener::create(realm(), mouseup_callback)); @@ -931,7 +931,7 @@ void HTMLInputElement::create_text_input_shadow_tree() return JS::js_undefined(); }, 0, "", &realm()); - auto step_down_callback = realm().heap().allocate_without_realm(*down_callback_function, Bindings::host_defined_environment_settings_object(realm())); + auto step_down_callback = realm().heap().allocate_without_realm(*down_callback_function, Bindings::principal_host_defined_environment_settings_object(realm())); down_button->add_event_listener_without_options(UIEvents::EventNames::mousedown, DOM::IDLEventListener::create(realm(), step_down_callback)); down_button->add_event_listener_without_options(UIEvents::EventNames::mouseup, DOM::IDLEventListener::create(realm(), mouseup_callback)); } @@ -990,7 +990,7 @@ void HTMLInputElement::create_file_input_shadow_tree() }; auto on_button_click_function = JS::NativeFunction::create(realm, move(on_button_click), 0, "", &realm); - auto on_button_click_callback = realm.heap().allocate_without_realm(on_button_click_function, Bindings::host_defined_environment_settings_object(realm)); + auto on_button_click_callback = realm.heap().allocate_without_realm(on_button_click_function, Bindings::principal_host_defined_environment_settings_object(realm)); m_file_button->add_event_listener_without_options(UIEvents::EventNames::click, DOM::IDLEventListener::create(realm, on_button_click_callback)); update_file_input_shadow_tree(); @@ -1062,7 +1062,7 @@ void HTMLInputElement::create_range_input_shadow_tree() return JS::js_undefined(); }, 0, "", &realm()); - auto keydown_callback = realm().heap().allocate_without_realm(*keydown_callback_function, Bindings::host_defined_environment_settings_object(realm())); + auto keydown_callback = realm().heap().allocate_without_realm(*keydown_callback_function, Bindings::principal_host_defined_environment_settings_object(realm())); add_event_listener_without_options(UIEvents::EventNames::keydown, DOM::IDLEventListener::create(realm(), keydown_callback)); auto wheel_callback_function = JS::NativeFunction::create( @@ -1077,7 +1077,7 @@ void HTMLInputElement::create_range_input_shadow_tree() return JS::js_undefined(); }, 0, "", &realm()); - auto wheel_callback = realm().heap().allocate_without_realm(*wheel_callback_function, Bindings::host_defined_environment_settings_object(realm())); + auto wheel_callback = realm().heap().allocate_without_realm(*wheel_callback_function, Bindings::principal_host_defined_environment_settings_object(realm())); add_event_listener_without_options(UIEvents::EventNames::wheel, DOM::IDLEventListener::create(realm(), wheel_callback)); auto update_slider_by_mouse = [this](JS::VM& vm) { @@ -1100,7 +1100,7 @@ void HTMLInputElement::create_range_input_shadow_tree() return JS::js_undefined(); }, 0, "", &realm()); - auto mousemove_callback = realm().heap().allocate_without_realm(*mousemove_callback_function, Bindings::host_defined_environment_settings_object(realm())); + auto mousemove_callback = realm().heap().allocate_without_realm(*mousemove_callback_function, Bindings::principal_host_defined_environment_settings_object(realm())); auto mousemove_listener = DOM::IDLEventListener::create(realm(), mousemove_callback); auto& window = static_cast(relevant_global_object(*this)); window.add_event_listener_without_options(UIEvents::EventNames::mousemove, mousemove_listener); @@ -1112,7 +1112,7 @@ void HTMLInputElement::create_range_input_shadow_tree() return JS::js_undefined(); }, 0, "", &realm()); - auto mouseup_callback = realm().heap().allocate_without_realm(*mouseup_callback_function, Bindings::host_defined_environment_settings_object(realm())); + auto mouseup_callback = realm().heap().allocate_without_realm(*mouseup_callback_function, Bindings::principal_host_defined_environment_settings_object(realm())); DOM::AddEventListenerOptions mouseup_listener_options; mouseup_listener_options.once = true; window.add_event_listener(UIEvents::EventNames::mouseup, DOM::IDLEventListener::create(realm(), mouseup_callback), mouseup_listener_options); @@ -1120,7 +1120,7 @@ void HTMLInputElement::create_range_input_shadow_tree() return JS::js_undefined(); }, 0, "", &realm()); - auto mousedown_callback = realm().heap().allocate_without_realm(*mousedown_callback_function, Bindings::host_defined_environment_settings_object(realm())); + auto mousedown_callback = realm().heap().allocate_without_realm(*mousedown_callback_function, Bindings::principal_host_defined_environment_settings_object(realm())); add_event_listener_without_options(UIEvents::EventNames::mousedown, DOM::IDLEventListener::create(realm(), mousedown_callback)); } diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp index 1ced21521fd..897df65a548 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp @@ -140,7 +140,7 @@ JS::ExecutionContext const& execution_context_of_realm(JS::Realm const& realm) // FIXME: 1. If realm is a principal realm, then return the realm execution context of the environment settings object of realm. // FIXME: 2. Assert: realm is a synthetic realm. // FIXME: 3. Return the execution context of the synthetic realm settings object of realm. - return Bindings::host_defined_environment_settings_object(realm).realm_execution_context(); + return Bindings::principal_host_defined_environment_settings_object(realm).realm_execution_context(); } // https://html.spec.whatwg.org/multipage/webappapis.html#clean-up-after-running-script @@ -327,7 +327,7 @@ JS::Realm& incumbent_realm() EnvironmentSettingsObject& incumbent_settings_object() { // FIXME: Then, the incumbent settings object is the incumbent realm's principal realm settings object. - return Bindings::host_defined_environment_settings_object(incumbent_realm()); + return Bindings::principal_host_defined_environment_settings_object(incumbent_realm()); } // https://html.spec.whatwg.org/multipage/webappapis.html#concept-incumbent-global @@ -362,7 +362,7 @@ JS::Realm& principal_realm(JS::Realm& realm) EnvironmentSettingsObject& principal_realm_settings_object(JS::Realm& realm) { // A principal realm has a [[HostDefined]] field, which contains the principal realm's settings object. - return Bindings::host_defined_environment_settings_object(realm); + return Bindings::principal_host_defined_environment_settings_object(realm); } // https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object @@ -392,7 +392,7 @@ JS::Realm& relevant_realm(JS::Object const& object) EnvironmentSettingsObject& relevant_settings_object(JS::Object const& object) { // Then, the relevant settings object for a platform object o is the environment settings object of the relevant Realm for o. - return Bindings::host_defined_environment_settings_object(relevant_realm(object)); + return Bindings::principal_host_defined_environment_settings_object(relevant_realm(object)); } EnvironmentSettingsObject& relevant_settings_object(DOM::Node const& node) @@ -424,7 +424,7 @@ JS::Realm& entry_realm() EnvironmentSettingsObject& entry_settings_object() { // Then, the entry settings object is the environment settings object of the entry realm. - return Bindings::host_defined_environment_settings_object(entry_realm()); + return Bindings::principal_host_defined_environment_settings_object(entry_realm()); } // https://html.spec.whatwg.org/multipage/webappapis.html#entry-global-object diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/ImportMap.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/ImportMap.cpp index b4bca211cf3..a25c963f76c 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/ImportMap.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/ImportMap.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include #include diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp index 14aed00a936..a83289eed3d 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include #include +#include #include #include #include @@ -74,7 +74,7 @@ void WindowEnvironmentSettingsObject::setup(Page& page, URL::URL const& creation // 7. Set realm's [[HostDefined]] field to settings object. // Non-Standard: We store the ESO next to the web intrinsics in a custom HostDefined object auto intrinsics = realm->heap().allocate(*realm, *realm); - auto host_defined = make(settings_object, intrinsics, page); + auto host_defined = make(settings_object, intrinsics, page); realm->set_host_defined(move(host_defined)); // Non-Standard: We cannot fully initialize window object until *after* the we set up diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.cpp index 3177d7c1cc0..de97d78c6fc 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.cpp @@ -44,7 +44,7 @@ JS::NonnullGCPtr WorkerEnvironmentSettingsObjec // 8. Set realm's [[HostDefined]] field to settings object. auto intrinsics = realm->heap().allocate(*realm, *realm); - auto host_defined = make(settings_object, intrinsics, page); + auto host_defined = make(settings_object, intrinsics, page); realm->set_host_defined(move(host_defined)); // Non-Standard: We cannot fully initialize worker object until *after* the we set up diff --git a/Userland/Libraries/LibWeb/HTML/SharedResourceRequest.cpp b/Userland/Libraries/LibWeb/HTML/SharedResourceRequest.cpp index 7d891a2785c..462ce34dddd 100644 --- a/Userland/Libraries/LibWeb/HTML/SharedResourceRequest.cpp +++ b/Userland/Libraries/LibWeb/HTML/SharedResourceRequest.cpp @@ -24,7 +24,7 @@ JS_DEFINE_ALLOCATOR(SharedResourceRequest); JS::NonnullGCPtr SharedResourceRequest::get_or_create(JS::Realm& realm, JS::NonnullGCPtr page, URL::URL const& url) { - auto document = Bindings::host_defined_environment_settings_object(realm).responsible_document(); + auto document = Bindings::principal_host_defined_environment_settings_object(realm).responsible_document(); VERIFY(document); auto& shared_resource_requests = document->shared_resource_requests(); if (auto it = shared_resource_requests.find(url); it != shared_resource_requests.end()) diff --git a/Userland/Libraries/LibWeb/HTML/WorkerAgent.cpp b/Userland/Libraries/LibWeb/HTML/WorkerAgent.cpp index bbb37555323..7fd9870f17a 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerAgent.cpp +++ b/Userland/Libraries/LibWeb/HTML/WorkerAgent.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include @@ -34,7 +34,7 @@ void WorkerAgent::initialize(JS::Realm& realm) // NOTE: This blocking IPC call may launch another process. // If spinning the event loop for this can cause other javascript to execute, we're in trouble. - auto worker_socket_file = Bindings::host_defined_page(realm).client().request_worker_agent(); + auto worker_socket_file = Bindings::principal_host_defined_page(realm).client().request_worker_agent(); auto worker_socket = MUST(Core::LocalSocket::adopt_fd(worker_socket_file.take_fd())); MUST(worker_socket->set_blocking(true)); diff --git a/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.h b/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.h index 28d7529d381..2f3ad156a7a 100644 --- a/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.h +++ b/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.h @@ -12,7 +12,6 @@ #include #include #include -#include #include #include diff --git a/Userland/Libraries/LibWeb/WebIDL/Promise.cpp b/Userland/Libraries/LibWeb/WebIDL/Promise.cpp index 25de081d205..0d7a58a6e0b 100644 --- a/Userland/Libraries/LibWeb/WebIDL/Promise.cpp +++ b/Userland/Libraries/LibWeb/WebIDL/Promise.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include