1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:57:44 +00:00

AK: Port URL::m_fragment from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-08-12 16:52:42 +12:00 committed by Andrew Kaster
parent 5663a2d3b4
commit 9d60f23abc
21 changed files with 68 additions and 76 deletions

View file

@ -1077,9 +1077,7 @@ WebIDL::ExceptionOr<Optional<JS::NonnullGCPtr<PendingResponse>>> http_redirect_f
: static_cast<Infrastructure::FilteredResponse const&>(response).internal_response();
// 3. Let locationURL be actualResponses location URL given requests current URLs fragment.
auto const& fragment = request->current_url().fragment();
auto fragment_string = fragment.is_null() ? Optional<String> {} : TRY_OR_THROW_OOM(vm, String::from_deprecated_string(fragment));
auto location_url_or_error = actual_response->location_url(fragment_string);
auto location_url_or_error = actual_response->location_url(request->current_url().fragment());
// 4. If locationURL is null, then return response.
if (!location_url_or_error.is_error() && !location_url_or_error.value().has_value())

View file

@ -118,8 +118,8 @@ ErrorOr<Optional<AK::URL>> Response::location_url(Optional<String> const& reques
return Error::from_string_view("Invalid 'Location' header URL"sv);
// 4. If location is a URL whose fragment is null, then set locations fragment to requestFragment.
if (location.fragment().is_null())
location.set_fragment(request_fragment.has_value() ? request_fragment->to_deprecated_string() : DeprecatedString {});
if (!location.fragment().has_value())
location.set_fragment(request_fragment);
// 5. Return location.
return location;