From 28a47b5ba8d8f35c6e1ac9cc8dbdbec7236d7b3e Mon Sep 17 00:00:00 2001 From: PF4Public Date: Thu, 1 Aug 2024 17:50:07 +0200 Subject: [PATCH 1/2] Missing header --- build/patches/Eyeo-Adblock-for-Cromite.patch | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build/patches/Eyeo-Adblock-for-Cromite.patch b/build/patches/Eyeo-Adblock-for-Cromite.patch index 1bc8f607..e37f1e15 100644 --- a/build/patches/Eyeo-Adblock-for-Cromite.patch +++ b/build/patches/Eyeo-Adblock-for-Cromite.patch @@ -10093,4 +10093,16 @@ diff --git a/tools/typescript/definitions/adblock_private.d.ts b/tools/typescrip export interface SessionStatsEntry { url: string; count: number; +diff --git a/components/adblock/core/converter/parser/url_filter_options.h b/components/adblock/core/converter/parser/url_filter_options.h +index 3cd7fd9..1225692 100644 +--- a/components/adblock/core/converter/parser/url_filter_options.h ++++ b/components/adblock/core/converter/parser/url_filter_options.h +@@ -18,6 +18,7 @@ + #ifndef COMPONENTS_ADBLOCK_CORE_CONVERTER_PARSER_URL_FILTER_OPTIONS_H_ + #define COMPONENTS_ADBLOCK_CORE_CONVERTER_PARSER_URL_FILTER_OPTIONS_H_ + ++#include + #include + #include + #include -- From 9973f6e20f1ed79cf7b565f1aa4bdc95983c9188 Mon Sep 17 00:00:00 2001 From: uazo <29201891+uazo@users.noreply.github.com> Date: Mon, 5 Aug 2024 22:33:26 +1100 Subject: [PATCH 2/2] fixes the incorrect position of the change using the latest version of the patch --- build/patches/Eyeo-Adblock-for-Cromite.patch | 66 +++++++++----------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/build/patches/Eyeo-Adblock-for-Cromite.patch b/build/patches/Eyeo-Adblock-for-Cromite.patch index e37f1e15..602211f0 100644 --- a/build/patches/Eyeo-Adblock-for-Cromite.patch +++ b/build/patches/Eyeo-Adblock-for-Cromite.patch @@ -12,8 +12,8 @@ deactivation of all pop-ups (default disabled) --- .../android/java/res/xml/main_preferences.xml | 19 +- chrome/browser/BUILD.gn | 2 - - .../adblock/adblock_content_browser_client.cc | 291 +- - .../adblock/adblock_content_browser_client.h | 54 +- + .../adblock/adblock_content_browser_client.cc | 283 +- + .../adblock/adblock_content_browser_client.h | 46 +- .../browser/chrome_content_browser_client.cc | 6 +- .../browser/chrome_content_browser_client.h | 6 +- .../adblock_private/adblock_private_api.cc | 74 +- @@ -85,6 +85,7 @@ deactivation of all pop-ups (default disabled) .../core/converter/parser/test/test_rules.txt | 21 + .../core/converter/parser/url_filter.cc | 10 +- .../converter/parser/url_filter_options.cc | 21 +- + .../converter/parser/url_filter_options.h | 1 + .../serializer/flatbuffer_serializer.cc | 82 +- components/adblock/core/features.cc | 3 +- components/adblock/core/hash/schema_hash.h | 10 + @@ -130,7 +131,7 @@ deactivation of all pop-ups (default disabled) .../blink/renderer/core/css/style_engine.h | 1 + .../renderer/core/exported/web_document.cc | 15 +- .../definitions/adblock_private.d.ts | 14 + - 120 files changed, 6147 insertions(+), 1309 deletions(-) + 121 files changed, 6140 insertions(+), 1301 deletions(-) create mode 100644 chrome/browser/resources/settings/adblock_page/adblock_page.html create mode 100644 chrome/browser/resources/settings/adblock_page/adblock_page.ts rename components/adblock/android/java/res/xml/{adblock_preferences.xml => eyeo_adblock_preferences.xml} (56%) @@ -350,8 +351,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b const GURL& url, + const url::Origin& initiator_origin, const net::SiteForCookies& site_for_cookies, -- const absl::optional& user_agent, -+ const std::optional& user_agent, + const std::optional& user_agent, mojo::PendingRemote handshake_client) { - if (IsFilteringNeeded(frame)) { @@ -378,8 +378,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b const GURL& url, + const url::Origin& initiator_origin, const net::SiteForCookies& site_for_cookies, -- const absl::optional& user_agent, -+ const std::optional& user_agent, + const std::optional& user_agent, mojo::PendingRemote handshake_client) { - auto* frame = content::RenderFrameHost::FromID(render_frame_host_id); @@ -413,8 +412,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b const GURL& url, + const url::Origin& initiator_origin, const net::SiteForCookies& site_for_cookies, -- const absl::optional& user_agent, -+ const std::optional& user_agent, + const std::optional& user_agent, mojo::PendingRemote handshake_client, adblock::FilterMatchResult result) { @@ -563,9 +561,8 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b int render_process_id, URLLoaderFactoryType type, const url::Origin& request_initiator, -- absl::optional navigation_id, + const net::IsolationInfo& isolation_info, -+ std::optional navigation_id, + std::optional navigation_id, ukm::SourceIdObj ukm_source_id, - mojo::PendingReceiver* factory_receiver, + network::URLLoaderFactoryBuilder& factory_builder, @@ -643,8 +640,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.h b/chrome/br const GURL& url, + const url::Origin& initiator_origin, const net::SiteForCookies& site_for_cookies, -- const absl::optional& user_agent, -+ const std::optional& user_agent, + const std::optional& user_agent, mojo::PendingRemote handshake_client) override; @@ -664,9 +660,8 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.h b/chrome/br int render_process_id, URLLoaderFactoryType type, const url::Origin& request_initiator, -- absl::optional navigation_id, + const net::IsolationInfo& isolation_info, -+ std::optional navigation_id, + std::optional navigation_id, ukm::SourceIdObj ukm_source_id, - mojo::PendingReceiver* factory_receiver, + network::URLLoaderFactoryBuilder& factory_builder, @@ -699,8 +694,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.h b/chrome/br const GURL& url, + const url::Origin& initiator_origin, const net::SiteForCookies& site_for_cookies, -- const absl::optional& user_agent, -+ const std::optional& user_agent, + const std::optional& user_agent, mojo::PendingRemote handshake_client); void OnWebSocketFilterCheckCompleted( @@ -710,8 +704,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.h b/chrome/br const GURL& url, + const url::Origin& initiator_origin, const net::SiteForCookies& site_for_cookies, -- const absl::optional& user_agent, -+ const std::optional& user_agent, + const std::optional& user_agent, mojo::PendingRemote handshake_client, adblock::FilterMatchResult result); @@ -854,7 +847,7 @@ diff --git a/chrome/browser/extensions/api/adblock_private/adblock_private_api.c +AdblockPrivateSetPrivilegedFiltersEnabledFunction::~AdblockPrivateSetPrivilegedFiltersEnabledFunction() {} + +ExtensionFunction::ResponseAction AdblockPrivateSetPrivilegedFiltersEnabledFunction::Run() { -+ absl::optional params = ++ std::optional params = + api::adblock_private::SetEnabled::Params::Create(args()); + EXTENSION_FUNCTION_VALIDATE(params); + @@ -4357,7 +4350,7 @@ diff --git a/components/adblock/core/converter/flatbuffer_converter.cc b/compone diff --git a/components/adblock/core/converter/parser/metadata.cc b/components/adblock/core/converter/parser/metadata.cc --- a/components/adblock/core/converter/parser/metadata.cc +++ b/components/adblock/core/converter/parser/metadata.cc -@@ -58,13 +58,6 @@ absl::optional Metadata::FromStream(std::istream& filter_stream) { +@@ -58,13 +58,6 @@ std::optional Metadata::FromStream(std::istream& filter_stream) { if (key == "homepage") { homepage = value; } else if (key == "redirect") { @@ -4428,7 +4421,7 @@ diff --git a/components/adblock/core/converter/parser/url_filter.cc b/components piece.remove_suffix(1); } if (piece.find('|') == base::StringPiece::npos) { -@@ -108,21 +112,21 @@ absl::optional UrlFilter::FromString(std::string filter_str) { +@@ -108,21 +112,21 @@ std::optional UrlFilter::FromString(std::string filter_str) { if (options->Csp().has_value() && options->Csp().value().empty() && !is_allowing) { @@ -4456,7 +4449,7 @@ diff --git a/components/adblock/core/converter/parser/url_filter.cc b/components diff --git a/components/adblock/core/converter/parser/url_filter_options.cc b/components/adblock/core/converter/parser/url_filter_options.cc --- a/components/adblock/core/converter/parser/url_filter_options.cc +++ b/components/adblock/core/converter/parser/url_filter_options.cc -@@ -88,20 +88,14 @@ absl::optional UrlFilterOptions::FromString( +@@ -88,20 +88,14 @@ std::optional UrlFilterOptions::FromString( } domains = DomainOption::FromString(value, kDomainOrSitekeySeparator); } else if (key == "sitekey") { @@ -4483,7 +4476,7 @@ diff --git a/components/adblock/core/converter/parser/url_filter_options.cc b/co } else { ContentType content_type = ContentTypeFromString(key); if (content_type != ContentType::Unknown) { -@@ -184,6 +178,7 @@ absl::optional UrlFilterOptions::ParseRewrite( +@@ -184,6 +178,7 @@ std::optional UrlFilterOptions::ParseRewrite( // static SiteKeys UrlFilterOptions::ParseSitekeys(const std::string& sitekey_value) { SiteKeys sitekeys; @@ -4507,6 +4500,17 @@ diff --git a/components/adblock/core/converter/parser/url_filter_options.cc b/co // replace \x2c with actual , static re2::RE2 r1("([^\\\\])\\\\x2c"); re2::RE2::GlobalReplace(&headers_value, r1, "\\1,"); +diff --git a/components/adblock/core/converter/parser/url_filter_options.h b/components/adblock/core/converter/parser/url_filter_options.h +--- a/components/adblock/core/converter/parser/url_filter_options.h ++++ b/components/adblock/core/converter/parser/url_filter_options.h +@@ -18,6 +18,7 @@ + #ifndef COMPONENTS_ADBLOCK_CORE_CONVERTER_PARSER_URL_FILTER_OPTIONS_H_ + #define COMPONENTS_ADBLOCK_CORE_CONVERTER_PARSER_URL_FILTER_OPTIONS_H_ + ++#include + #include + #include + #include diff --git a/components/adblock/core/converter/serializer/flatbuffer_serializer.cc b/components/adblock/core/converter/serializer/flatbuffer_serializer.cc --- a/components/adblock/core/converter/serializer/flatbuffer_serializer.cc +++ b/components/adblock/core/converter/serializer/flatbuffer_serializer.cc @@ -4663,7 +4667,7 @@ diff --git a/components/adblock/core/sitekey_storage_impl.cc b/components/adbloc return; @@ -53,6 +55,7 @@ void SitekeyStorageImpl::ProcessResponseHeaders( - absl::optional> + std::optional> SitekeyStorageImpl::FindSiteKeyForAnyUrl(const std::vector& urls) const { + if ((true)) return {}; DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -10093,16 +10097,4 @@ diff --git a/tools/typescript/definitions/adblock_private.d.ts b/tools/typescrip export interface SessionStatsEntry { url: string; count: number; -diff --git a/components/adblock/core/converter/parser/url_filter_options.h b/components/adblock/core/converter/parser/url_filter_options.h -index 3cd7fd9..1225692 100644 ---- a/components/adblock/core/converter/parser/url_filter_options.h -+++ b/components/adblock/core/converter/parser/url_filter_options.h -@@ -18,6 +18,7 @@ - #ifndef COMPONENTS_ADBLOCK_CORE_CONVERTER_PARSER_URL_FILTER_OPTIONS_H_ - #define COMPONENTS_ADBLOCK_CORE_CONVERTER_PARSER_URL_FILTER_OPTIONS_H_ - -+#include - #include - #include - #include --