From f9e5b43b7a3a4e45a2753cc6ea9742c3d431e266 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sun, 11 Feb 2024 19:48:56 +1300 Subject: [PATCH] LibWeb: Rename URL platform object to DOMURL Along with putting functions in the URL namespace into a DOMURL namespace. This is done as LibWeb is in an awkward situation where it needs two URL classes. AK::URL is the general purpose URL class which is all that is needed in 95% of cases. URL in the Web namespace is needed predominantly for interfacing with the javascript interfaces. Because of two URLs in the same namespace, AK::URL has had to be used throughout LibWeb. If we move AK::URL into a URL namespace, this becomes more painful - where ::URL::URL is required to specify the constructor (and something like ::URL::create_with_url_or_path in other places). To fix this problem - rename the class in LibWeb implementing the URL IDL interface to DOMURL, along with moving the other Web URL related classes into this DOMURL folder. One could argue that this name also makes the situation a little more clear in LibWeb for why these two URL classes need be used in the first place. --- .../BindingsGenerator/IDLGenerators.cpp | 14 ++-- .../LibWeb/BindingsGenerator/Namespaces.h | 2 +- Userland/Libraries/LibWeb/CMakeLists.txt | 6 +- .../LibWeb/{URL/URL.cpp => DOMURL/DOMURL.cpp} | 78 +++++++++---------- .../LibWeb/{URL/URL.h => DOMURL/DOMURL.h} | 20 ++--- .../LibWeb/{URL/URL.idl => DOMURL/DOMURL.idl} | 4 +- .../{URL => DOMURL}/URLSearchParams.cpp | 6 +- .../LibWeb/{URL => DOMURL}/URLSearchParams.h | 6 +- .../{URL => DOMURL}/URLSearchParams.idl | 0 .../URLSearchParamsIterator.cpp | 4 +- .../{URL => DOMURL}/URLSearchParamsIterator.h | 4 +- Userland/Libraries/LibWeb/Fetch/BodyInit.cpp | 4 +- Userland/Libraries/LibWeb/Fetch/BodyInit.h | 4 +- Userland/Libraries/LibWeb/Fetch/BodyInit.idl | 2 +- .../LibWeb/Fetch/Fetching/Checks.cpp | 4 +- .../LibWeb/Fetch/Fetching/Fetching.cpp | 10 +-- .../Fetch/Infrastructure/HTTP/Requests.cpp | 10 +-- .../Fetch/Infrastructure/HTTP/Responses.cpp | 4 +- Userland/Libraries/LibWeb/Fetch/Request.cpp | 8 +- Userland/Libraries/LibWeb/Fetch/Response.cpp | 4 +- Userland/Libraries/LibWeb/Forward.h | 4 +- .../Libraries/LibWeb/HTML/BrowsingContext.cpp | 4 +- .../Libraries/LibWeb/HTML/HTMLFormElement.cpp | 10 +-- .../LibWeb/HTML/Scripting/Fetching.cpp | 8 +- Userland/Libraries/LibWeb/HTML/Window.cpp | 6 +- .../PermissionsPolicy/AutoplayAllowlist.cpp | 4 +- .../ReferrerPolicy/AbstractOperations.cpp | 8 +- .../SecureContexts/AbstractOperations.cpp | 4 +- .../Libraries/LibWeb/XHR/XMLHttpRequest.h | 4 +- Userland/Libraries/LibWeb/idl_files.cmake | 4 +- 30 files changed, 125 insertions(+), 125 deletions(-) rename Userland/Libraries/LibWeb/{URL/URL.cpp => DOMURL/DOMURL.cpp} (88%) rename Userland/Libraries/LibWeb/{URL/URL.h => DOMURL/DOMURL.h} (82%) rename Userland/Libraries/LibWeb/{URL/URL.idl => DOMURL/DOMURL.idl} (89%) rename Userland/Libraries/LibWeb/{URL => DOMURL}/URLSearchParams.cpp (99%) rename Userland/Libraries/LibWeb/{URL => DOMURL}/URLSearchParams.h (95%) rename Userland/Libraries/LibWeb/{URL => DOMURL}/URLSearchParams.idl (100%) rename Userland/Libraries/LibWeb/{URL => DOMURL}/URLSearchParamsIterator.cpp (97%) rename Userland/Libraries/LibWeb/{URL => DOMURL}/URLSearchParamsIterator.h (93%) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index b3980803f9..9bdce54c0e 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -3422,6 +3422,7 @@ using namespace Web::Animations; using namespace Web::CSS; using namespace Web::DOM; using namespace Web::DOMParsing; +using namespace Web::DOMURL; using namespace Web::Encoding; using namespace Web::Fetch; using namespace Web::FileAPI; @@ -3435,7 +3436,6 @@ using namespace Web::ResizeObserver; using namespace Web::Selection; using namespace Web::Streams; using namespace Web::UIEvents; -using namespace Web::URL; using namespace Web::XHR; using namespace Web::WebAssembly; using namespace Web::WebAudio; @@ -3614,8 +3614,8 @@ void generate_constructor_implementation(IDL::Interface const& interface, String # include #elif __has_include() # include -#elif __has_include() -# include +#elif __has_include() +# include #endif #include #include @@ -3650,6 +3650,7 @@ using namespace Web::Animations; using namespace Web::CSS; using namespace Web::DOM; using namespace Web::DOMParsing; +using namespace Web::DOMURL; using namespace Web::Encoding; using namespace Web::Fetch; using namespace Web::FileAPI; @@ -3665,7 +3666,6 @@ using namespace Web::Selection; using namespace Web::Streams; using namespace Web::UIEvents; using namespace Web::UserTiming; -using namespace Web::URL; using namespace Web::XHR; using namespace Web::WebAssembly; using namespace Web::WebAudio; @@ -4130,6 +4130,7 @@ using namespace Web::Crypto; using namespace Web::CSS; using namespace Web::DOM; using namespace Web::DOMParsing; +using namespace Web::DOMURL; using namespace Web::Encoding; using namespace Web::Fetch; using namespace Web::FileAPI; @@ -4146,7 +4147,6 @@ using namespace Web::Selection; using namespace Web::Streams; using namespace Web::SVG; using namespace Web::UIEvents; -using namespace Web::URL; using namespace Web::UserTiming; using namespace Web::WebSockets; using namespace Web::XHR; @@ -4282,6 +4282,7 @@ using namespace Web::Animations; using namespace Web::CSS; using namespace Web::DOM; using namespace Web::DOMParsing; +using namespace Web::DOMURL; using namespace Web::Encoding; using namespace Web::Fetch; using namespace Web::FileAPI; @@ -4297,7 +4298,6 @@ using namespace Web::ResizeObserver; using namespace Web::Selection; using namespace Web::XHR; using namespace Web::UIEvents; -using namespace Web::URL; using namespace Web::UserTiming; using namespace Web::WebAudio; using namespace Web::WebGL; @@ -4420,6 +4420,7 @@ using namespace Web::Crypto; using namespace Web::CSS; using namespace Web::DOM; using namespace Web::DOMParsing; +using namespace Web::DOMURL; using namespace Web::Encoding; using namespace Web::Fetch; using namespace Web::FileAPI; @@ -4436,7 +4437,6 @@ using namespace Web::Selection; using namespace Web::Streams; using namespace Web::SVG; using namespace Web::UIEvents; -using namespace Web::URL; using namespace Web::UserTiming; using namespace Web::WebAudio; using namespace Web::WebSockets; diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/Namespaces.h b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/Namespaces.h index 9c17220c29..e5b481c327 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/Namespaces.h +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/Namespaces.h @@ -18,6 +18,7 @@ static constexpr Array libweb_interface_namespaces = { "Crypto"sv, "DOM"sv, "DOMParsing"sv, + "DOMURL"sv, "Encoding"sv, "Fetch"sv, "FileAPI"sv, @@ -33,7 +34,6 @@ static constexpr Array libweb_interface_namespaces = { "SVG"sv, "Selection"sv, "UIEvents"sv, - "URL"sv, "WebAudio"sv, "WebGL"sv, "WebIDL"sv, diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 5984a6f376..e9b4b480fb 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -184,6 +184,9 @@ set(SOURCES DOM/XMLDocument.cpp DOMParsing/InnerHTML.cpp DOMParsing/XMLSerializer.cpp + DOMURL/DOMURL.cpp + DOMURL/URLSearchParams.cpp + DOMURL/URLSearchParamsIterator.cpp Dump.cpp Encoding/TextDecoder.cpp Encoding/TextEncoder.cpp @@ -610,9 +613,6 @@ set(SOURCES UIEvents/MouseEvent.cpp UIEvents/UIEvent.cpp UIEvents/WheelEvent.cpp - URL/URL.cpp - URL/URLSearchParams.cpp - URL/URLSearchParamsIterator.cpp UserTiming/PerformanceMark.cpp UserTiming/PerformanceMeasure.cpp WebAssembly/Instance.cpp diff --git a/Userland/Libraries/LibWeb/URL/URL.cpp b/Userland/Libraries/LibWeb/DOMURL/DOMURL.cpp similarity index 88% rename from Userland/Libraries/LibWeb/URL/URL.cpp rename to Userland/Libraries/LibWeb/DOMURL/DOMURL.cpp index 02545a6806..03f9f48840 100644 --- a/Userland/Libraries/LibWeb/URL/URL.cpp +++ b/Userland/Libraries/LibWeb/DOMURL/DOMURL.cpp @@ -10,17 +10,17 @@ #include #include #include +#include #include #include -#include -namespace Web::URL { +namespace Web::DOMURL { -JS_DEFINE_ALLOCATOR(URL); +JS_DEFINE_ALLOCATOR(DOMURL); -JS::NonnullGCPtr URL::create(JS::Realm& realm, AK::URL url, JS::NonnullGCPtr query) +JS::NonnullGCPtr DOMURL::create(JS::Realm& realm, AK::URL url, JS::NonnullGCPtr query) { - return realm.heap().allocate(realm, realm, move(url), move(query)); + return realm.heap().allocate(realm, realm, move(url), move(query)); } // https://url.spec.whatwg.org/#api-url-parser @@ -50,7 +50,7 @@ static Optional parse_api_url(String const& url, Optional const } // https://url.spec.whatwg.org/#dom-url-url -WebIDL::ExceptionOr> URL::construct_impl(JS::Realm& realm, String const& url, Optional const& base) +WebIDL::ExceptionOr> DOMURL::construct_impl(JS::Realm& realm, String const& url, Optional const& base) { // 1. Let parsedURL be the result of running the API URL parser on url with base, if given. auto parsed_url = parse_api_url(url, base); @@ -67,7 +67,7 @@ WebIDL::ExceptionOr> URL::construct_impl(JS::Realm& realm, auto query_object = MUST(URLSearchParams::construct_impl(realm, query)); // 6. Initialize this’s query object with query. - auto result_url = URL::create(realm, parsed_url.release_value(), move(query_object)); + auto result_url = DOMURL::create(realm, parsed_url.release_value(), move(query_object)); // 7. Set this’s query object’s URL object to this. result_url->m_query->m_url = result_url; @@ -75,36 +75,36 @@ WebIDL::ExceptionOr> URL::construct_impl(JS::Realm& realm, return result_url; } -URL::URL(JS::Realm& realm, AK::URL url, JS::NonnullGCPtr query) +DOMURL::DOMURL(JS::Realm& realm, AK::URL url, JS::NonnullGCPtr query) : PlatformObject(realm) , m_url(move(url)) , m_query(move(query)) { } -URL::~URL() = default; +DOMURL::~DOMURL() = default; -void URL::initialize(JS::Realm& realm) +void DOMURL::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, "URL"_fly_string)); + set_prototype(&Bindings::ensure_web_prototype(realm, "URL"_fly_string)); } -void URL::visit_edges(Cell::Visitor& visitor) +void DOMURL::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_query); } // https://w3c.github.io/FileAPI/#dfn-createObjectURL -WebIDL::ExceptionOr URL::create_object_url(JS::VM& vm, JS::NonnullGCPtr object) +WebIDL::ExceptionOr DOMURL::create_object_url(JS::VM& vm, JS::NonnullGCPtr object) { // The createObjectURL(obj) static method must return the result of adding an entry to the blob URL store for obj. return TRY_OR_THROW_OOM(vm, FileAPI::add_entry_to_blob_url_store(object)); } // https://w3c.github.io/FileAPI/#dfn-revokeObjectURL -WebIDL::ExceptionOr URL::revoke_object_url(JS::VM& vm, StringView url) +WebIDL::ExceptionOr DOMURL::revoke_object_url(JS::VM& vm, StringView url) { // 1. Let url record be the result of parsing url. auto url_record = parse(url); @@ -129,7 +129,7 @@ WebIDL::ExceptionOr URL::revoke_object_url(JS::VM& vm, StringView url) } // https://url.spec.whatwg.org/#dom-url-canparse -bool URL::can_parse(JS::VM&, String const& url, Optional const& base) +bool DOMURL::can_parse(JS::VM&, String const& url, Optional const& base) { // 1. Let parsedURL be the result of running the API URL parser on url with base, if given. auto parsed_url = parse_api_url(url, base); @@ -143,7 +143,7 @@ bool URL::can_parse(JS::VM&, String const& url, Optional const& base) } // https://url.spec.whatwg.org/#dom-url-href -WebIDL::ExceptionOr URL::href() const +WebIDL::ExceptionOr DOMURL::href() const { auto& vm = realm().vm(); @@ -152,7 +152,7 @@ WebIDL::ExceptionOr URL::href() const } // https://url.spec.whatwg.org/#dom-url-tojson -WebIDL::ExceptionOr URL::to_json() const +WebIDL::ExceptionOr DOMURL::to_json() const { auto& vm = realm().vm(); @@ -161,7 +161,7 @@ WebIDL::ExceptionOr URL::to_json() const } // https://url.spec.whatwg.org/#ref-for-dom-url-href② -WebIDL::ExceptionOr URL::set_href(String const& href) +WebIDL::ExceptionOr DOMURL::set_href(String const& href) { auto& vm = realm().vm(); @@ -188,7 +188,7 @@ WebIDL::ExceptionOr URL::set_href(String const& href) } // https://url.spec.whatwg.org/#dom-url-origin -WebIDL::ExceptionOr URL::origin() const +WebIDL::ExceptionOr DOMURL::origin() const { auto& vm = realm().vm(); @@ -197,7 +197,7 @@ WebIDL::ExceptionOr URL::origin() const } // https://url.spec.whatwg.org/#dom-url-protocol -WebIDL::ExceptionOr URL::protocol() const +WebIDL::ExceptionOr DOMURL::protocol() const { auto& vm = realm().vm(); @@ -206,7 +206,7 @@ WebIDL::ExceptionOr URL::protocol() const } // https://url.spec.whatwg.org/#ref-for-dom-url-protocol%E2%91%A0 -WebIDL::ExceptionOr URL::set_protocol(String const& protocol) +WebIDL::ExceptionOr DOMURL::set_protocol(String const& protocol) { auto& vm = realm().vm(); @@ -219,7 +219,7 @@ WebIDL::ExceptionOr URL::set_protocol(String const& protocol) } // https://url.spec.whatwg.org/#dom-url-username -WebIDL::ExceptionOr URL::username() const +WebIDL::ExceptionOr DOMURL::username() const { auto& vm = realm().vm(); @@ -228,7 +228,7 @@ WebIDL::ExceptionOr URL::username() const } // https://url.spec.whatwg.org/#ref-for-dom-url-username%E2%91%A0 -void URL::set_username(String const& username) +void DOMURL::set_username(String const& username) { // 1. If this’s URL cannot have a username/password/port, then return. if (m_url.cannot_have_a_username_or_password_or_port()) @@ -239,7 +239,7 @@ void URL::set_username(String const& username) } // https://url.spec.whatwg.org/#dom-url-password -WebIDL::ExceptionOr URL::password() const +WebIDL::ExceptionOr DOMURL::password() const { auto& vm = realm().vm(); @@ -248,7 +248,7 @@ WebIDL::ExceptionOr URL::password() const } // https://url.spec.whatwg.org/#ref-for-dom-url-password%E2%91%A0 -void URL::set_password(String const& password) +void DOMURL::set_password(String const& password) { // 1. If this’s URL cannot have a username/password/port, then return. if (m_url.cannot_have_a_username_or_password_or_port()) @@ -259,7 +259,7 @@ void URL::set_password(String const& password) } // https://url.spec.whatwg.org/#dom-url-host -WebIDL::ExceptionOr URL::host() const +WebIDL::ExceptionOr DOMURL::host() const { auto& vm = realm().vm(); @@ -279,7 +279,7 @@ WebIDL::ExceptionOr URL::host() const } // https://url.spec.whatwg.org/#dom-url-hostref-for-dom-url-host%E2%91%A0 -void URL::set_host(String const& host) +void DOMURL::set_host(String const& host) { // 1. If this’s URL’s cannot-be-a-base-URL is true, then return. if (m_url.cannot_be_a_base_url()) @@ -292,7 +292,7 @@ void URL::set_host(String const& host) } // https://url.spec.whatwg.org/#dom-url-hostname -WebIDL::ExceptionOr URL::hostname() const +WebIDL::ExceptionOr DOMURL::hostname() const { auto& vm = realm().vm(); @@ -305,7 +305,7 @@ WebIDL::ExceptionOr URL::hostname() const } // https://url.spec.whatwg.org/#ref-for-dom-url-hostname① -void URL::set_hostname(String const& hostname) +void DOMURL::set_hostname(String const& hostname) { // 1. If this’s URL’s cannot-be-a-base-URL is true, then return. if (m_url.cannot_be_a_base_url()) @@ -318,7 +318,7 @@ void URL::set_hostname(String const& hostname) } // https://url.spec.whatwg.org/#dom-url-port -WebIDL::ExceptionOr URL::port() const +WebIDL::ExceptionOr DOMURL::port() const { auto& vm = realm().vm(); @@ -331,7 +331,7 @@ WebIDL::ExceptionOr URL::port() const } // https://url.spec.whatwg.org/#ref-for-dom-url-port%E2%91%A0 -void URL::set_port(String const& port) +void DOMURL::set_port(String const& port) { // 1. If this’s URL cannot have a username/password/port, then return. if (m_url.cannot_have_a_username_or_password_or_port()) @@ -350,7 +350,7 @@ void URL::set_port(String const& port) } // https://url.spec.whatwg.org/#dom-url-pathname -WebIDL::ExceptionOr URL::pathname() const +WebIDL::ExceptionOr DOMURL::pathname() const { auto& vm = realm().vm(); @@ -359,7 +359,7 @@ WebIDL::ExceptionOr URL::pathname() const } // https://url.spec.whatwg.org/#ref-for-dom-url-pathname%E2%91%A0 -void URL::set_pathname(String const& pathname) +void DOMURL::set_pathname(String const& pathname) { // FIXME: These steps no longer match the speci. // 1. If this’s URL’s cannot-be-a-base-URL is true, then return. @@ -377,7 +377,7 @@ void URL::set_pathname(String const& pathname) } // https://url.spec.whatwg.org/#dom-url-search -WebIDL::ExceptionOr URL::search() const +WebIDL::ExceptionOr DOMURL::search() const { auto& vm = realm().vm(); @@ -390,7 +390,7 @@ WebIDL::ExceptionOr URL::search() const } // https://url.spec.whatwg.org/#ref-for-dom-url-search%E2%91%A0 -WebIDL::ExceptionOr URL::set_search(String const& search) +WebIDL::ExceptionOr DOMURL::set_search(String const& search) { auto& vm = realm().vm(); @@ -433,14 +433,14 @@ WebIDL::ExceptionOr URL::set_search(String const& search) } // https://url.spec.whatwg.org/#dom-url-searchparams -JS::NonnullGCPtr URL::search_params() const +JS::NonnullGCPtr DOMURL::search_params() const { // The searchParams getter steps are to return this’s query object. return m_query; } // https://url.spec.whatwg.org/#dom-url-hash -WebIDL::ExceptionOr URL::hash() const +WebIDL::ExceptionOr DOMURL::hash() const { auto& vm = realm().vm(); @@ -453,7 +453,7 @@ WebIDL::ExceptionOr URL::hash() const } // https://url.spec.whatwg.org/#ref-for-dom-url-hash%E2%91%A0 -void URL::set_hash(String const& hash) +void DOMURL::set_hash(String const& hash) { // 1. If the given value is the empty string: if (hash.is_empty()) { @@ -540,7 +540,7 @@ bool host_is_domain(AK::URL::Host const& host) } // https://url.spec.whatwg.org/#potentially-strip-trailing-spaces-from-an-opaque-path -void strip_trailing_spaces_from_an_opaque_path(URL& url) +void strip_trailing_spaces_from_an_opaque_path(DOMURL& url) { // 1. If url’s URL does not have an opaque path, then return. // FIXME: Reimplement this step once we modernize the URL implementation to meet the spec. diff --git a/Userland/Libraries/LibWeb/URL/URL.h b/Userland/Libraries/LibWeb/DOMURL/DOMURL.h similarity index 82% rename from Userland/Libraries/LibWeb/URL/URL.h rename to Userland/Libraries/LibWeb/DOMURL/DOMURL.h index 1ea7559616..d8a96b7b4e 100644 --- a/Userland/Libraries/LibWeb/URL/URL.h +++ b/Userland/Libraries/LibWeb/DOMURL/DOMURL.h @@ -10,20 +10,20 @@ #include #include -#include +#include #include -namespace Web::URL { +namespace Web::DOMURL { -class URL : public Bindings::PlatformObject { - WEB_PLATFORM_OBJECT(URL, Bindings::PlatformObject); - JS_DECLARE_ALLOCATOR(URL); +class DOMURL : public Bindings::PlatformObject { + WEB_PLATFORM_OBJECT(DOMURL, Bindings::PlatformObject); + JS_DECLARE_ALLOCATOR(DOMURL); public: - [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, AK::URL, JS::NonnullGCPtr query); - static WebIDL::ExceptionOr> construct_impl(JS::Realm&, String const& url, Optional const& base = {}); + [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, URL, JS::NonnullGCPtr query); + static WebIDL::ExceptionOr> construct_impl(JS::Realm&, String const& url, Optional const& base = {}); - virtual ~URL() override; + virtual ~DOMURL() override; static WebIDL::ExceptionOr create_object_url(JS::VM&, JS::NonnullGCPtr object); static WebIDL::ExceptionOr revoke_object_url(JS::VM&, StringView url); @@ -79,7 +79,7 @@ public: void set_query(Badge, Optional query) { m_url.set_query(move(query)); } private: - URL(JS::Realm&, AK::URL, JS::NonnullGCPtr query); + DOMURL(JS::Realm&, AK::URL, JS::NonnullGCPtr query); virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; @@ -92,7 +92,7 @@ HTML::Origin url_origin(AK::URL const&); bool host_is_domain(AK::URL::Host const&); // https://url.spec.whatwg.org/#potentially-strip-trailing-spaces-from-an-opaque-path -void strip_trailing_spaces_from_an_opaque_path(URL& url); +void strip_trailing_spaces_from_an_opaque_path(DOMURL& url); // https://url.spec.whatwg.org/#concept-url-parser AK::URL parse(StringView input, Optional const& base_url = {}); diff --git a/Userland/Libraries/LibWeb/URL/URL.idl b/Userland/Libraries/LibWeb/DOMURL/DOMURL.idl similarity index 89% rename from Userland/Libraries/LibWeb/URL/URL.idl rename to Userland/Libraries/LibWeb/DOMURL/DOMURL.idl index 2bf44ba0c5..6ef49fe3f6 100644 --- a/Userland/Libraries/LibWeb/URL/URL.idl +++ b/Userland/Libraries/LibWeb/DOMURL/DOMURL.idl @@ -1,8 +1,8 @@ #import -#import +#import // https://url.spec.whatwg.org/#url -[Exposed=*, LegacyWindowAlias=webkitURL] +[Exposed=*, LegacyWindowAlias=webkitURL, ImplementedAs=DOMURL] interface URL { constructor(USVString url, optional USVString base); diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp b/Userland/Libraries/LibWeb/DOMURL/URLSearchParams.cpp similarity index 99% rename from Userland/Libraries/LibWeb/URL/URLSearchParams.cpp rename to Userland/Libraries/LibWeb/DOMURL/URLSearchParams.cpp index 475ef03d1e..5c15e8b481 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp +++ b/Userland/Libraries/LibWeb/DOMURL/URLSearchParams.cpp @@ -12,10 +12,10 @@ #include #include #include -#include -#include +#include +#include -namespace Web::URL { +namespace Web::DOMURL { JS_DEFINE_ALLOCATOR(URLSearchParams); diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParams.h b/Userland/Libraries/LibWeb/DOMURL/URLSearchParams.h similarity index 95% rename from Userland/Libraries/LibWeb/URL/URLSearchParams.h rename to Userland/Libraries/LibWeb/DOMURL/URLSearchParams.h index f6acea5bae..26f73a7db9 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParams.h +++ b/Userland/Libraries/LibWeb/DOMURL/URLSearchParams.h @@ -10,7 +10,7 @@ #include #include -namespace Web::URL { +namespace Web::DOMURL { struct QueryParam { String name; @@ -45,7 +45,7 @@ public: JS::ThrowCompletionOr for_each(ForEachCallback); private: - friend class URL; + friend class DOMURL; friend class URLSearchParamsIterator; URLSearchParams(JS::Realm&, Vector list); @@ -56,7 +56,7 @@ private: WebIDL::ExceptionOr update(); Vector m_list; - JS::GCPtr m_url; + JS::GCPtr m_url; }; } diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParams.idl b/Userland/Libraries/LibWeb/DOMURL/URLSearchParams.idl similarity index 100% rename from Userland/Libraries/LibWeb/URL/URLSearchParams.idl rename to Userland/Libraries/LibWeb/DOMURL/URLSearchParams.idl diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp b/Userland/Libraries/LibWeb/DOMURL/URLSearchParamsIterator.cpp similarity index 97% rename from Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp rename to Userland/Libraries/LibWeb/DOMURL/URLSearchParamsIterator.cpp index 6501e5155b..7f48f4dd3f 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp +++ b/Userland/Libraries/LibWeb/DOMURL/URLSearchParamsIterator.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include namespace Web::Bindings { @@ -21,7 +21,7 @@ void Intrinsics::create_web_prototype_and_constructor -#include +#include -namespace Web::URL { +namespace Web::DOMURL { class URLSearchParamsIterator : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(URLSearchParamsIterator, Bindings::PlatformObject); diff --git a/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp b/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp index 95bcf05a78..f9fb1acaac 100644 --- a/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp +++ b/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp @@ -6,13 +6,13 @@ */ #include +#include #include #include #include #include #include #include -#include #include #include #include @@ -103,7 +103,7 @@ WebIDL::ExceptionOr extract_body(JS::Realm& realm, type = TRY_OR_THROW_OOM(vm, ByteBuffer::copy(TRY_OR_THROW_OOM(vm, String::formatted("multipart/form-data; boundary={}"sv, serialized_form_data.boundary)).bytes())); return {}; }, - [&](JS::Handle const& url_search_params) -> WebIDL::ExceptionOr { + [&](JS::Handle const& url_search_params) -> WebIDL::ExceptionOr { // Set source to the result of running the application/x-www-form-urlencoded serializer with object’s list. auto search_params_bytes = TRY(url_search_params->to_string()).bytes(); source = TRY_OR_THROW_OOM(vm, ByteBuffer::copy(search_params_bytes)); diff --git a/Userland/Libraries/LibWeb/Fetch/BodyInit.h b/Userland/Libraries/LibWeb/Fetch/BodyInit.h index 62f20a2fca..851661c94a 100644 --- a/Userland/Libraries/LibWeb/Fetch/BodyInit.h +++ b/Userland/Libraries/LibWeb/Fetch/BodyInit.h @@ -14,9 +14,9 @@ namespace Web::Fetch { // https://fetch.spec.whatwg.org/#bodyinit -using BodyInit = Variant, JS::Handle, JS::Handle, JS::Handle, JS::Handle, String>; +using BodyInit = Variant, JS::Handle, JS::Handle, JS::Handle, JS::Handle, String>; -using BodyInitOrReadableBytes = Variant, JS::Handle, JS::Handle, JS::Handle, JS::Handle, String, ReadonlyBytes>; +using BodyInitOrReadableBytes = Variant, JS::Handle, JS::Handle, JS::Handle, JS::Handle, String, ReadonlyBytes>; WebIDL::ExceptionOr safely_extract_body(JS::Realm&, BodyInitOrReadableBytes const&); WebIDL::ExceptionOr extract_body(JS::Realm&, BodyInitOrReadableBytes const&, bool keepalive = false); diff --git a/Userland/Libraries/LibWeb/Fetch/BodyInit.idl b/Userland/Libraries/LibWeb/Fetch/BodyInit.idl index 4eb8c7cb25..f4e76b3ce9 100644 --- a/Userland/Libraries/LibWeb/Fetch/BodyInit.idl +++ b/Userland/Libraries/LibWeb/Fetch/BodyInit.idl @@ -1,6 +1,6 @@ #import #import -#import +#import #import // https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/Checks.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/Checks.cpp index fdfdb73733..f8473222e1 100644 --- a/Userland/Libraries/LibWeb/Fetch/Fetching/Checks.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Fetching/Checks.cpp @@ -4,10 +4,10 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include #include -#include namespace Web::Fetch::Fetching { @@ -70,7 +70,7 @@ ErrorOr tao_check(Infrastructure::Request const& request, Infrastructure:: // information, but the container document would not. if (request.mode() == Infrastructure::Request::Mode::Navigate && request.origin().has() - && !URL::url_origin(request.current_url()).is_same_origin(request.origin().get())) { + && !DOMURL::url_origin(request.current_url()).is_same_origin(request.origin().get())) { return false; } diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp index f668f653bd..be37557c64 100644 --- a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -43,7 +44,6 @@ #include #include #include -#include #include namespace Web::Fetch::Fetching { @@ -259,7 +259,7 @@ WebIDL::ExceptionOr>> main_fetch(JS:: // - request’s current URL’s scheme is "http" request->current_url().scheme() == "http"sv // - request’s current URL’s host is a domain - && URL::host_is_domain(request->current_url().host()) + && DOMURL::host_is_domain(request->current_url().host()) // FIXME: - Matching request’s current URL’s host per Known HSTS Host Domain Name Matching results in either a // superdomain match with an asserted includeSubDomains directive or a congruent match (with or without an // asserted includeSubDomains directive) [HSTS]; or DNS resolution for the request finds a matching HTTPS RR @@ -291,7 +291,7 @@ WebIDL::ExceptionOr>> main_fetch(JS:: // -> request’s current URL’s scheme is "data" // -> request’s mode is "navigate" or "websocket" else if ( - (request->origin().has() && URL::url_origin(request->current_url()).is_same_origin(request->origin().get()) && request->response_tainting() == Infrastructure::Request::ResponseTainting::Basic) + (request->origin().has() && DOMURL::url_origin(request->current_url()).is_same_origin(request->origin().get()) && request->response_tainting() == Infrastructure::Request::ResponseTainting::Basic) || request->current_url().scheme() == "data"sv || (request->mode() == Infrastructure::Request::Mode::Navigate || request->mode() == Infrastructure::Request::Mode::WebSocket)) { // 1. Set request’s response tainting to "basic". @@ -1113,7 +1113,7 @@ WebIDL::ExceptionOr>> http_redirect_f if (request->mode() == Infrastructure::Request::Mode::CORS && location_url.includes_credentials() && request->origin().has() - && !request->origin().get().is_same_origin(URL::url_origin(location_url))) { + && !request->origin().get().is_same_origin(DOMURL::url_origin(location_url))) { return PendingResponse::create(vm, request, Infrastructure::Response::network_error(vm, "Request with 'cors' mode and different URL and request origin must not include credentials in redirect URL"sv)); } @@ -1156,7 +1156,7 @@ WebIDL::ExceptionOr>> http_redirect_f // 13. If request’s current URL’s origin is not same origin with locationURL’s origin, then for each headerName of // CORS non-wildcard request-header name, delete headerName from request’s header list. // NOTE: I.e., the moment another origin is seen after the initial request, the `Authorization` header is removed. - if (!URL::url_origin(request->current_url()).is_same_origin(URL::url_origin(location_url))) { + if (!DOMURL::url_origin(request->current_url()).is_same_origin(DOMURL::url_origin(location_url))) { static constexpr Array cors_non_wildcard_request_header_names { "Authorization"sv }; diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp index 67f55c912e..f4555d321d 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp @@ -7,9 +7,9 @@ #include #include #include +#include #include #include -#include namespace Web::Fetch::Infrastructure { @@ -175,8 +175,8 @@ bool Request::has_redirect_tainted_origin() const // 2. If url’s origin is not same origin with lastURL’s origin and request’s origin is not same origin with lastURL’s origin, then return true. auto const* request_origin = m_origin.get_pointer(); - if (!URL::url_origin(url).is_same_origin(URL::url_origin(*last_url)) - && (request_origin == nullptr || !request_origin->is_same_origin(URL::url_origin(*last_url)))) { + if (!DOMURL::url_origin(url).is_same_origin(DOMURL::url_origin(*last_url)) + && (request_origin == nullptr || !request_origin->is_same_origin(DOMURL::url_origin(*last_url)))) { return true; } @@ -331,7 +331,7 @@ ErrorOr Request::add_origin_header() case ReferrerPolicy::ReferrerPolicy::SameOrigin: // If request’s origin is not same origin with request’s current URL’s origin, then set serializedOrigin // to `null`. - if (m_origin.has() && !m_origin.get().is_same_origin(URL::url_origin(current_url()))) + if (m_origin.has() && !m_origin.get().is_same_origin(DOMURL::url_origin(current_url()))) serialized_origin = MUST(ByteBuffer::copy("null"sv.bytes())); break; // -> Otherwise @@ -371,7 +371,7 @@ bool Request::cross_origin_embedder_policy_allows_credentials() const if (request_origin == nullptr) return false; - return request_origin->is_same_origin(URL::url_origin(current_url())) && !has_redirect_tainted_origin(); + return request_origin->is_same_origin(DOMURL::url_origin(current_url())) && !has_redirect_tainted_origin(); } } diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp index 9f576a0cff..232a5835e9 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp @@ -10,10 +10,10 @@ #include #include #include +#include #include #include #include -#include namespace Web::Fetch::Infrastructure { @@ -133,7 +133,7 @@ ErrorOr> Response::location_url(Optional const& reques return Optional {}; // 3. If location is a header value, then set location to the result of parsing location with response’s URL. - auto location = URL::parse(location_values.first(), url()); + auto location = DOMURL::parse(location_values.first(), url()); if (!location.is_valid()) return Error::from_string_view("Invalid 'Location' header URL"sv); diff --git a/Userland/Libraries/LibWeb/Fetch/Request.cpp b/Userland/Libraries/LibWeb/Fetch/Request.cpp index 8bb7e16d8c..2a9f2413e7 100644 --- a/Userland/Libraries/LibWeb/Fetch/Request.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Request.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -17,7 +18,6 @@ #include #include #include -#include namespace Web::Fetch { @@ -121,7 +121,7 @@ WebIDL::ExceptionOr> Request::construct_impl(JS::Realm // 5. If input is a string, then: if (input.has()) { // 1. Let parsedURL be the result of parsing input with baseURL. - auto parsed_url = URL::parse(input.get(), base_url); + auto parsed_url = DOMURL::parse(input.get(), base_url); // 2. If parsedURL is failure, then throw a TypeError. if (!parsed_url.is_valid()) @@ -299,7 +299,7 @@ WebIDL::ExceptionOr> Request::construct_impl(JS::Realm // 3. Otherwise: else { // 1. Let parsedReferrer be the result of parsing referrer with baseURL. - auto parsed_referrer = URL::parse(referrer, base_url); + auto parsed_referrer = DOMURL::parse(referrer, base_url); // 2. If parsedReferrer is failure, then throw a TypeError. if (!parsed_referrer.is_valid()) @@ -309,7 +309,7 @@ WebIDL::ExceptionOr> Request::construct_impl(JS::Realm // - parsedReferrer’s scheme is "about" and path is the string "client" // - parsedReferrer’s origin is not same origin with origin // then set request’s referrer to "client". - auto parsed_referrer_origin = URL::url_origin(parsed_referrer); + auto parsed_referrer_origin = DOMURL::url_origin(parsed_referrer); if ((parsed_referrer.scheme() == "about"sv && parsed_referrer.serialize_path() == "client"sv) || !parsed_referrer_origin.is_same_origin(origin)) { request->set_referrer(Infrastructure::Request::Referrer::Client); } diff --git a/Userland/Libraries/LibWeb/Fetch/Response.cpp b/Userland/Libraries/LibWeb/Fetch/Response.cpp index 775409aff7..f290fc5b1e 100644 --- a/Userland/Libraries/LibWeb/Fetch/Response.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Response.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -14,7 +15,6 @@ #include #include #include -#include namespace Web::Fetch { @@ -170,7 +170,7 @@ WebIDL::ExceptionOr> Response::redirect(JS::VM& vm, S // 1. Let parsedURL be the result of parsing url with current settings object’s API base URL. auto api_base_url = HTML::current_settings_object().api_base_url(); - auto parsed_url = URL::parse(url, api_base_url); + auto parsed_url = DOMURL::parse(url, api_base_url); // 2. If parsedURL is failure, then throw a TypeError. if (!parsed_url.is_valid()) diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h index 5452bebf6b..4adba1b4ea 100644 --- a/Userland/Libraries/LibWeb/Forward.h +++ b/Userland/Libraries/LibWeb/Forward.h @@ -654,8 +654,8 @@ class MouseEvent; class UIEvents; } -namespace Web::URL { -class URL; +namespace Web::DOMURL { +class DOMURL; class URLSearchParams; class URLSearchParamsIterator; } diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp index 874701e918..d987b3ba4b 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -29,7 +30,6 @@ #include #include #include -#include namespace Web::HTML { @@ -83,7 +83,7 @@ HTML::Origin determine_the_origin(AK::URL const& url, SandboxingFlagSet sandbox_ return source_origin.release_value(); // 5. Return url's origin. - return URL::url_origin(url); + return DOMURL::url_origin(url); } // https://html.spec.whatwg.org/multipage/document-sequences.html#creating-a-new-auxiliary-browsing-context diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp index 5512463c3a..0be3905cb9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,6 @@ #include #include #include -#include namespace Web::HTML { @@ -649,10 +649,10 @@ ErrorOr HTMLFormElement::pick_an_encoding() const } // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#convert-to-a-list-of-name-value-pairs -static ErrorOr> convert_to_list_of_name_value_pairs(Vector const& entry_list) +static ErrorOr> convert_to_list_of_name_value_pairs(Vector const& entry_list) { // 1. Let list be an empty list of name-value pairs. - Vector list; + Vector list; // 2. For each entry of entry list: for (auto const& entry : entry_list) { @@ -675,7 +675,7 @@ static ErrorOr> convert_to_list_of_name_value_pairs(Vect auto normalized_value = TRY(normalize_line_breaks(value)); // 4. Append to list a new name-value pair whose name is name and whose value is value. - TRY(list.try_append(URL::QueryParam { .name = move(name), .value = move(normalized_value) })); + TRY(list.try_append(DOMURL::QueryParam { .name = move(name), .value = move(normalized_value) })); } // 3. Return list. @@ -683,7 +683,7 @@ static ErrorOr> convert_to_list_of_name_value_pairs(Vect } // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#text/plain-encoding-algorithm -static ErrorOr plain_text_encode(Vector const& pairs) +static ErrorOr plain_text_encode(Vector const& pairs) { // 1. Let result be the empty string. StringBuilder result; diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp index 55956ceea5..c0a43e82cf 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -24,7 +25,6 @@ #include #include #include -#include namespace Web::HTML { @@ -195,7 +195,7 @@ WebIDL::ExceptionOr> resolve_imports_match(ByteString const& n VERIFY(resolution_result->serialize().ends_with("/"sv)); // 5. Let url be the result of URL parsing afterPrefix with resolutionResult. - auto url = URL::parse(after_prefix, *resolution_result); + auto url = DOMURL::parse(after_prefix, *resolution_result); // 6. If url is failure, then throw a TypeError indicating that resolution of normalizedSpecifier was blocked since the afterPrefix portion // could not be URL-parsed relative to the resolutionResult mapped to by the specifierKey prefix. @@ -225,7 +225,7 @@ Optional resolve_url_like_module_specifier(ByteString const& specifier, // 1. If specifier starts with "/", "./", or "../", then: if (specifier.starts_with("/"sv) || specifier.starts_with("./"sv) || specifier.starts_with("../"sv)) { // 1. Let url be the result of URL parsing specifier with baseURL. - auto url = URL::parse(specifier, base_url); + auto url = DOMURL::parse(specifier, base_url); // 2. If url is failure, then return null. if (!url.is_valid()) @@ -236,7 +236,7 @@ Optional resolve_url_like_module_specifier(ByteString const& specifier, } // 2. Let url be the result of URL parsing specifier (with no base URL). - auto url = URL::parse(specifier); + auto url = DOMURL::parse(specifier); // 3. If url is failure, then return null. if (!url.is_valid()) diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index 824937849f..622982d875 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -68,7 +69,6 @@ #include #include #include -#include #include namespace Web::HTML { @@ -1064,14 +1064,14 @@ WebIDL::ExceptionOr Window::window_post_message_steps(JS::Value message, W // 5. Otherwise, if targetOrigin is not a single U+002A ASTERISK character (*), then: else if (options.target_origin != "*"sv) { // 1. Let parsedURL be the result of running the URL parser on targetOrigin. - auto parsed_url = URL::parse(options.target_origin); + auto parsed_url = DOMURL::parse(options.target_origin); // 2. If parsedURL is failure, then throw a "SyntaxError" DOMException. if (!parsed_url.is_valid()) return WebIDL::SyntaxError::create(target_realm, MUST(String::formatted("Invalid URL for targetOrigin: '{}'", options.target_origin))); // 3. Set targetOrigin to parsedURL's origin. - target_origin = URL::url_origin(parsed_url); + target_origin = DOMURL::url_origin(parsed_url); } // 6. Let transfer be options["transfer"]. diff --git a/Userland/Libraries/LibWeb/PermissionsPolicy/AutoplayAllowlist.cpp b/Userland/Libraries/LibWeb/PermissionsPolicy/AutoplayAllowlist.cpp index b0d97c52e1..e1e3d87c20 100644 --- a/Userland/Libraries/LibWeb/PermissionsPolicy/AutoplayAllowlist.cpp +++ b/Userland/Libraries/LibWeb/PermissionsPolicy/AutoplayAllowlist.cpp @@ -7,9 +7,9 @@ #include #include #include +#include #include #include -#include // FIXME: This is an ad-hoc implementation of the "autoplay" policy-controlled feature: // https://w3c.github.io/webappsec-permissions-policy/#policy-controlled-feature @@ -82,7 +82,7 @@ ErrorOr AutoplayAllowlist::enable_for_origins(ReadonlySpan origins continue; } - TRY(allowlist.try_append(URL::url_origin(url))); + TRY(allowlist.try_append(DOMURL::url_origin(url))); } return {}; diff --git a/Userland/Libraries/LibWeb/ReferrerPolicy/AbstractOperations.cpp b/Userland/Libraries/LibWeb/ReferrerPolicy/AbstractOperations.cpp index 48dc150bbd..cebffd2357 100644 --- a/Userland/Libraries/LibWeb/ReferrerPolicy/AbstractOperations.cpp +++ b/Userland/Libraries/LibWeb/ReferrerPolicy/AbstractOperations.cpp @@ -6,13 +6,13 @@ #include #include +#include #include #include #include #include #include #include -#include namespace Web::ReferrerPolicy { @@ -112,7 +112,7 @@ Optional determine_requests_referrer(Fetch::Infrastructure::Request con case ReferrerPolicy::StrictOriginWhenCrossOrigin: // 1. If the origin of referrerURL and the origin of request’s current URL are the same, then return // referrerURL. - if (referrer_url.has_value() && URL::url_origin(*referrer_url).is_same_origin(URL::url_origin(request.current_url()))) + if (referrer_url.has_value() && DOMURL::url_origin(*referrer_url).is_same_origin(DOMURL::url_origin(request.current_url()))) return referrer_url; // 2. If referrerURL is a potentially trustworthy URL and request’s current URL is not a potentially @@ -130,7 +130,7 @@ Optional determine_requests_referrer(Fetch::Infrastructure::Request con // 1. If the origin of referrerURL and the origin of request’s current URL are the same, then return // referrerURL. if (referrer_url.has_value() - && URL::url_origin(*referrer_url).is_same_origin(URL::url_origin(request.current_url()))) { + && DOMURL::url_origin(*referrer_url).is_same_origin(DOMURL::url_origin(request.current_url()))) { return referrer_url; } @@ -141,7 +141,7 @@ Optional determine_requests_referrer(Fetch::Infrastructure::Request con // 1. If the origin of referrerURL and the origin of request’s current URL are the same, then return // referrerURL. if (referrer_url.has_value() - && URL::url_origin(*referrer_url).is_same_origin(URL::url_origin(request.current_url()))) { + && DOMURL::url_origin(*referrer_url).is_same_origin(DOMURL::url_origin(request.current_url()))) { return referrer_url; } diff --git a/Userland/Libraries/LibWeb/SecureContexts/AbstractOperations.cpp b/Userland/Libraries/LibWeb/SecureContexts/AbstractOperations.cpp index 41b2a49fc0..859aae7a5a 100644 --- a/Userland/Libraries/LibWeb/SecureContexts/AbstractOperations.cpp +++ b/Userland/Libraries/LibWeb/SecureContexts/AbstractOperations.cpp @@ -7,9 +7,9 @@ #include #include #include +#include #include #include -#include namespace Web::SecureContexts { @@ -79,7 +79,7 @@ Trustworthiness is_url_potentially_trustworthy(AK::URL const& url) return Trustworthiness::PotentiallyTrustworthy; // 3. Return the result of executing § 3.1 Is origin potentially trustworthy? on url’s origin. - return is_origin_potentially_trustworthy(URL::url_origin(url)); + return is_origin_potentially_trustworthy(DOMURL::url_origin(url)); } } diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h index 1ab202b290..6ab573fb99 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h @@ -13,20 +13,20 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include #include namespace Web::XHR { // https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit -using DocumentOrXMLHttpRequestBodyInit = Variant, JS::Handle, JS::Handle, JS::Handle, JS::Handle, AK::String>; +using DocumentOrXMLHttpRequestBodyInit = Variant, JS::Handle, JS::Handle, JS::Handle, JS::Handle, AK::String>; class XMLHttpRequest final : public XMLHttpRequestEventTarget { WEB_PLATFORM_OBJECT(XMLHttpRequest, XMLHttpRequestEventTarget); diff --git a/Userland/Libraries/LibWeb/idl_files.cmake b/Userland/Libraries/LibWeb/idl_files.cmake index f78a802b25..39b11c6722 100644 --- a/Userland/Libraries/LibWeb/idl_files.cmake +++ b/Userland/Libraries/LibWeb/idl_files.cmake @@ -69,6 +69,8 @@ libweb_js_bindings(DOM/Text) libweb_js_bindings(DOM/TreeWalker) libweb_js_bindings(DOM/XMLDocument) libweb_js_bindings(DOMParsing/XMLSerializer) +libweb_js_bindings(DOMURL/DOMURL) +libweb_js_bindings(DOMURL/URLSearchParams ITERABLE) libweb_js_bindings(Encoding/TextDecoder) libweb_js_bindings(Encoding/TextEncoder) libweb_js_bindings(Fetch/Headers ITERABLE) @@ -271,8 +273,6 @@ libweb_js_bindings(UIEvents/KeyboardEvent) libweb_js_bindings(UIEvents/MouseEvent) libweb_js_bindings(UIEvents/UIEvent) libweb_js_bindings(UIEvents/WheelEvent) -libweb_js_bindings(URL/URL) -libweb_js_bindings(URL/URLSearchParams ITERABLE) libweb_js_bindings(UserTiming/PerformanceMark) libweb_js_bindings(UserTiming/PerformanceMeasure) libweb_js_bindings(WebAssembly/Instance)