mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 09:52:31 +00:00
LibURL: Replace use of URL::get_public_suffix
It is confusing to have both URL::Host::public_suffix and URL:get_public_suffix, both with slightly different semantics. Instead, use PublicSuffixData for cases that just want a direct match against the list, and URL::Host::public_suffix in LibWeb land as the URL spec defined AO.
This commit is contained in:
parent
e6ecafea84
commit
a2b523eeb8
Notes:
github-actions[bot]
2025-06-29 11:49:11 +00:00
Author: https://github.com/shannonbooth
Commit: a2b523eeb8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5242
Reviewed-by: https://github.com/tcl3 ✅
5 changed files with 9 additions and 13 deletions
|
@ -496,16 +496,11 @@ bool is_public_suffix(StringView host)
|
|||
return PublicSuffixData::the()->is_public_suffix(host);
|
||||
}
|
||||
|
||||
Optional<String> get_public_suffix(StringView host)
|
||||
{
|
||||
return PublicSuffixData::the()->get_public_suffix(host);
|
||||
}
|
||||
|
||||
// https://github.com/publicsuffix/list/wiki/Format#algorithm
|
||||
Optional<String> get_registrable_domain(StringView host)
|
||||
{
|
||||
// The registered or registrable domain is the public suffix plus one additional label.
|
||||
auto public_suffix = get_public_suffix(host);
|
||||
auto public_suffix = PublicSuffixData::the()->get_public_suffix(host);
|
||||
if (!public_suffix.has_value() || !host.ends_with(*public_suffix))
|
||||
return {};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue