1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 20:04:59 +00:00

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.
This commit is contained in:
Shannon Booth 2024-02-11 19:48:56 +13:00 committed by Andreas Kling
parent 1b6346ee1c
commit f9e5b43b7a
30 changed files with 125 additions and 125 deletions

View file

@ -8,6 +8,7 @@
#include <LibJS/Runtime/ModuleRequest.h>
#include <LibTextCodec/Decoder.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOMURL/DOMURL.h>
#include <LibWeb/Fetch/Fetching/Fetching.h>
#include <LibWeb/Fetch/Infrastructure/FetchAlgorithms.h>
#include <LibWeb/Fetch/Infrastructure/HTTP/Headers.h>
@ -24,7 +25,6 @@
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Infra/Strings.h>
#include <LibWeb/MimeSniff/MimeType.h>
#include <LibWeb/URL/URL.h>
namespace Web::HTML {
@ -195,7 +195,7 @@ WebIDL::ExceptionOr<Optional<AK::URL>> 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<AK::URL> 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<AK::URL> 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())