1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 18:57:36 +00:00

AK: Remove URL::ApplyPercentEncoding

Everywhere only ever expects percent encoding to occur, so let's just
remove this flag altogether. At the same time, replace some
DeprecatedString with StringView.
This commit is contained in:
Shannon Booth 2023-08-06 16:32:44 +12:00 committed by Andreas Kling
parent c4d7be100e
commit 98666b012d
6 changed files with 30 additions and 45 deletions

View file

@ -506,7 +506,7 @@ WebIDL::ExceptionOr<Document*> Document::open(DeprecatedString const&, Deprecate
auto new_url = entry_document.url();
// 2. If entryDocument is not document, then set newURL's fragment to null.
if (&entry_document != this)
new_url.set_fragment("");
new_url.set_fragment({});
// FIXME: 3. Run the URL and history update steps with document and newURL.
}

View file

@ -309,7 +309,7 @@ WebIDL::ExceptionOr<void> Location::set_hash(String const& value)
auto input = value.bytes_as_string_view().trim("#"sv, TrimMode::Left);
// 5. Set copyURL's fragment to the empty string.
copy_url.set_fragment("");
copy_url.set_fragment(""sv);
// 6. Basic URL parse input, with copyURL as url and fragment state as state override.
auto result_url = URLParser::basic_parse(input, {}, copy_url, URLParser::State::Fragment);

View file

@ -237,7 +237,7 @@ void URL::set_username(String const& username)
return;
// 2. Set the username given thiss URL and the given value.
m_url.set_username(username.to_deprecated_string(), AK::URL::ApplyPercentEncoding::Yes);
m_url.set_username(username);
}
// https://url.spec.whatwg.org/#dom-url-password
@ -257,7 +257,7 @@ void URL::set_password(String const& password)
return;
// 2. Set the password given thiss URL and the given value.
m_url.set_password(password.to_deprecated_string(), AK::URL::ApplyPercentEncoding::Yes);
m_url.set_password(password);
}
// https://url.spec.whatwg.org/#dom-url-host

View file

@ -65,7 +65,7 @@ public:
WebIDL::ExceptionOr<String> to_json() const;
void set_query(Badge<URLSearchParams>, String query) { m_url.set_query(query.to_deprecated_string(), AK::URL::ApplyPercentEncoding::Yes); }
void set_query(Badge<URLSearchParams>, StringView query) { m_url.set_query(query); }
private:
URL(JS::Realm&, AK::URL, JS::NonnullGCPtr<URLSearchParams> query);