1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:57:42 +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

@ -442,7 +442,7 @@ WebIDL::ExceptionOr<String> URL::hash() const
auto& vm = realm().vm();
// 1. If thiss URLs fragment is either null or the empty string, then return the empty string.
if (m_url.fragment().is_null() || m_url.fragment().is_empty())
if (!m_url.fragment().has_value() || m_url.fragment()->is_empty())
return String {};
// 2. Return U+0023 (#), followed by thiss URLs fragment.
@ -469,7 +469,7 @@ void URL::set_hash(String const& hash)
// 3. Set thiss URLs fragment to the empty string.
auto url = m_url; // We copy the URL here to follow other browser's behavior of reverting the hash change if the parse failed.
url.set_fragment(DeprecatedString::empty());
url.set_fragment(String {});
// 4. Basic URL parse input with thiss URL as url and fragment state as state override.
auto result_url = URLParser::basic_parse(input, {}, move(url), URLParser::State::Fragment);