mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 14:14:58 +00:00
AK+Everywhere: Use Optional for URLParser::parse's base_url parameter
This commit is contained in:
parent
38bdf4d159
commit
9915fa72fb
12 changed files with 31 additions and 32 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue