mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +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:
committed by
Sam Atkins
parent
b81d6945dc
commit
fd27eef0d1
@@ -1128,7 +1128,7 @@ URL::URL Document::parse_url(StringView url) const
|
||||
auto base_url = this->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
|
||||
@@ -1145,7 +1145,7 @@ URL::URL Document::encoding_parse_url(StringView url) const
|
||||
auto base_url = this->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
|
||||
|
||||
Reference in New Issue
Block a user