diff options
author | networkException <git@nwex.de> | 2023-04-11 14:53:40 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-04-11 16:28:20 +0200 |
commit | 9915fa72fbb161526616f4ff485a112fecd1f59c (patch) | |
tree | 82a30b3d2f770db2111e8b4d28aed8e6909eae1d /Userland/Libraries/LibWeb/HTML | |
parent | 38bdf4d159e6891b07c3a59dd274b9d18f3af0b5 (diff) | |
download | serenity-9915fa72fbb161526616f4ff485a112fecd1f59c.zip |
AK+Everywhere: Use Optional for URLParser::parse's base_url parameter
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp | 14 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Location.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp index 05c469db9e..3ebdf72248 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp @@ -80,7 +80,7 @@ void HTMLHyperlinkElementUtils::set_protocol(DeprecatedString protocol) return; // 3. Basic URL parse the given value, followed by ":", with this element's url as url and scheme start state as state override. - auto result_url = URLParser::parse(DeprecatedString::formatted("{}:", protocol), nullptr, m_url, URLParser::State::SchemeStart); + auto result_url = URLParser::parse(DeprecatedString::formatted("{}:", protocol), {}, m_url, URLParser::State::SchemeStart); if (result_url.is_valid()) m_url = move(result_url); @@ -194,7 +194,7 @@ void HTMLHyperlinkElementUtils::set_host(DeprecatedString host) return; // 4. Basic URL parse the given value, with url as url and host state as state override. - auto result_url = URLParser::parse(host, nullptr, url, URLParser::State::Host); + auto result_url = URLParser::parse(host, {}, url, URLParser::State::Host); if (result_url.is_valid()) m_url = move(result_url); @@ -227,7 +227,7 @@ void HTMLHyperlinkElementUtils::set_hostname(DeprecatedString hostname) return; // 4. Basic URL parse the given value, with url as url and hostname state as state override. - auto result_url = URLParser::parse(hostname, nullptr, m_url, URLParser::State::Hostname); + auto result_url = URLParser::parse(hostname, {}, m_url, URLParser::State::Hostname); if (result_url.is_valid()) m_url = move(result_url); @@ -269,7 +269,7 @@ void HTMLHyperlinkElementUtils::set_port(DeprecatedString port) m_url->set_port({}); } else { // 5. Otherwise, basic URL parse the given value, with url as url and port state as state override. - auto result_url = URLParser::parse(port, nullptr, m_url, URLParser::State::Port); + auto result_url = URLParser::parse(port, {}, m_url, URLParser::State::Port); if (result_url.is_valid()) m_url = move(result_url); } @@ -313,7 +313,7 @@ void HTMLHyperlinkElementUtils::set_pathname(DeprecatedString pathname) url->set_paths({}); // 5. Basic URL parse the given value, with url as url and path start state as state override. - auto result_url = URLParser::parse(pathname, nullptr, move(url), URLParser::State::PathStart); + auto result_url = URLParser::parse(pathname, {}, move(url), URLParser::State::PathStart); if (result_url.is_valid()) m_url = move(result_url); @@ -360,7 +360,7 @@ void HTMLHyperlinkElementUtils::set_search(DeprecatedString search) url_copy->set_query(DeprecatedString::empty()); // 3. Basic URL parse input, with null, this element's node document's document's character encoding, url as url, and query state as state override. - auto result_url = URLParser::parse(input, nullptr, move(url_copy), URLParser::State::Query); + auto result_url = URLParser::parse(input, {}, move(url_copy), URLParser::State::Query); if (result_url.is_valid()) m_url = move(result_url); } @@ -408,7 +408,7 @@ void HTMLHyperlinkElementUtils::set_hash(DeprecatedString hash) url_copy->set_fragment(DeprecatedString::empty()); // 3. Basic URL parse input, with url as url and fragment state as state override. - auto result_url = URLParser::parse(input, nullptr, move(url_copy), URLParser::State::Fragment); + auto result_url = URLParser::parse(input, {}, move(url_copy), URLParser::State::Fragment); if (result_url.is_valid()) m_url = move(result_url); } diff --git a/Userland/Libraries/LibWeb/HTML/Location.cpp b/Userland/Libraries/LibWeb/HTML/Location.cpp index 1ff44e4e24..0c0247ee4a 100644 --- a/Userland/Libraries/LibWeb/HTML/Location.cpp +++ b/Userland/Libraries/LibWeb/HTML/Location.cpp @@ -312,7 +312,7 @@ WebIDL::ExceptionOr<void> Location::set_hash(String const& value) copy_url.set_fragment(""); // 6. Basic URL parse input, with copyURL as url and fragment state as state override. - auto result_url = URLParser::parse(input, nullptr, copy_url, URLParser::State::Fragment); + auto result_url = URLParser::parse(input, {}, copy_url, URLParser::State::Fragment); // 7. If copyURL's fragment is this's url's fragment, then return. if (copy_url.fragment() == this->url().fragment()) diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp index 647bcb5ba9..116adb22e0 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp @@ -159,7 +159,7 @@ WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(DeprecatedString co VERIFY(resolution_result->serialize().ends_with("/"sv)); // 5. Let url be the result of URL parsing afterPrefix with resolutionResult. - auto url = URLParser::parse(after_prefix, &*resolution_result); + auto url = URLParser::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. @@ -189,7 +189,7 @@ Optional<AK::URL> resolve_url_like_module_specifier(DeprecatedString const& spec // 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 = URLParser::parse(specifier, &base_url); + auto url = URLParser::parse(specifier, base_url); // 2. If url is failure, then return null. if (!url.is_valid()) |