mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibURL+LibWebView: Move public suffix data to LibURL
This commit is contained in:
committed by
Andreas Kling
parent
edcdcea92d
commit
3124dca528
Notes:
github-actions[bot]
2024-11-30 11:24:22 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/3124dca528e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2610 Reviewed-by: https://github.com/shannonbooth ✅
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user