AK: Make String::number() infallible

This API will always succeed in creating a String representing the
provided number in base-10.
This commit is contained in:
Andreas Kling 2024-10-14 10:05:01 +02:00 committed by Andreas Kling
parent 03569fc509
commit dd419b5a8d
Notes: github-actions[bot] 2024-10-14 18:49:07 +00:00
46 changed files with 77 additions and 81 deletions

View file

@ -78,8 +78,6 @@ WebIDL::ExceptionOr<String> WorkerLocation::hostname() const
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-port
WebIDL::ExceptionOr<String> WorkerLocation::port() const
{
auto& vm = realm().vm();
// The port getter steps are:
// 1. Let port be this's WorkerGlobalScope object's url's port.
auto const& port = m_global_scope->url().port();
@ -88,7 +86,7 @@ WebIDL::ExceptionOr<String> WorkerLocation::port() const
if (!port.has_value())
return String {};
// 3. Return port, serialized.
return TRY_OR_THROW_OOM(vm, String::number(port.value()));
return String::number(port.value());
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-pathname