mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +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:
parent
3124dca528
commit
8b984c0c57
Notes:
github-actions[bot]
2024-11-30 11:24:16 +00:00
Author: https://github.com/AtkinsSJ
Commit: 8b984c0c57
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2610
Reviewed-by: https://github.com/shannonbooth ✅
4 changed files with 40 additions and 19 deletions
|
@ -42,13 +42,15 @@ namespace AK {
|
|||
|
||||
unsigned Traits<URL::Origin>::hash(URL::Origin const& origin)
|
||||
{
|
||||
if (origin.is_opaque())
|
||||
return 0;
|
||||
|
||||
unsigned hash = origin.scheme().hash();
|
||||
|
||||
if (origin.port().has_value())
|
||||
hash = pair_int_hash(hash, *origin.port());
|
||||
|
||||
if (!origin.host().has<Empty>())
|
||||
hash = pair_int_hash(hash, URL::Parser::serialize_host(origin.host()).release_value_but_fixme_should_propagate_errors().hash());
|
||||
hash = pair_int_hash(hash, URL::Parser::serialize_host(origin.host()).release_value_but_fixme_should_propagate_errors().hash());
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue