mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
AK+Everywhere: Use Optional for URLParser::parse's base_url parameter
This commit is contained in:
parent
38bdf4d159
commit
9915fa72fb
12 changed files with 31 additions and 32 deletions
|
@ -113,8 +113,7 @@ ErrorOr<Optional<AK::URL>> Response::location_url(Optional<String> const& reques
|
|||
return Optional<AK::URL> {};
|
||||
|
||||
// 3. If location is a header value, then set location to the result of parsing location with response’s URL.
|
||||
auto base_url = *url();
|
||||
auto location = AK::URLParser::parse(location_values.first(), &base_url);
|
||||
auto location = AK::URLParser::parse(location_values.first(), url());
|
||||
if (!location.is_valid())
|
||||
return Error::from_string_view("Invalid 'Location' header URL"sv);
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> Request::construct_impl(JS::Realm
|
|||
// 5. If input is a string, then:
|
||||
if (input.has<String>()) {
|
||||
// 1. Let parsedURL be the result of parsing input with baseURL.
|
||||
auto parsed_url = URLParser::parse(input.get<String>(), &base_url);
|
||||
auto parsed_url = URLParser::parse(input.get<String>(), base_url);
|
||||
|
||||
// 2. If parsedURL is failure, then throw a TypeError.
|
||||
if (!parsed_url.is_valid())
|
||||
|
@ -299,7 +299,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> Request::construct_impl(JS::Realm
|
|||
// 3. Otherwise:
|
||||
else {
|
||||
// 1. Let parsedReferrer be the result of parsing referrer with baseURL.
|
||||
auto parsed_referrer = URLParser::parse(referrer, &base_url);
|
||||
auto parsed_referrer = URLParser::parse(referrer, base_url);
|
||||
|
||||
// 2. If parsedReferrer is failure, then throw a TypeError.
|
||||
if (!parsed_referrer.is_valid())
|
||||
|
|
|
@ -174,7 +174,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Response>> Response::redirect(JS::VM& vm, S
|
|||
|
||||
// 1. Let parsedURL be the result of parsing url with current settings object’s API base URL.
|
||||
auto api_base_url = HTML::current_settings_object().api_base_url();
|
||||
auto parsed_url = URLParser::parse(url, &api_base_url);
|
||||
auto parsed_url = URLParser::parse(url, api_base_url);
|
||||
|
||||
// 2. If parsedURL is failure, then throw a TypeError.
|
||||
if (!parsed_url.is_valid())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue