mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
Meta+LibURL: Always enable public suffix data
We should not encourage no public suffix data as a supported configuration.
This commit is contained in:
parent
9e7b40747f
commit
c3618b891f
Notes:
github-actions[bot]
2025-06-29 11:49:22 +00:00
Author: https://github.com/shannonbooth
Commit: c3618b891f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5242
Reviewed-by: https://github.com/tcl3 ✅
4 changed files with 24 additions and 42 deletions
|
@ -21,4 +21,3 @@ set(SOURCES
|
||||||
|
|
||||||
serenity_lib(LibURL url)
|
serenity_lib(LibURL url)
|
||||||
target_link_libraries(LibURL PRIVATE LibUnicode LibTextCodec LibRegex LibCrypto)
|
target_link_libraries(LibURL PRIVATE LibUnicode LibTextCodec LibRegex LibCrypto)
|
||||||
target_compile_definitions(LibURL PRIVATE ENABLE_PUBLIC_SUFFIX=$<BOOL:${ENABLE_PUBLIC_SUFFIX_DOWNLOAD}>)
|
|
||||||
|
|
|
@ -14,12 +14,9 @@
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/Utf8View.h>
|
#include <AK/Utf8View.h>
|
||||||
#include <LibURL/Parser.h>
|
#include <LibURL/Parser.h>
|
||||||
|
#include <LibURL/PublicSuffixData.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
|
|
||||||
#if defined(ENABLE_PUBLIC_SUFFIX)
|
|
||||||
# include <LibURL/PublicSuffixData.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace URL {
|
namespace URL {
|
||||||
|
|
||||||
Optional<URL> URL::complete_url(StringView relative_url) const
|
Optional<URL> URL::complete_url(StringView relative_url) const
|
||||||
|
@ -494,22 +491,14 @@ ByteString percent_decode(StringView input)
|
||||||
return builder.to_byte_string();
|
return builder.to_byte_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_public_suffix([[maybe_unused]] StringView host)
|
bool is_public_suffix(StringView host)
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_PUBLIC_SUFFIX)
|
|
||||||
return PublicSuffixData::the()->is_public_suffix(host);
|
return PublicSuffixData::the()->is_public_suffix(host);
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<String> get_public_suffix([[maybe_unused]] StringView host)
|
Optional<String> get_public_suffix(StringView host)
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_PUBLIC_SUFFIX)
|
|
||||||
return MUST(PublicSuffixData::the()->get_public_suffix(host));
|
return MUST(PublicSuffixData::the()->get_public_suffix(host));
|
||||||
#else
|
|
||||||
return {};
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/publicsuffix/list/wiki/Format#algorithm
|
// https://github.com/publicsuffix/list/wiki/Format#algorithm
|
||||||
|
|
|
@ -24,7 +24,6 @@ serenity_option(ENABLE_ALL_THE_DEBUG_MACROS OFF CACHE BOOL "Enable all debug mac
|
||||||
serenity_option(ENABLE_ALL_DEBUG_FACILITIES OFF CACHE BOOL "Enable all noisy debug symbols and options. Not recommended for normal developer use")
|
serenity_option(ENABLE_ALL_DEBUG_FACILITIES OFF CACHE BOOL "Enable all noisy debug symbols and options. Not recommended for normal developer use")
|
||||||
serenity_option(ENABLE_COMPILETIME_HEADER_CHECK OFF CACHE BOOL "Enable compiletime check that each library header compiles stand-alone")
|
serenity_option(ENABLE_COMPILETIME_HEADER_CHECK OFF CACHE BOOL "Enable compiletime check that each library header compiles stand-alone")
|
||||||
|
|
||||||
serenity_option(ENABLE_PUBLIC_SUFFIX_DOWNLOAD ON CACHE BOOL "Enable download of the Public Suffix List at build time")
|
|
||||||
serenity_option(INCLUDE_WASM_SPEC_TESTS OFF CACHE BOOL "Download and include the WebAssembly spec testsuite")
|
serenity_option(INCLUDE_WASM_SPEC_TESTS OFF CACHE BOOL "Download and include the WebAssembly spec testsuite")
|
||||||
serenity_option(INCLUDE_FLAC_SPEC_TESTS OFF CACHE BOOL "Download and include the FLAC spec testsuite")
|
serenity_option(INCLUDE_FLAC_SPEC_TESTS OFF CACHE BOOL "Download and include the FLAC spec testsuite")
|
||||||
serenity_option(ENABLE_CACERT_DOWNLOAD ON CACHE BOOL "Enable download of cacert.pem at build time")
|
serenity_option(ENABLE_CACERT_DOWNLOAD ON CACHE BOOL "Enable download of cacert.pem at build time")
|
||||||
|
|
|
@ -1,29 +1,24 @@
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/utils.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/utils.cmake)
|
||||||
|
|
||||||
if (ENABLE_PUBLIC_SUFFIX_DOWNLOAD)
|
set(PUBLIC_SUFFIX_PATH "${SERENITY_CACHE_DIR}/PublicSuffix" CACHE PATH "Download location for PublicSuffix files")
|
||||||
set(PUBLIC_SUFFIX_PATH "${SERENITY_CACHE_DIR}/PublicSuffix" CACHE PATH "Download location for PublicSuffix files")
|
set(PUBLIC_SUFFIX_DATA_URL "https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat")
|
||||||
set(PUBLIC_SUFFIX_DATA_URL "https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat")
|
set(PUBLIC_SUFFIX_DATA_PATH "${PUBLIC_SUFFIX_PATH}/public_suffix_list.dat")
|
||||||
set(PUBLIC_SUFFIX_DATA_PATH "${PUBLIC_SUFFIX_PATH}/public_suffix_list.dat")
|
set(PUBLIC_SUFFIX_DATA_HEADER PublicSuffixData.h)
|
||||||
|
set(PUBLIC_SUFFIX_DATA_IMPLEMENTATION PublicSuffixData.cpp)
|
||||||
set(PUBLIC_SUFFIX_DATA_HEADER PublicSuffixData.h)
|
if (ENABLE_NETWORK_DOWNLOADS)
|
||||||
set(PUBLIC_SUFFIX_DATA_IMPLEMENTATION PublicSuffixData.cpp)
|
download_file("${PUBLIC_SUFFIX_DATA_URL}" "${PUBLIC_SUFFIX_DATA_PATH}")
|
||||||
|
else()
|
||||||
if (ENABLE_NETWORK_DOWNLOADS)
|
message(STATUS "Skipping download of ${PUBLIC_SUFFIX_DATA_URL}, expecting it to be in ${PUBLIC_SUFFIX_DATA_PATH}")
|
||||||
download_file("${PUBLIC_SUFFIX_DATA_URL}" "${PUBLIC_SUFFIX_DATA_PATH}")
|
|
||||||
else()
|
|
||||||
message(STATUS "Skipping download of ${PUBLIC_SUFFIX_DATA_URL}, expecting it to be in ${PUBLIC_SUFFIX_DATA_PATH}")
|
|
||||||
endif()
|
|
||||||
invoke_cpp_generator(
|
|
||||||
"PublicSuffixData"
|
|
||||||
Lagom::GeneratePublicSuffixData
|
|
||||||
"${PUBLIC_SUFFIX_PATH}/"
|
|
||||||
"${PUBLIC_SUFFIX_DATA_HEADER}"
|
|
||||||
"${PUBLIC_SUFFIX_DATA_IMPLEMENTATION}"
|
|
||||||
arguments -p "${PUBLIC_SUFFIX_DATA_PATH}"
|
|
||||||
)
|
|
||||||
|
|
||||||
set(PUBLIC_SUFFIX_SOURCES
|
|
||||||
${PUBLIC_SUFFIX_DATA_HEADER}
|
|
||||||
${PUBLIC_SUFFIX_DATA_IMPLEMENTATION}
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
invoke_cpp_generator(
|
||||||
|
"PublicSuffixData"
|
||||||
|
Lagom::GeneratePublicSuffixData
|
||||||
|
"${PUBLIC_SUFFIX_PATH}/"
|
||||||
|
"${PUBLIC_SUFFIX_DATA_HEADER}"
|
||||||
|
"${PUBLIC_SUFFIX_DATA_IMPLEMENTATION}"
|
||||||
|
arguments -p "${PUBLIC_SUFFIX_DATA_PATH}"
|
||||||
|
)
|
||||||
|
set(PUBLIC_SUFFIX_SOURCES
|
||||||
|
${PUBLIC_SUFFIX_DATA_HEADER}
|
||||||
|
${PUBLIC_SUFFIX_DATA_IMPLEMENTATION}
|
||||||
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue