mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
AK+Everywhere: Add ApplyPercentDecoding option to URL getters
The defaults selected for this are based on the behaviour of URL when it applied percent decoding during parsing. This does mean now in some cases the getters will allocate, but percent_decode() checks if there's anything to decode first, so in many cases still won't.
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 02:28:18 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/5acd40c525 Pull-request: https://github.com/SerenityOS/serenity/pull/18341 Reviewed-by: https://github.com/awesomekling
@@ -147,7 +147,7 @@ WebIDL::ExceptionOr<void> URL::set_href(String const& href)
|
||||
m_query->m_list.clear();
|
||||
|
||||
// 5. Let query be this’s URL’s query.
|
||||
auto& query = m_url.query();
|
||||
auto query = m_url.query();
|
||||
|
||||
// 6. If query is non-null, then set this’s query object’s list to the result of parsing query.
|
||||
if (!query.is_null())
|
||||
@@ -203,7 +203,7 @@ void URL::set_username(String const& username)
|
||||
return;
|
||||
|
||||
// 2. Set the username given this’s URL and the given value.
|
||||
m_url.set_username(AK::URL::percent_encode(username, AK::URL::PercentEncodeSet::Userinfo));
|
||||
m_url.set_username(username.to_deprecated_string(), AK::URL::ApplyPercentEncoding::Yes);
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-password
|
||||
@@ -223,7 +223,7 @@ void URL::set_password(String const& password)
|
||||
return;
|
||||
|
||||
// 2. Set the password given this’s URL and the given value.
|
||||
m_url.set_password(AK::URL::percent_encode(password, AK::URL::PercentEncodeSet::Userinfo));
|
||||
m_url.set_password(password.to_deprecated_string(), AK::URL::ApplyPercentEncoding::Yes);
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-host
|
||||
|
||||
Reference in New Issue
Block a user