mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 14:28:49 +00:00
LibURL+LibWebView: Move public suffix data to LibURL
This commit is contained in:
parent
edcdcea92d
commit
3124dca528
Notes:
github-actions[bot]
2024-11-30 11:24:22 +00:00
Author: https://github.com/AtkinsSJ
Commit: 3124dca528
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2610
Reviewed-by: https://github.com/shannonbooth ✅
10 changed files with 36 additions and 36 deletions
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2021, Max Wipfli <mail@maxwipfli.ch>
|
||||
* Copyright (c) 2024, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -14,6 +15,10 @@
|
|||
#include <LibURL/Parser.h>
|
||||
#include <LibURL/URL.h>
|
||||
|
||||
#if defined(ENABLE_PUBLIC_SUFFIX)
|
||||
# include <LibURL/PublicSuffixData.h>
|
||||
#endif
|
||||
|
||||
namespace URL {
|
||||
|
||||
// FIXME: It could make sense to force users of URL to use URL::Parser::basic_parse() explicitly instead of using a constructor.
|
||||
|
@ -498,4 +503,22 @@ ByteString percent_decode(StringView input)
|
|||
return builder.to_byte_string();
|
||||
}
|
||||
|
||||
bool is_public_suffix([[maybe_unused]] StringView host)
|
||||
{
|
||||
#if defined(ENABLE_PUBLIC_SUFFIX)
|
||||
return PublicSuffixData::the()->is_public_suffix(host);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
Optional<String> get_public_suffix([[maybe_unused]] StringView host)
|
||||
{
|
||||
#if defined(ENABLE_PUBLIC_SUFFIX)
|
||||
return MUST(PublicSuffixData::the()->get_public_suffix(host));
|
||||
#else
|
||||
return {};
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue