mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 20:17:13 +02:00
AK: Port URL::m_fragment from DeprecatedString to String
This commit is contained in:
committed by
Andrew Kaster
parent
5663a2d3b4
commit
9d60f23abc
Notes:
sideshowbarker
2024-07-17 03:00:02 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/9d60f23abc Pull-request: https://github.com/SerenityOS/serenity/pull/20510 Reviewed-by: https://github.com/ADKaster ✅
@@ -442,7 +442,7 @@ WebIDL::ExceptionOr<String> URL::hash() const
|
||||
auto& vm = realm().vm();
|
||||
|
||||
// 1. If this’s URL’s 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 this’s URL’s fragment.
|
||||
@@ -469,7 +469,7 @@ void URL::set_hash(String const& hash)
|
||||
|
||||
// 3. Set this’s URL’s 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 this’s URL as url and fragment state as state override.
|
||||
auto result_url = URLParser::basic_parse(input, {}, move(url), URLParser::State::Fragment);
|
||||
|
||||
Reference in New Issue
Block a user