mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 07:18:51 +00:00
LibWeb: Return OptionalNone from DOMURL::parse on failure
This ports one more function away from needing to use the awkward valid state of the URL class.
This commit is contained in:
parent
b81d6945dc
commit
fd27eef0d1
Notes:
github-actions[bot]
2025-01-22 12:34:57 +00:00
Author: https://github.com/shannonbooth
Commit: fd27eef0d1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3339
Reviewed-by: https://github.com/AtkinsSJ ✅
18 changed files with 63 additions and 65 deletions
|
@ -205,7 +205,7 @@ URL::URL EnvironmentSettingsObject::parse_url(StringView url)
|
|||
auto base_url = api_base_url();
|
||||
|
||||
// 2. Return the result of applying the URL parser to url, with baseURL.
|
||||
return DOMURL::parse(url, base_url);
|
||||
return DOMURL::parse(url, base_url).value_or(URL::URL {});
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#encoding-parsing-a-url
|
||||
|
@ -225,7 +225,7 @@ URL::URL EnvironmentSettingsObject::encoding_parse_url(StringView url)
|
|||
auto base_url = api_base_url();
|
||||
|
||||
// 5. Return the result of applying the URL parser to url, with baseURL and encoding.
|
||||
return DOMURL::parse(url, base_url, encoding);
|
||||
return DOMURL::parse(url, base_url, encoding).value_or(URL::URL {});
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#encoding-parsing-and-serializing-a-url
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue