LibURL: Make URL::serialized_host() infallible

This can no longer fail, so update the return type to match.

This makes a few more methods now unable to return errors, but one thing
at a time. 😅
This commit is contained in:
Sam Atkins 2024-11-28 14:32:07 +00:00 committed by Andreas Kling
commit 900c131178
Notes: github-actions[bot] 2024-11-30 11:23:28 +00:00
13 changed files with 47 additions and 51 deletions

View file

@ -51,10 +51,10 @@ WebIDL::ExceptionOr<String> WorkerLocation::host() const
// 3. If url's port is null, return url's host, serialized.
if (!url.port().has_value())
return TRY_OR_THROW_OOM(vm, url.serialized_host());
return url.serialized_host();
// 4. Return url's host, serialized, followed by ":" and url's port, serialized.
return TRY_OR_THROW_OOM(vm, String::formatted("{}:{}", TRY_OR_THROW_OOM(vm, url.serialized_host()), url.port().value()));
return TRY_OR_THROW_OOM(vm, String::formatted("{}:{}", url.serialized_host(), url.port().value()));
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-hostname