mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 10:37:17 +02:00
LibURL: Make URL::serialized_host() infallible
This can no longer fail, so update the return type to match.
This makes a few more methods now unable to return errors, but one thing
at a time. 😅
This commit is contained in:
committed by
Andreas Kling
parent
70c8535b8a
commit
900c131178
Notes:
github-actions[bot]
2024-11-30 11:23:28 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/900c131178b Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2610 Reviewed-by: https://github.com/shannonbooth ✅
@@ -172,10 +172,10 @@ String HTMLHyperlinkElementUtils::host() const
|
||||
|
||||
// 4. If url's port is null, return url's host, serialized.
|
||||
if (!url->port().has_value())
|
||||
return MUST(url->serialized_host());
|
||||
return url->serialized_host();
|
||||
|
||||
// 5. Return url's host, serialized, followed by ":" and url's port, serialized.
|
||||
return MUST(String::formatted("{}:{}", MUST(url->serialized_host()), url->port().value()));
|
||||
return MUST(String::formatted("{}:{}", url->serialized_host(), url->port().value()));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-host
|
||||
@@ -211,7 +211,7 @@ String HTMLHyperlinkElementUtils::hostname() const
|
||||
return String {};
|
||||
|
||||
// 4. Return url's host, serialized.
|
||||
return MUST(url.serialized_host());
|
||||
return url.serialized_host();
|
||||
}
|
||||
|
||||
void HTMLHyperlinkElementUtils::set_hostname(StringView hostname)
|
||||
|
||||
Reference in New Issue
Block a user