1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18:12 +00:00

AK: Port URL username/password from DeprecatedString to String

And for cases that just need to check whether the password/username is
empty, add a raw_{password,username} helper to avoid any allocation.
This commit is contained in:
Shannon Booth 2023-08-12 16:52:38 +12:00 committed by Andrew Kaster
parent 6b29dc3e46
commit 55a01e72ca
11 changed files with 44 additions and 39 deletions

View file

@ -224,7 +224,7 @@ WebIDL::ExceptionOr<String> URL::username() const
auto& vm = realm().vm();
// The username getter steps are to return thiss URLs username.
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_url.username()));
return TRY_OR_THROW_OOM(vm, m_url.username());
}
// https://url.spec.whatwg.org/#ref-for-dom-url-username%E2%91%A0
@ -235,7 +235,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);
MUST(m_url.set_username(username));
}
// https://url.spec.whatwg.org/#dom-url-password
@ -244,7 +244,7 @@ WebIDL::ExceptionOr<String> URL::password() const
auto& vm = realm().vm();
// The password getter steps are to return thiss URLs password.
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_url.password()));
return TRY_OR_THROW_OOM(vm, m_url.password());
}
// https://url.spec.whatwg.org/#ref-for-dom-url-password%E2%91%A0
@ -255,7 +255,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);
MUST(m_url.set_password(password));
}
// https://url.spec.whatwg.org/#dom-url-host