mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-27 20:52:01 +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
|
@ -186,7 +186,7 @@ WebIDL::ExceptionOr<GC::Ref<Response>> Response::redirect(JS::VM& vm, String con
|
|||
auto parsed_url = DOMURL::parse(url, api_base_url);
|
||||
|
||||
// 2. If parsedURL is failure, then throw a TypeError.
|
||||
if (!parsed_url.is_valid())
|
||||
if (!parsed_url.has_value())
|
||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Redirect URL is not valid"sv };
|
||||
|
||||
// 3. If status is not a redirect status, then throw a RangeError.
|
||||
|
@ -201,7 +201,7 @@ WebIDL::ExceptionOr<GC::Ref<Response>> Response::redirect(JS::VM& vm, String con
|
|||
response_object->response()->set_status(status);
|
||||
|
||||
// 6. Let value be parsedURL, serialized and isomorphic encoded.
|
||||
auto value = parsed_url.serialize();
|
||||
auto value = parsed_url->serialize();
|
||||
|
||||
// 7. Append (`Location`, value) to responseObject’s response’s header list.
|
||||
auto header = Infrastructure::Header::from_string_pair("Location"sv, value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue