mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibURL+LibWebView: Move public suffix data to LibURL
This commit is contained in:
committed by
Andreas Kling
parent
edcdcea92d
commit
3124dca528
@@ -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