mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:38:13 +00:00
LibWebView+LibPublicSuffix: Merge LibPublicSuffix into LibWebView
After d2c7e1ea7d
, there is now only one
user of LibPublicSuffix - the URL sanitation utility within LibWebView.
Rather than having an entire library for the small Public Suffix data
accessor, merge it into LibWebView.
This commit is contained in:
parent
a1cce69db0
commit
a8f0fa5dd4
11 changed files with 57 additions and 87 deletions
|
@ -427,7 +427,6 @@ if (BUILD_LAGOM)
|
|||
Markdown
|
||||
PDF
|
||||
Protocol
|
||||
PublicSuffix
|
||||
Regex
|
||||
SoftGPU
|
||||
SQL
|
||||
|
|
|
@ -6,8 +6,8 @@ endif()
|
|||
add_subdirectory(LibEDID)
|
||||
add_subdirectory(LibGL)
|
||||
add_subdirectory(LibLocale)
|
||||
add_subdirectory(LibPublicSuffix)
|
||||
add_subdirectory(LibTimeZone)
|
||||
add_subdirectory(LibUnicode)
|
||||
add_subdirectory(LibWeb)
|
||||
add_subdirectory(LibWebView)
|
||||
add_subdirectory(StateMachineGenerator)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
lagom_tool(GeneratePublicSuffixData SOURCES GeneratePublicSuffixData.cpp LIBS LibMain)
|
|
@ -0,0 +1 @@
|
|||
lagom_tool(GeneratePublicSuffixData SOURCES GeneratePublicSuffixData.cpp LIBS LibMain)
|
|
@ -48,7 +48,7 @@ ErrorOr<void> generate_header_file(Core::InputBufferedFile&, Core::File& file)
|
|||
#include <AK/Forward.h>
|
||||
#include <AK/Trie.h>
|
||||
|
||||
namespace PublicSuffix {
|
||||
namespace WebView {
|
||||
|
||||
class PublicSuffixData {
|
||||
protected:
|
||||
|
@ -72,7 +72,7 @@ private:
|
|||
Trie<char, DeprecatedString> m_dictionary;
|
||||
};
|
||||
|
||||
} // namespace PublicSuffix
|
||||
}
|
||||
|
||||
)~~~");
|
||||
|
||||
|
@ -85,11 +85,11 @@ ErrorOr<void> generate_implementation_file(Core::InputBufferedFile& input, Core:
|
|||
StringBuilder builder;
|
||||
SourceGenerator generator { builder };
|
||||
generator.append(R"~~~(
|
||||
#include <LibPublicSuffix/PublicSuffixData.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibWebView/PublicSuffixData.h>
|
||||
|
||||
namespace PublicSuffix {
|
||||
namespace WebView {
|
||||
|
||||
static Vector<StringView> s_public_suffixes {)~~~");
|
||||
|
||||
|
@ -121,7 +121,7 @@ PublicSuffixData::PublicSuffixData()
|
|||
{
|
||||
// FIXME: Reduce the depth of this trie
|
||||
for (auto str : s_public_suffixes) {
|
||||
MUST(m_dictionary.insert(str.begin(), str.end(), str, [](auto& parent, auto& it) -> Optional<DeprecatedString> {
|
||||
MUST(m_dictionary.insert(str.begin(), str.end(), str, [](auto& parent, auto& it) -> Optional<DeprecatedString> {
|
||||
return DeprecatedString::formatted("{}{}", parent.metadata_value(), *it);
|
||||
}));
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ ErrorOr<Optional<String>> PublicSuffixData::get_public_suffix(StringView string)
|
|||
return Optional<String> {};
|
||||
}
|
||||
|
||||
} // namespace PublicSuffix
|
||||
}
|
||||
|
||||
)~~~");
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue