mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-07 17:15:26 +00:00
LibURL: Clarify whether an Origin is opaque
Origins are immutable and we know on construction whether an Origin is opaque. This also removes an implicit reliance on Host's Empty state.
This commit is contained in:
committed by
Andreas Kling
parent
3124dca528
commit
8b984c0c57
@@ -119,9 +119,14 @@ ErrorOr<void> encode(Encoder& encoder, URL::URL const& value)
|
||||
template<>
|
||||
ErrorOr<void> encode(Encoder& encoder, URL::Origin const& origin)
|
||||
{
|
||||
TRY(encoder.encode<ByteString>(origin.scheme()));
|
||||
TRY(encoder.encode(origin.host()));
|
||||
TRY(encoder.encode(origin.port()));
|
||||
if (origin.is_opaque()) {
|
||||
TRY(encoder.encode(true));
|
||||
} else {
|
||||
TRY(encoder.encode(false));
|
||||
TRY(encoder.encode<ByteString>(origin.scheme()));
|
||||
TRY(encoder.encode(origin.host()));
|
||||
TRY(encoder.encode(origin.port()));
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user