mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-12 06:02: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
|
@ -135,12 +135,12 @@ ErrorOr<Optional<URL::URL>> Response::location_url(Optional<String> const& reque
|
|||
|
||||
// 3. If location is a header value, then set location to the result of parsing location with response’s URL.
|
||||
auto location = DOMURL::parse(location_values.first(), url());
|
||||
if (!location.is_valid())
|
||||
if (!location.has_value())
|
||||
return Error::from_string_literal("Invalid 'Location' header URL");
|
||||
|
||||
// 4. If location is a URL whose fragment is null, then set location’s fragment to requestFragment.
|
||||
if (!location.fragment().has_value())
|
||||
location.set_fragment(request_fragment);
|
||||
if (!location->fragment().has_value())
|
||||
location->set_fragment(request_fragment);
|
||||
|
||||
// 5. Return location.
|
||||
return location;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue