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

@ -86,7 +86,7 @@ void URL::set_host(Host host)
}
// https://url.spec.whatwg.org/#concept-host-serializer
ErrorOr<String> URL::serialized_host() const
String URL::serialized_host() const
{
return m_data->host->serialize();
}
@ -273,7 +273,7 @@ ByteString URL::serialize(ExcludeFragment exclude_fragment) const
}
// 3. Append urls host, serialized, to output.
output.append(serialized_host().release_value_but_fixme_should_propagate_errors());
output.append(serialized_host());
// 4. If urls port is non-null, append U+003A (:) followed by urls port, serialized, to output.
if (m_data->port.has_value())
@ -324,7 +324,7 @@ ByteString URL::serialize_for_display() const
if (m_data->host.has_value()) {
builder.append("//"sv);
builder.append(serialized_host().release_value_but_fixme_should_propagate_errors());
builder.append(serialized_host());
if (m_data->port.has_value())
builder.appendff(":{}", *m_data->port);
}