From da4ccbd269facfce83e2d34ae062b84e244dce9c Mon Sep 17 00:00:00 2001 From: Eloston Date: Tue, 17 Apr 2018 17:35:28 +0000 Subject: [PATCH] WIP rewrite of trk and qjz9zk request blocking Add block-trk-and-substituted-domains-in-urlrequest.patch, which is a union and rewrite of several other patches. The patch works except for requests intercepted by URLRequest, which causes the tab process to crash with SEGV_MAPERR. --- .../config_bundles/common/patch_order.list | 7 +- .../inox-patchset/chromium-vaapi-r16.patch | 8 +- ...me-and-help-identify-URLs-being-retr.patch | 561 --------------- ...dd-flag-for-search-engine-collection.patch | 24 +- ...g-to-configure-extension-downloading.patch | 18 +- .../add-flag-to-disable-trkbar.patch | 130 ---- ...tentially-annoying-security-features.patch | 2 +- ...add-flag-to-force-punycode-hostnames.patch | 2 +- .../add-flag-to-stack-tabs.patch | 8 +- ...nd-substituted-domains-in-urlrequest.patch | 641 ++++++++++++++++++ .../change-trace-infobar-message.patch | 13 - .../clear-http-auth-cache-menu-item.patch | 24 +- .../disable-logging-urls-to-stderr.patch | 63 -- .../disable-mei-preload.patch | 4 +- .../intercept-all-modified-domains.patch | 57 -- .../prevent-trace-url-requests.patch | 48 -- 16 files changed, 687 insertions(+), 923 deletions(-) delete mode 100644 resources/patches/iridium-browser/net-add-trk-scheme-and-help-identify-URLs-being-retr.patch delete mode 100644 resources/patches/ungoogled-chromium/add-flag-to-disable-trkbar.patch create mode 100644 resources/patches/ungoogled-chromium/block-trk-and-substituted-domains-in-urlrequest.patch delete mode 100644 resources/patches/ungoogled-chromium/change-trace-infobar-message.patch delete mode 100644 resources/patches/ungoogled-chromium/disable-logging-urls-to-stderr.patch delete mode 100644 resources/patches/ungoogled-chromium/intercept-all-modified-domains.patch delete mode 100644 resources/patches/ungoogled-chromium/prevent-trace-url-requests.patch diff --git a/resources/config_bundles/common/patch_order.list b/resources/config_bundles/common/patch_order.list index c4ecc137..f52b0cba 100644 --- a/resources/config_bundles/common/patch_order.list +++ b/resources/config_bundles/common/patch_order.list @@ -51,7 +51,6 @@ iridium-browser/prefs-only-keep-cookies-until-exit.patch iridium-browser/prefs-always-prompt-for-download-directory-by-defaul.patch iridium-browser/updater-disable-auto-update.patch iridium-browser/Remove-EV-certificates.patch -iridium-browser/net-add-trk-scheme-and-help-identify-URLs-being-retr.patch iridium-browser/safe_browsing-disable-incident-reporting.patch iridium-browser/safe_browsing-disable-reporting-of-safebrowsing-over.patch iridium-browser/safe_browsing-support-trk-prefix.patch @@ -67,22 +66,18 @@ ungoogled-chromium/replace-google-search-engine-with-nosearch.patch ungoogled-chromium/disable-signin.patch ungoogled-chromium/disable-translate.patch ungoogled-chromium/popups-to-tabs.patch -ungoogled-chromium/prevent-trace-url-requests.patch ungoogled-chromium/disable-untraceable-urls.patch ungoogled-chromium/add-ipv6-probing-option.patch ungoogled-chromium/disable-profile-avatar-downloading.patch ungoogled-chromium/remove-disable-setuid-sandbox-as-bad-flag.patch -ungoogled-chromium/disable-logging-urls-to-stderr.patch -ungoogled-chromium/change-trace-infobar-message.patch ungoogled-chromium/disable-gcm.patch ungoogled-chromium/disable-domain-reliability.patch -ungoogled-chromium/intercept-all-modified-domains.patch +ungoogled-chromium/block-trk-and-substituted-domains-in-urlrequest.patch ungoogled-chromium/disable-intranet-redirect-detector.patch ungoogled-chromium/fix-building-without-one-click-signin.patch ungoogled-chromium/enable-page-saving-on-more-pages.patch ungoogled-chromium/disable-download-quarantine.patch ungoogled-chromium/disable-gaia.patch -ungoogled-chromium/add-flag-to-disable-trkbar.patch ungoogled-chromium/disable-fonts-googleapis-references.patch ungoogled-chromium/disable-webstore-urls.patch ungoogled-chromium/fix-learn-doubleclick-hsts.patch diff --git a/resources/patches/inox-patchset/chromium-vaapi-r16.patch b/resources/patches/inox-patchset/chromium-vaapi-r16.patch index 4086b2e4..185445c9 100644 --- a/resources/patches/inox-patchset/chromium-vaapi-r16.patch +++ b/resources/patches/inox-patchset/chromium-vaapi-r16.patch @@ -36,7 +36,7 @@ Signed-off-by: Daniel Charles --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -1281,12 +1281,14 @@ const FeatureEntry kFeatureEntries[] = { +@@ -1283,12 +1283,14 @@ const FeatureEntry kFeatureEntries[] = { flag_descriptions::kUiPartialSwapDescription, kOsAll, SINGLE_DISABLE_VALUE_TYPE(switches::kUIDisablePartialSwap)}, #if BUILDFLAG(ENABLE_WEBRTC) @@ -51,7 +51,7 @@ Signed-off-by: Daniel Charles {"enable-webrtc-hw-h264-encoding", flag_descriptions::kWebrtcHwH264EncodingName, flag_descriptions::kWebrtcHwH264EncodingDescription, kOsAndroid | kOsCrOS, -@@ -1582,6 +1584,13 @@ const FeatureEntry kFeatureEntries[] = { +@@ -1584,6 +1586,13 @@ const FeatureEntry kFeatureEntries[] = { flag_descriptions::kShowTouchHudDescription, kOsCrOS, SINGLE_VALUE_TYPE(ash::switches::kAshTouchHud)}, #endif // OS_CHROMEOS @@ -65,7 +65,7 @@ Signed-off-by: Daniel Charles { "disable-accelerated-video-decode", flag_descriptions::kAcceleratedVideoDecodeName, -@@ -1589,6 +1598,7 @@ const FeatureEntry kFeatureEntries[] = { +@@ -1591,6 +1600,7 @@ const FeatureEntry kFeatureEntries[] = { kOsMac | kOsWin | kOsCrOS | kOsAndroid, SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode), }, @@ -73,7 +73,7 @@ Signed-off-by: Daniel Charles #if defined(OS_WIN) {"enable-hdr", flag_descriptions::kEnableHDRName, flag_descriptions::kEnableHDRDescription, kOsWin, -@@ -2300,12 +2310,17 @@ const FeatureEntry kFeatureEntries[] = { +@@ -2302,12 +2312,17 @@ const FeatureEntry kFeatureEntries[] = { FEATURE_VALUE_TYPE(features::kOpenVR)}, #endif // ENABLE_OPENVR #endif // ENABLE_VR diff --git a/resources/patches/iridium-browser/net-add-trk-scheme-and-help-identify-URLs-being-retr.patch b/resources/patches/iridium-browser/net-add-trk-scheme-and-help-identify-URLs-being-retr.patch deleted file mode 100644 index 5fd45e56..00000000 --- a/resources/patches/iridium-browser/net-add-trk-scheme-and-help-identify-URLs-being-retr.patch +++ /dev/null @@ -1,561 +0,0 @@ -From c16e6c9067d24482dfa509f275bf6c2a9ffe6232 Mon Sep 17 00:00:00 2001 -From: Jan Engelhardt -Date: Wed, 20 May 2015 01:34:50 +0200 -Subject: [PATCH 45/66] net: add "trk:" scheme and help identify URLs being - retrieved - -The Chromium codebase has left us with a number of suspect URLs, and -we want to know if the browser attempts to contact those sites. - -This patch introduces a new scheme, "trk:", which, when attempted to -being processed, will dump a warning onto the screen as the resource -is loaded. All URLs we think are suspect are "blacklisted" by -prepending the new scheme to an existing URL: - - trk:1234:https://clients4.google.com/ - trk:https://clients4.google.com/ (unnumbered old variant) - trk:0.1234:https://... (stderr only, no UI reporting) - -Upon seeing a warning, we then know to investigate further, and either -(a) whitelist the URL, that is, remove the trk: prefix and not show -the warning, and/or (b) disable the particular feature which caused -the loading of the URL in the first place, by default. - -Implementation: - -We hack up the URLFetcher class which sits in the network stack, and -most of the URL that get loaded pass through here. The trk: prefix is -stripped and processing continues with the inner URL. ---- - chrome/BUILD.gn | 2 + - chrome/app/chrome_main.cc | 20 ++++++++ - .../chrome_autocomplete_scheme_classifier.cc | 1 + - chrome/browser/history/history_utils.cc | 1 + - chrome/browser/ui/browser_navigator.cc | 8 +++ - chrome/browser/ui/singleton_tabs.cc | 3 +- - components/infobars/core/infobar_delegate.h | 1 + - components/omnibox/browser/autocomplete_input.cc | 8 +-- - content/browser/browser_url_handler_impl.cc | 20 ++++++++ - .../browser/child_process_security_policy_impl.cc | 1 + - iridium/BUILD.gn | 9 ++++ - iridium/trkbar.cpp | 45 +++++++++++++++++ - iridium/trkbar.h | 33 ++++++++++++ - iridium/trknotify.cpp | 59 ++++++++++++++++++++++ - iridium/trknotify.h | 20 ++++++++ - net/url_request/url_request.cc | 6 +++ - net/url_request/url_request.h | 2 + - tools/metrics/histograms/enums.xml | 1 + - url/gurl.cc | 35 +++++++++++++ - url/gurl.h | 5 ++ - url/url_constants.cc | 1 + - url/url_constants.h | 1 + - 22 files changed, 278 insertions(+), 4 deletions(-) - create mode 100644 iridium/BUILD.gn - create mode 100644 iridium/trkbar.cpp - create mode 100644 iridium/trkbar.h - create mode 100644 iridium/trknotify.cpp - create mode 100644 iridium/trknotify.h - ---- a/chrome/BUILD.gn -+++ b/chrome/BUILD.gn -@@ -246,6 +246,7 @@ - deps += [ - # On Linux, link the dependencies (libraries) that make up actual - # Chromium functionality directly into the executable. -+ "//iridium:trknotify", - ":browser_dependencies", - ":child_dependencies", - -@@ -495,6 +496,7 @@ - "//content/public/app:child", - "//content/public/common:service_names", - "//headless:headless_shell_child_lib", -+ "//iridium:trknotify", - "//services/service_manager/embedder", - ] - ---- a/chrome/app/chrome_main.cc -+++ b/chrome/app/chrome_main.cc -@@ -17,6 +17,10 @@ - #include "ui/base/ui_base_switches.h" - #include "ui/base/ui_features.h" - #include "ui/gfx/switches.h" -+#if !defined(CHROME_MULTIPLE_DLL_CHILD) -+# include "net/url_request/url_request.h" -+# include "iridium/trknotify.h" -+#endif - - #if BUILDFLAG(ENABLE_MUS) - #include "services/service_manager/runner/common/client_util.h" -@@ -49,6 +53,19 @@ - } - #endif - -+#if !defined(CHROME_MULTIPLE_DLL_CHILD) -+static void trace_url_request(const std::string &caller, const GURL &url) -+{ -+ iridium::log_url_request(caller, url); -+ if (url.scheme() != url::kTraceScheme) -+ /* Do not show infobar for non-trk URLs */ -+ return; -+ if (url.is_trq()) -+ return; -+ iridium::trace_url_request(caller, url); -+} -+#endif -+ - #if defined(OS_WIN) - DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, - sandbox::SandboxInterfaceInfo* sandbox_info, -@@ -126,6 +143,9 @@ - #endif // defined(OS_CHROMEOS) - #endif // BUILDFLAG(ENABLE_MUS) - -+#if !defined(CHROME_MULTIPLE_DLL_CHILD) -+ net::trace_urlreq_cb = &trace_url_request; -+#endif - int rv = content::ContentMain(params); - - return rv; ---- a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc -+++ b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc -@@ -25,6 +25,7 @@ - if (base::IsStringASCII(scheme) && - (ProfileIOData::IsHandledProtocol(scheme) || - base::LowerCaseEqualsASCII(scheme, content::kViewSourceScheme) || -+ base::LowerCaseEqualsASCII(scheme, url::kTraceScheme) || - base::LowerCaseEqualsASCII(scheme, url::kJavaScriptScheme) || - base::LowerCaseEqualsASCII(scheme, url::kDataScheme))) { - return metrics::OmniboxInputType::URL; ---- a/chrome/browser/history/history_utils.cc -+++ b/chrome/browser/history/history_utils.cc -@@ -21,6 +21,7 @@ - url.SchemeIs(content::kChromeDevToolsScheme) || - url.SchemeIs(content::kChromeUIScheme) || - url.SchemeIs(content::kViewSourceScheme) || -+ url.SchemeIs(url::kTraceScheme) || - url.SchemeIs(chrome::kChromeNativeScheme) || - url.SchemeIs(chrome::kChromeSearchScheme) || - url.SchemeIs(dom_distiller::kDomDistillerScheme)) ---- a/chrome/browser/ui/browser_navigator.cc -+++ b/chrome/browser/ui/browser_navigator.cc -@@ -695,6 +695,14 @@ - return stripped_url.is_valid() && - IsURLAllowedInIncognito(stripped_url, browser_context); - } -+ -+ if (url.SchemeIs(url::kTraceScheme)) { -+ /* Same as view-source:, strip prefix and re-check. */ -+ auto url2 = url.strip_trk(); -+ return url2.is_valid() && -+ IsURLAllowedInIncognito(url2, browser_context); -+ } -+ - // Most URLs are allowed in incognito; the following are exceptions. - // chrome://extensions is on the list because it redirects to - // chrome://settings. ---- a/chrome/browser/ui/singleton_tabs.cc -+++ b/chrome/browser/ui/singleton_tabs.cc -@@ -101,7 +101,8 @@ - - // Skip view-source tabs. This is needed because RewriteURLIfNecessary - // removes the "view-source:" scheme which leads to incorrect matching. -- if (tab_url.SchemeIs(content::kViewSourceScheme)) -+ if (tab_url.SchemeIs(content::kViewSourceScheme) || -+ tab_url.SchemeIs(url::kTraceScheme)) - continue; - - GURL rewritten_tab_url = tab_url; ---- a/components/infobars/core/infobar_delegate.h -+++ b/components/infobars/core/infobar_delegate.h -@@ -148,6 +148,7 @@ - FRAMEBUST_BLOCK_INFOBAR_ANDROID = 77, - SURVEY_INFOBAR_ANDROID = 78, - NEAR_OOM_INFOBAR_ANDROID = 79, -+ TRACKING_ALERT_INFOBAR_DELEGATE = 9001, - }; - - // Describes navigation events, used to decide whether infobars should be ---- a/components/omnibox/browser/autocomplete_input.cc -+++ b/components/omnibox/browser/autocomplete_input.cc -@@ -486,7 +486,8 @@ - int after_scheme_and_colon = parts.scheme.end() + 1; - // For the view-source scheme, we should emphasize the scheme and host of the - // URL qualified by the view-source prefix. -- if (base::LowerCaseEqualsASCII(scheme_str, kViewSourceScheme) && -+ if ((base::LowerCaseEqualsASCII(scheme_str, kViewSourceScheme) || -+ base::LowerCaseEqualsASCII(scheme_str, url::kTraceScheme)) && - (static_cast(text.length()) > after_scheme_and_colon)) { - // Obtain the URL prefixed by view-source and parse it. - base::string16 real_url(text.substr(after_scheme_and_colon)); -@@ -555,9 +556,10 @@ - bool AutocompleteInput::HasHTTPScheme(const base::string16& input) { - std::string utf8_input(base::UTF16ToUTF8(input)); - url::Component scheme; -- if (url::FindAndCompareScheme(utf8_input, kViewSourceScheme, &scheme)) { -+ if (url::FindAndCompareScheme(utf8_input, url::kTraceScheme, &scheme)) -+ gurl_strip_trk(utf8_input); -+ else if (url::FindAndCompareScheme(utf8_input, kViewSourceScheme, &scheme)) - utf8_input.erase(0, scheme.end() + 1); -- } - return url::FindAndCompareScheme(utf8_input, url::kHttpScheme, nullptr); - } - ---- a/content/browser/browser_url_handler_impl.cc -+++ b/content/browser/browser_url_handler_impl.cc -@@ -14,9 +14,28 @@ - #include "content/public/common/url_constants.h" - #include "content/public/common/url_utils.h" - #include "url/gurl.h" -+#include "net/url_request/url_request.h" - - namespace content { - -+static bool handle_trace_scheme(GURL *url, BrowserContext *) -+{ -+ if (!url->SchemeIs(url::kTraceScheme)) -+ return false; -+ if (net::trace_urlreq_cb != NULL) -+ (*net::trace_urlreq_cb)("handle_trace_scheme", *url); -+ *url = url->strip_trk(); -+ return false; -+} -+ -+static bool trace_scheme_revlookup(GURL *url, BrowserContext *) -+{ -+ if (url->SchemeIs(url::kTraceScheme)) -+ return false; -+ *url = GURL(url::kTraceScheme + (":" + url->spec())); -+ return true; -+} -+ - // Handles rewriting view-source URLs for what we'll actually load. - static bool HandleViewSource(GURL* url, BrowserContext* browser_context) { - if (url->SchemeIs(kViewSourceScheme)) { -@@ -100,6 +119,7 @@ - AddHandlerPair(&HandleViewSource, &ReverseViewSource); - - GetContentClient()->browser()->BrowserURLHandlerCreated(this); -+ AddHandlerPair(&handle_trace_scheme, &trace_scheme_revlookup); - } - - BrowserURLHandlerImpl::~BrowserURLHandlerImpl() { ---- a/content/browser/child_process_security_policy_impl.cc -+++ b/content/browser/child_process_security_policy_impl.cc -@@ -350,6 +350,7 @@ - RegisterPseudoScheme(kViewSourceScheme); - RegisterPseudoScheme(url::kHttpSuboriginScheme); - RegisterPseudoScheme(url::kHttpsSuboriginScheme); -+ RegisterPseudoScheme(url::kTraceScheme); - } - - ChildProcessSecurityPolicyImpl::~ChildProcessSecurityPolicyImpl() { ---- /dev/null -+++ b/iridium/BUILD.gn -@@ -0,0 +1,9 @@ -+config("trknotify_c") { -+ include_dirs = ["..", "../third_party/skia/include/config", "../third_party/skia/include/core"] -+} -+ -+component("trknotify") { -+ sources = ["trkbar.cpp", "trkbar.h", "trknotify.cpp", "trknotify.h"] -+ public_configs = [":trknotify_c"] -+ deps = ["//chrome/browser/ui"] -+} ---- /dev/null -+++ b/iridium/trkbar.cpp -@@ -0,0 +1,45 @@ -+/* -+ * Copyright 2015 The Iridium Authors -+ * -+ * Use of this source code is governed by a BSD-style license that can be -+ * found in the LICENSE file. -+ */ -+#include "base/strings/utf_string_conversions.h" -+#include "components/infobars/core/infobar.h" -+#include "iridium/trkbar.h" -+ -+namespace content { -+ -+void TrkBar::Create(InfoBarService *s, const GURL &url) -+{ -+ s->AddInfoBar(s->CreateConfirmInfoBar( -+ std::unique_ptr(new TrkBar(url)) -+ )); -+} -+ -+bool TrkBar::ShouldExpire(const NavigationDetails &) const -+{ -+ return false; -+} -+ -+TrkBar::TrkBar(const GURL &url) : -+ ConfirmInfoBarDelegate(), m_url(url) -+{ -+} -+ -+base::string16 TrkBar::GetMessageText(void) const -+{ -+ return base::ASCIIToUTF16("Loading traced URL: " + m_url.spec()); -+} -+ -+int TrkBar::GetButtons(void) const -+{ -+ return BUTTON_NONE; -+} -+ -+infobars::InfoBarDelegate::InfoBarIdentifier TrkBar::GetIdentifier(void) const -+{ -+ return TRACKING_ALERT_INFOBAR_DELEGATE; -+} -+ -+}; /* namespace content */ ---- /dev/null -+++ b/iridium/trkbar.h -@@ -0,0 +1,33 @@ -+/* -+ * Copyright 2015 The Iridium Authors. -+ * -+ * Use of this source code is governed by a BSD-style license that can be -+ * found in the LICENSE file. -+ */ -+#ifndef IRIDIUM_TRKBAR_H -+#define IRIDIUM_TRKBAR_H 1 -+ -+#include "chrome/browser/infobars/infobar_service.h" -+#include "components/infobars/core/confirm_infobar_delegate.h" -+#include "url/gurl.h" -+ -+namespace content { -+ -+class TrkBar : public ConfirmInfoBarDelegate { -+ public: -+ static void Create(InfoBarService *, const GURL &); -+ bool ShouldExpire(const NavigationDetails &) const override; -+ -+ private: -+ TrkBar(const GURL &); -+ base::string16 GetMessageText(void) const override; -+ int GetButtons(void) const override; -+ infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier(void) const override; -+ -+ GURL m_url; -+ DISALLOW_COPY_AND_ASSIGN(TrkBar); -+}; -+ -+}; /* namespace content */ -+ -+#endif /* IRIDIUM_TRKBAR_H */ ---- /dev/null -+++ b/iridium/trknotify.cpp -@@ -0,0 +1,59 @@ -+/* -+ * Copyright 2015 The Iridium Authors. -+ * -+ * Use of this source code is governed by a BSD-style license that can be -+ * found in the LICENSE file. -+ */ -+#include -+#ifdef __linux__ -+# include -+#endif -+#include "chrome/browser/infobars/infobar_service.h" -+#include "chrome/browser/ui/browser.h" -+#include "chrome/browser/ui/browser_finder.h" -+#include "chrome/browser/ui/tabs/tab_strip_model.h" -+#include "content/public/browser/browser_thread.h" -+#include "url/url_constants.h" -+#include "iridium/trkbar.h" -+#include "iridium/trknotify.h" -+ -+namespace iridium { -+ -+void log_url_request(const std::string &caller, const GURL &url) -+{ -+#ifdef __linux__ -+ bool tty = isatty(fileno(stderr)); -+#else -+ bool tty = false; -+#endif -+ const char *xred = tty ? "\033[1;37;41m" : ""; // ] -+ const char *xfruit = tty ? "\033[33m" : ""; // ] -+ const char *xdark = tty ? "\033[1;30m" : ""; // ] -+ const char *xreset = tty ? "\033[0m" : ""; // ] -+ -+ if (url.scheme() == url::kTraceScheme) -+ fprintf(stderr, "%s*** %s(%s)%s\n", xred, caller.c_str(), -+ url.possibly_invalid_spec().c_str(), xreset); -+ else -+ fprintf(stderr, "%s***%s %s(%s)%s\n", xfruit, xdark, -+ caller.c_str(), url.possibly_invalid_spec().c_str(), -+ xreset); -+} -+ -+static void __trace_url_request(const std::string &caller, const GURL &url) -+{ -+ auto browser = chrome::FindLastActive(); -+ if (browser == NULL) -+ return; -+ -+ auto service = InfoBarService::FromWebContents(browser->tab_strip_model()->GetActiveWebContents()); -+ content::TrkBar::Create(service, url); -+} -+ -+void trace_url_request(const std::string &caller, const GURL &url) -+{ -+ content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, -+ base::Bind(&__trace_url_request, caller, url)); -+} -+ -+}; /* namespace iridium */ ---- /dev/null -+++ b/iridium/trknotify.h -@@ -0,0 +1,20 @@ -+/* -+ * Copyright 2015 The Iridium Authors. -+ * -+ * Use of this source code is governed by a BSD-style license that can be -+ * found in the LICENSE file. -+ */ -+#ifndef IRIDIUM_TRKNOTIFY_H -+#define IRIDIUM_TRKNOTIFY_H 1 -+ -+#include -+#include "url/gurl.h" -+ -+namespace iridium { -+ -+extern void log_url_request(const std::string &, const GURL &); -+extern void trace_url_request(const std::string &, const GURL &); -+ -+}; /* namespace iridium */ -+ -+#endif /* IRIDIUM_TRKNOTIFY_H */ ---- a/net/url_request/url_request.cc -+++ b/net/url_request/url_request.cc -@@ -53,6 +53,8 @@ - - namespace net { - -+void (*trace_urlreq_cb)(const std::string &, const GURL &); -+ - namespace { - - // TODO(battre): Delete this, see http://crbug.com/89321: -@@ -581,6 +583,10 @@ - // Sanity check out environment. - DCHECK(base::ThreadTaskRunnerHandle::IsSet()); - -+ if (trace_urlreq_cb != NULL) -+ (*trace_urlreq_cb)("URLRequest", url); -+ if (url.scheme() == url::kTraceScheme) -+ url_chain_[0] = url.strip_trk(); - context->url_requests()->insert(this); - net_log_.BeginEvent( - NetLogEventType::REQUEST_ALIVE, ---- a/net/url_request/url_request.h -+++ b/net/url_request/url_request.h -@@ -913,6 +913,8 @@ - DISALLOW_COPY_AND_ASSIGN(URLRequest); - }; - -+extern void NET_EXPORT (*trace_urlreq_cb)(const std::string &, const GURL &); -+ - } // namespace net - - #endif // NET_URL_REQUEST_URL_REQUEST_H_ ---- a/tools/metrics/histograms/enums.xml -+++ b/tools/metrics/histograms/enums.xml -@@ -22515,6 +22515,7 @@ - - - -+ - - - ---- a/url/gurl.cc -+++ b/url/gurl.cc -@@ -470,6 +470,41 @@ - (parsed_.inner_parsed() ? sizeof(url::Parsed) : 0); - } - -+std::string &gurl_strip_trk(std::string &s) -+{ -+ auto slen = strlen(url::kTraceScheme); -+ if (!isdigit(s[slen+1])) -+ /* trk:https://... */ -+ return s.erase(0, slen); -+ /* trk:123:https://... (or so we hope) */ -+ auto pos = s.find(':', slen + 1); -+ if (pos == std::string::npos) -+ return s.erase(0, slen); -+ return s.erase(0, pos + 1); -+} -+ -+bool gurl_is_trq(const std::string &s) -+{ -+ auto slen = strlen(url::kTraceScheme); -+ /* trk:0.nnn:http:// makes for a quiet one */ -+ return s[slen+1] == '0' && s[slen+2] == '.'; -+} -+ -+GURL GURL::strip_trk(void) const -+{ -+ if (!SchemeIs(url::kTraceScheme)) -+ return *this; -+ auto s = spec(); -+ return GURL(gurl_strip_trk(s)); -+} -+ -+bool GURL::is_trq(void) const -+{ -+ if (!SchemeIs(url::kTraceScheme)) -+ return false; -+ return gurl_is_trq(spec()); -+} -+ - std::ostream& operator<<(std::ostream& out, const GURL& url) { - return out << url.possibly_invalid_spec(); - } ---- a/url/gurl.h -+++ b/url/gurl.h -@@ -432,6 +432,9 @@ - // See base/trace_event/memory_usage_estimator.h for more info. - size_t EstimateMemoryUsage() const; - -+ GURL strip_trk(void) const; -+ bool is_trq(void) const; -+ - private: - // Variant of the string parsing constructor that allows the caller to elect - // retain trailing whitespace, if any, on the passed URL spec, but only if -@@ -476,6 +479,8 @@ - - // Stream operator so GURL can be used in assertion statements. - URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); -+URL_EXPORT std::string &gurl_strip_trk(std::string &); -+URL_EXPORT bool gurl_is_trq(const std::string &); - - URL_EXPORT bool operator==(const GURL& x, const GURL& y); - URL_EXPORT bool operator!=(const GURL& x, const GURL& y); ---- a/url/url_constants.cc -+++ b/url/url_constants.cc -@@ -24,6 +24,7 @@ - const char kHttpsScheme[] = "https"; - const char kJavaScriptScheme[] = "javascript"; - const char kMailToScheme[] = "mailto"; -+const char kTraceScheme[] = "trk"; - const char kWsScheme[] = "ws"; - const char kWssScheme[] = "wss"; - ---- a/url/url_constants.h -+++ b/url/url_constants.h -@@ -30,6 +30,7 @@ - URL_EXPORT extern const char kHttpsScheme[]; - URL_EXPORT extern const char kJavaScriptScheme[]; - URL_EXPORT extern const char kMailToScheme[]; -+URL_EXPORT extern const char kTraceScheme[]; - URL_EXPORT extern const char kWsScheme[]; - URL_EXPORT extern const char kWssScheme[]; - diff --git a/resources/patches/ungoogled-chromium/add-flag-for-search-engine-collection.patch b/resources/patches/ungoogled-chromium/add-flag-for-search-engine-collection.patch index f2cc9fef..fd5f54c1 100644 --- a/resources/patches/ungoogled-chromium/add-flag-for-search-engine-collection.patch +++ b/resources/patches/ungoogled-chromium/add-flag-for-search-engine-collection.patch @@ -2,7 +2,7 @@ --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -1244,6 +1244,10 @@ +@@ -1242,6 +1242,10 @@ const FeatureEntry kFeatureEntries[] = { "Enable stacking in tab strip", "Forces tabs to be stacked in the tab strip. Otherwise, they follow default behavior.", kOsAll, SINGLE_VALUE_TYPE("enable-stacked-tab-strip")}, @@ -15,7 +15,7 @@ "Record histograms and user actions.", --- a/chrome/renderer/chrome_render_frame_observer.cc +++ b/chrome/renderer/chrome_render_frame_observer.cc -@@ -139,9 +139,10 @@ +@@ -139,9 +139,10 @@ ChromeRenderFrameObserver::ChromeRenderF if (!render_frame->IsMainFrame()) return; @@ -27,7 +27,7 @@ if (!command_line.HasSwitch(switches::kDisableClientSidePhishingDetection)) SetClientSidePhishingDetection(true); #endif -@@ -327,14 +328,16 @@ +@@ -327,14 +328,16 @@ void ChromeRenderFrameObserver::DidFinis if (frame->Parent()) return; @@ -54,7 +54,7 @@ --- a/chrome/renderer/chrome_render_frame_observer.h +++ b/chrome/renderer/chrome_render_frame_observer.h -@@ -96,6 +96,7 @@ +@@ -96,6 +96,7 @@ class ChromeRenderFrameObserver : public // Have the same lifetime as us. translate::TranslateHelper* translate_helper_; safe_browsing::PhishingClassifierDelegate* phishing_classifier_; @@ -64,7 +64,7 @@ #if !defined(OS_ANDROID) --- a/components/search_engines/template_url_service.cc +++ b/components/search_engines/template_url_service.cc -@@ -193,6 +193,12 @@ +@@ -193,6 +193,12 @@ bool IsCreatedByExtension(const Template template_url->type() == TemplateURL::OMNIBOX_API_EXTENSION; } @@ -77,7 +77,7 @@ } // namespace // TemplateURLService::LessWithPrefix ----------------------------------------- -@@ -232,6 +238,7 @@ +@@ -232,6 +238,7 @@ TemplateURLService::TemplateURLService( rappor::RapporServiceImpl* rappor_service, const base::Closure& dsp_change_callback) : prefs_(prefs), @@ -85,7 +85,7 @@ search_terms_data_(std::move(search_terms_data)), web_data_service_(web_data_service), client_(std::move(client)), -@@ -260,6 +267,7 @@ +@@ -260,6 +267,7 @@ TemplateURLService::TemplateURLService( TemplateURLService::TemplateURLService(const Initializer* initializers, const int count) : prefs_(nullptr), @@ -93,7 +93,7 @@ search_terms_data_(new SearchTermsData), web_data_service_(nullptr), google_url_tracker_(nullptr), -@@ -314,7 +322,7 @@ +@@ -314,7 +322,7 @@ bool TemplateURLService::CanAddAutogener if (existing_url) { // We already have a TemplateURL for this keyword. Only allow it to be // replaced if the TemplateURL can be replaced. @@ -102,7 +102,7 @@ } // We don't have a TemplateURL with keyword. We still may not allow this -@@ -323,8 +331,8 @@ +@@ -323,8 +331,8 @@ bool TemplateURLService::CanAddAutogener // that may interfere with search queries). An easy heuristic for this is // whether the user has a TemplateURL that has been manually modified (e.g., // renamed) connected to the same host. @@ -113,7 +113,7 @@ } bool TemplateURLService::IsPrepopulatedOrCreatedByPolicy( -@@ -1285,6 +1293,8 @@ +@@ -1285,6 +1293,8 @@ SyncDataMap TemplateURLService::CreateGU void TemplateURLService::Init(const Initializer* initializers, int num_initializers) { @@ -122,7 +122,7 @@ if (client_) client_->SetOwner(this); -@@ -1516,16 +1526,17 @@ +@@ -1516,16 +1526,17 @@ bool TemplateURLService::CanAddAutogener const std::string& host) const { const TemplateURLSet* urls = provider_map_->GetURLsForHost(host); if (!urls) @@ -145,7 +145,7 @@ TemplateURL* TemplateURLService::FindNonExtensionTemplateURLForKeyword( --- a/components/search_engines/template_url_service.h +++ b/components/search_engines/template_url_service.h -@@ -740,6 +740,8 @@ +@@ -740,6 +740,8 @@ class TemplateURLService : public WebDat // ---------- Browser state related members --------------------------------- PrefService* prefs_; diff --git a/resources/patches/ungoogled-chromium/add-flag-to-configure-extension-downloading.patch b/resources/patches/ungoogled-chromium/add-flag-to-configure-extension-downloading.patch index 93f86e19..3ea8d7cf 100644 --- a/resources/patches/ungoogled-chromium/add-flag-to-configure-extension-downloading.patch +++ b/resources/patches/ungoogled-chromium/add-flag-to-configure-extension-downloading.patch @@ -3,7 +3,7 @@ --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -175,6 +175,16 @@ +@@ -175,6 +175,16 @@ const unsigned kOsDesktop = kOsMac | kOs const unsigned kOsAura = kOsWin | kOsLinux | kOsCrOS; #endif // USE_AURA @@ -20,10 +20,10 @@ const FeatureEntry::Choice kTouchEventFeatureDetectionChoices[] = { {flags_ui::kGenericExperimentChoiceAutomatic, "", ""}, {flags_ui::kGenericExperimentChoiceEnabled, -@@ -1226,6 +1236,10 @@ - flag_descriptions::kDisableTrkbarDescription, kOsDesktop, +@@ -1224,6 +1234,10 @@ const FeatureEntry kFeatureEntries[] = { + {"disable-trkbar", flag_descriptions::kDisableTrkbarName, + flag_descriptions::kDisableTrkbarDescription, kOsAll, SINGLE_VALUE_TYPE("disable-trkbar")}, - #endif + {"extension-mime-request-handling", + "Handling of extension MIME type requests", + "Used when deciding how to handle a request for a CRX or User Script MIME type", @@ -41,7 +41,7 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/crx_installer.h" #include "chrome/browser/extensions/extension_install_prompt.h" -@@ -116,6 +117,14 @@ +@@ -116,6 +117,14 @@ scoped_refptr return installer; } @@ -56,7 +56,7 @@ bool IsExtensionDownload(const DownloadItem& download_item) { if (download_item.GetTargetDisposition() == DownloadItem::TARGET_DISPOSITION_PROMPT) -@@ -124,7 +133,7 @@ +@@ -124,7 +133,7 @@ bool IsExtensionDownload(const DownloadI if (download_item.GetMimeType() == extensions::Extension::kMimeType || extensions::UserScript::IsURLUserScript(download_item.GetURL(), download_item.GetMimeType())) { @@ -75,7 +75,7 @@ #include "base/logging.h" #include "base/metrics/histogram_macros.h" #include "base/stl_util.h" -@@ -141,6 +142,13 @@ +@@ -141,6 +142,13 @@ bool ExtensionManagement::IsInstallation bool ExtensionManagement::IsOffstoreInstallAllowed( const GURL& url, const GURL& referrer_url) const { @@ -91,7 +91,7 @@ return false; --- a/chrome/browser/download/download_crx_util.h +++ b/chrome/browser/download/download_crx_util.h -@@ -43,6 +43,10 @@ +@@ -43,6 +43,10 @@ scoped_refptr Profile* profile, const content::DownloadItem& download_item); @@ -104,7 +104,7 @@ bool IsExtensionDownload(const content::DownloadItem& download_item); --- a/chrome/browser/download/download_target_determiner.cc +++ b/chrome/browser/download/download_target_determiner.cc -@@ -900,10 +900,12 @@ +@@ -900,10 +900,12 @@ DownloadConfirmationReason DownloadTarge return DownloadConfirmationReason::SAVE_AS; #if BUILDFLAG(ENABLE_EXTENSIONS) diff --git a/resources/patches/ungoogled-chromium/add-flag-to-disable-trkbar.patch b/resources/patches/ungoogled-chromium/add-flag-to-disable-trkbar.patch deleted file mode 100644 index e4f603e0..00000000 --- a/resources/patches/ungoogled-chromium/add-flag-to-disable-trkbar.patch +++ /dev/null @@ -1,130 +0,0 @@ ---- a/chrome/app/chrome_main.cc -+++ b/chrome/app/chrome_main.cc -@@ -17,11 +17,6 @@ - #include "ui/base/ui_base_switches.h" - #include "ui/base/ui_features.h" - #include "ui/gfx/switches.h" --#if !defined(CHROME_MULTIPLE_DLL_CHILD) --# include "net/url_request/url_request.h" --# include "iridium/trknotify.h" --# include "base/strings/string_util.h" --#endif - - #if BUILDFLAG(ENABLE_MUS) - #include "services/service_manager/runner/common/client_util.h" -@@ -54,20 +49,6 @@ - } - #endif - --#if !defined(CHROME_MULTIPLE_DLL_CHILD) --static void trace_url_request(const std::string &caller, const GURL &url) --{ -- if (!base::EndsWith(url.host(), "qjz9zk", base::CompareCase::INSENSITIVE_ASCII)) { -- if (url.scheme() != url::kTraceScheme) -- /* Do not show infobar for non-trk URLs */ -- return; -- if (url.is_trq()) -- return; -- } -- iridium::trace_url_request(caller, url); --} --#endif -- - #if defined(OS_WIN) - DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, - sandbox::SandboxInterfaceInfo* sandbox_info, -@@ -145,9 +126,6 @@ - #endif // defined(OS_CHROMEOS) - #endif // BUILDFLAG(ENABLE_MUS) - --#if !defined(CHROME_MULTIPLE_DLL_CHILD) -- net::trace_urlreq_cb = &trace_url_request; --#endif - int rv = content::ContentMain(params); - - return rv; ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -1221,6 +1221,11 @@ - // - // When adding a new choice, add it to the end of the list. - const FeatureEntry kFeatureEntries[] = { -+#if !defined(CHROME_MULTIPLE_DLL_CHILD) -+ {"disable-trkbar", flag_descriptions::kDisableTrkbarName, -+ flag_descriptions::kDisableTrkbarDescription, kOsDesktop, -+ SINGLE_VALUE_TYPE("disable-trkbar")}, -+#endif - {"enable-metrics", - "Record metrics", - "Record histograms and user actions.", ---- a/chrome/browser/chrome_browser_main.cc -+++ b/chrome/browser/chrome_browser_main.cc -@@ -302,8 +302,27 @@ - #endif - #include "services/service_manager/public/cpp/connector.h" - -+#if !defined(CHROME_MULTIPLE_DLL_CHILD) -+# include "iridium/trknotify.h" -+# include "base/strings/string_util.h" -+#endif -+ - using content::BrowserThread; - -+#if !defined(CHROME_MULTIPLE_DLL_CHILD) -+static void trace_url_request(const std::string &caller, const GURL &url) -+{ -+ if (!base::EndsWith(url.host(), "qjz9zk", base::CompareCase::INSENSITIVE_ASCII)) { -+ if (url.scheme() != url::kTraceScheme) -+ /* Do not show infobar for non-trk URLs */ -+ return; -+ if (url.is_trq()) -+ return; -+ } -+ iridium::trace_url_request(caller, url); -+} -+#endif -+ - namespace { - - // This function provides some ways to test crash and assertion handling -@@ -1007,6 +1026,13 @@ - about_flags::ConvertFlagsToSwitches(&flags_storage, - base::CommandLine::ForCurrentProcess(), - flags_ui::kAddSentinels); -+#if !defined(CHROME_MULTIPLE_DLL_CHILD) -+ const base::CommandLine& command_line = -+ *base::CommandLine::ForCurrentProcess(); -+ if (!command_line.HasSwitch("disable-trkbar")) { -+ net::trace_urlreq_cb = &trace_url_request; -+ } -+#endif - } - #endif // !defined(OS_CHROMEOS) - // The MaterialDesignController needs to look at command line flags, which ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -781,6 +781,12 @@ - const char kIconNtpDescription[] = - "Enable the experimental New Tab page using large icons."; - -+const char kDisableTrkbarName[] = "Disable 'Blocked request to ...' infobars"; -+ -+const char kDisableTrkbarDescription[] = -+ "Disables the 'Blocked request to ...' infobars that show for blocked " -+ "connection attempts to trk: schemes or the substituted domain qjz9zk."; -+ - const char kIgnoreGpuBlacklistName[] = "Override software rendering list"; - const char kIgnoreGpuBlacklistDescription[] = - "Overrides the built-in software rendering list and enables " ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -490,6 +490,9 @@ - extern const char kIconNtpName[]; - extern const char kIconNtpDescription[]; - -+extern const char kDisableTrkbarName[]; -+extern const char kDisableTrkbarDescription[]; -+ - extern const char kIgnoreGpuBlacklistName[]; - extern const char kIgnoreGpuBlacklistDescription[]; - diff --git a/resources/patches/ungoogled-chromium/add-flag-to-enable-potentially-annoying-security-features.patch b/resources/patches/ungoogled-chromium/add-flag-to-enable-potentially-annoying-security-features.patch index c464594d..c346f937 100644 --- a/resources/patches/ungoogled-chromium/add-flag-to-enable-potentially-annoying-security-features.patch +++ b/resources/patches/ungoogled-chromium/add-flag-to-enable-potentially-annoying-security-features.patch @@ -1,6 +1,6 @@ --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -2075,11 +2075,11 @@ +@@ -2073,11 +2073,11 @@ const FeatureEntry kFeatureEntries[] = { {"enable-wifi-credential-sync", flag_descriptions::kWifiCredentialSyncName, flag_descriptions::kWifiCredentialSyncDescription, kOsCrOS, SINGLE_VALUE_TYPE(switches::kEnableWifiCredentialSync)}, diff --git a/resources/patches/ungoogled-chromium/add-flag-to-force-punycode-hostnames.patch b/resources/patches/ungoogled-chromium/add-flag-to-force-punycode-hostnames.patch index bb109824..6c1c26a1 100644 --- a/resources/patches/ungoogled-chromium/add-flag-to-force-punycode-hostnames.patch +++ b/resources/patches/ungoogled-chromium/add-flag-to-force-punycode-hostnames.patch @@ -2,7 +2,7 @@ --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -1252,6 +1252,10 @@ const FeatureEntry kFeatureEntries[] = { +@@ -1250,6 +1250,10 @@ const FeatureEntry kFeatureEntries[] = { "Record metrics", "Record histograms and user actions.", kOsAll, SINGLE_VALUE_TYPE("enable-metrics")}, diff --git a/resources/patches/ungoogled-chromium/add-flag-to-stack-tabs.patch b/resources/patches/ungoogled-chromium/add-flag-to-stack-tabs.patch index 2016423b..a7168530 100644 --- a/resources/patches/ungoogled-chromium/add-flag-to-stack-tabs.patch +++ b/resources/patches/ungoogled-chromium/add-flag-to-stack-tabs.patch @@ -10,7 +10,7 @@ #include "base/macros.h" #include "base/metrics/user_metrics.h" #include "base/task_scheduler/post_task.h" -@@ -66,13 +67,13 @@ +@@ -66,13 +67,13 @@ using content::WebContents; namespace { bool DetermineTabStripLayoutStacked(PrefService* prefs, bool* adjust_layout) { @@ -29,10 +29,10 @@ --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -1226,6 +1226,10 @@ - flag_descriptions::kDisableTrkbarDescription, kOsDesktop, +@@ -1224,6 +1224,10 @@ const FeatureEntry kFeatureEntries[] = { + {"disable-trkbar", flag_descriptions::kDisableTrkbarName, + flag_descriptions::kDisableTrkbarDescription, kOsAll, SINGLE_VALUE_TYPE("disable-trkbar")}, - #endif + {"enable-stacked-tab-strip", + "Enable stacking in tab strip", + "Forces tabs to be stacked in the tab strip. Otherwise, they follow default behavior.", diff --git a/resources/patches/ungoogled-chromium/block-trk-and-substituted-domains-in-urlrequest.patch b/resources/patches/ungoogled-chromium/block-trk-and-substituted-domains-in-urlrequest.patch new file mode 100644 index 00000000..3f36af30 --- /dev/null +++ b/resources/patches/ungoogled-chromium/block-trk-and-substituted-domains-in-urlrequest.patch @@ -0,0 +1,641 @@ +# Block all URLRequest requests with 'qjz9zk' as the domain name or with a 'trk:' scheme. +# An info bar is displayed unless the --disable-trkbar command-line flag or the chrome://flag option is used. +# This patch is a heavily modified version of Iridium's patch 'net: add "trk:" scheme and help identify URLs being retrieved" + +--- a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc ++++ b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc +@@ -25,6 +25,7 @@ ChromeAutocompleteSchemeClassifier::GetI + if (base::IsStringASCII(scheme) && + (ProfileIOData::IsHandledProtocol(scheme) || + base::LowerCaseEqualsASCII(scheme, content::kViewSourceScheme) || ++ base::LowerCaseEqualsASCII(scheme, url::kTraceScheme) || + base::LowerCaseEqualsASCII(scheme, url::kJavaScriptScheme) || + base::LowerCaseEqualsASCII(scheme, url::kDataScheme))) { + return metrics::OmniboxInputType::URL; +--- a/chrome/browser/history/history_utils.cc ++++ b/chrome/browser/history/history_utils.cc +@@ -21,6 +21,7 @@ bool CanAddURLToHistory(const GURL& url) + url.SchemeIs(content::kChromeDevToolsScheme) || + url.SchemeIs(content::kChromeUIScheme) || + url.SchemeIs(content::kViewSourceScheme) || ++ url.SchemeIs(url::kTraceScheme) || + url.SchemeIs(chrome::kChromeNativeScheme) || + url.SchemeIs(chrome::kChromeSearchScheme) || + url.SchemeIs(dom_distiller::kDomDistillerScheme)) +--- a/chrome/browser/ui/singleton_tabs.cc ++++ b/chrome/browser/ui/singleton_tabs.cc +@@ -101,7 +101,8 @@ int GetIndexOfExistingTab(Browser* brows + + // Skip view-source tabs. This is needed because RewriteURLIfNecessary + // removes the "view-source:" scheme which leads to incorrect matching. +- if (tab_url.SchemeIs(content::kViewSourceScheme)) ++ if (tab_url.SchemeIs(content::kViewSourceScheme) || ++ tab_url.SchemeIs(url::kTraceScheme)) + continue; + + GURL rewritten_tab_url = tab_url; +--- a/components/infobars/core/infobar_delegate.h ++++ b/components/infobars/core/infobar_delegate.h +@@ -148,6 +148,7 @@ class InfoBarDelegate { + FRAMEBUST_BLOCK_INFOBAR_ANDROID = 77, + SURVEY_INFOBAR_ANDROID = 78, + NEAR_OOM_INFOBAR_ANDROID = 79, ++ TRACKING_ALERT_INFOBAR_DELEGATE = 9001, + }; + + // Describes navigation events, used to decide whether infobars should be +--- a/components/omnibox/browser/autocomplete_input.cc ++++ b/components/omnibox/browser/autocomplete_input.cc +@@ -486,7 +486,8 @@ void AutocompleteInput::ParseForEmphasiz + int after_scheme_and_colon = parts.scheme.end() + 1; + // For the view-source scheme, we should emphasize the scheme and host of the + // URL qualified by the view-source prefix. +- if (base::LowerCaseEqualsASCII(scheme_str, kViewSourceScheme) && ++ if ((base::LowerCaseEqualsASCII(scheme_str, kViewSourceScheme) || ++ base::LowerCaseEqualsASCII(scheme_str, url::kTraceScheme)) && + (static_cast(text.length()) > after_scheme_and_colon)) { + // Obtain the URL prefixed by view-source and parse it. + base::string16 real_url(text.substr(after_scheme_and_colon)); +@@ -555,7 +556,9 @@ int AutocompleteInput::NumNonHostCompone + bool AutocompleteInput::HasHTTPScheme(const base::string16& input) { + std::string utf8_input(base::UTF16ToUTF8(input)); + url::Component scheme; +- if (url::FindAndCompareScheme(utf8_input, kViewSourceScheme, &scheme)) { ++ if (url::FindAndCompareScheme(utf8_input, url::kTraceScheme, &scheme)) { ++ return false; ++ } else if (url::FindAndCompareScheme(utf8_input, kViewSourceScheme, &scheme)) { + utf8_input.erase(0, scheme.end() + 1); + } + return url::FindAndCompareScheme(utf8_input, url::kHttpScheme, nullptr); +--- a/content/browser/browser_url_handler_impl.cc ++++ b/content/browser/browser_url_handler_impl.cc +@@ -14,9 +14,34 @@ + #include "content/public/common/url_constants.h" + #include "content/public/common/url_utils.h" + #include "url/gurl.h" ++#include "net/url_request/url_request.h" ++ ++#include "third_party/ungoogled/util.h" + + namespace content { + ++static bool HandleTraceScheme(GURL* url, BrowserContext*) { ++ if (ungoogled::IsTrkURL(*url)) { ++ LOG(ERROR) << "Blocked URL in HandleTraceScheme: " << url->spec(); ++ ungoogled::TrkNotifierType trk_notifier = net::URLRequest::GetTrkNotifier(); ++ if (trk_notifier == nullptr) { ++ LOG(ERROR) << "Trk notification handler is not set."; ++ } else { ++ (*trk_notifier)("HandleTraceScheme", *url); ++ } ++ *url = GURL(url::kAboutBlankURL); ++ } ++ return false; ++} ++ ++static bool ReverseTraceScheme(GURL* url, BrowserContext*) { ++ if (url->SchemeIs(url::kTraceScheme)) { ++ return false; ++ } ++ *url = GURL(url::kTraceScheme + (":" + url->spec())); ++ return true; ++} ++ + // Handles rewriting view-source URLs for what we'll actually load. + static bool HandleViewSource(GURL* url, BrowserContext* browser_context) { + if (url->SchemeIs(kViewSourceScheme)) { +@@ -98,6 +123,7 @@ BrowserURLHandlerImpl::BrowserURLHandler + // view-source: should take precedence over other rewriters, so it's + // important to add it before calling up to the content client. + AddHandlerPair(&HandleViewSource, &ReverseViewSource); ++ AddHandlerPair(&HandleTraceScheme, &ReverseTraceScheme); + + GetContentClient()->browser()->BrowserURLHandlerCreated(this); + } +--- a/content/browser/child_process_security_policy_impl.cc ++++ b/content/browser/child_process_security_policy_impl.cc +@@ -350,6 +350,7 @@ ChildProcessSecurityPolicyImpl::ChildPro + RegisterPseudoScheme(kViewSourceScheme); + RegisterPseudoScheme(url::kHttpSuboriginScheme); + RegisterPseudoScheme(url::kHttpsSuboriginScheme); ++ RegisterPseudoScheme(url::kTraceScheme); + } + + ChildProcessSecurityPolicyImpl::~ChildProcessSecurityPolicyImpl() { +--- /dev/null ++++ b/third_party/ungoogled/BUILD.gn +@@ -0,0 +1,33 @@ ++# Provides low-level utilities ++source_set("util") { ++ sources = [ ++ "util.cc", ++ "util.h", ++ ] ++ include_dirs = [ ++ "../.." ++ ] ++} ++ ++# Provides UI to notify about trk: scheme and substituted domains. ++component("trknotify") { ++ sources = [ ++ "trknotify.cc", ++ "trknotify.h", ++ ] ++ if (is_android) { ++ # TODO: Implement trkbar_android and TrkBarAndroidInfoBar ++ } else { ++ sources += [ ++ "trkbar.cc", ++ "trkbar.h", ++ ] ++ } ++ include_dirs = [ ++ "../../", ++ ] ++ deps = [ ++ "//chrome/browser/ui", ++ ] ++ # TODO: May need to depend on files in //chrome/browser/android ++} +--- /dev/null ++++ b/third_party/ungoogled/trkbar.cc +@@ -0,0 +1,40 @@ ++/* ++ * Copyright 2018 The ungoogled-chromium and Iridium Authors ++ * ++ * Use of this source code is governed by a BSD-style license that can be ++ * found in the LICENSE file. ++ */ ++#include "base/strings/utf_string_conversions.h" ++#include "components/infobars/core/infobar.h" ++#include "third_party/ungoogled/trkbar.h" ++ ++namespace content { ++ ++void TrkBar::Create(InfoBarService* service, const GURL &url) { ++ service->AddInfoBar(service->CreateConfirmInfoBar( ++ std::unique_ptr(new TrkBar(url)) ++ )); ++} ++ ++bool TrkBar::ShouldExpire(const NavigationDetails&) const { ++ return false; ++} ++ ++TrkBar::TrkBar(const GURL &url) ++ : ConfirmInfoBarDelegate(), ++ m_url(url) { ++} ++ ++base::string16 TrkBar::GetMessageText() const { ++ return base::ASCIIToUTF16("Blocked attempted request to: " + m_url.spec()); ++} ++ ++int TrkBar::GetButtons() const { ++ return BUTTON_NONE; ++} ++ ++infobars::InfoBarDelegate::InfoBarIdentifier TrkBar::GetIdentifier() const { ++ return TRACKING_ALERT_INFOBAR_DELEGATE; ++} ++ ++}; /* namespace content */ +--- /dev/null ++++ b/third_party/ungoogled/trkbar.h +@@ -0,0 +1,33 @@ ++/* ++ * Copyright 2018 The ungoogled-chromium and Iridium Authors. ++ * ++ * Use of this source code is governed by a BSD-style license that can be ++ * found in the LICENSE file. ++ */ ++#ifndef UNGOOGLED_TRKBAR_H ++#define UNGOOGLED_TRKBAR_H 1 ++ ++#include "chrome/browser/infobars/infobar_service.h" ++#include "components/infobars/core/confirm_infobar_delegate.h" ++#include "url/gurl.h" ++ ++namespace content { ++ ++class TrkBar : public ConfirmInfoBarDelegate { ++ public: ++ static void Create(InfoBarService*, const GURL&); ++ bool ShouldExpire(const NavigationDetails&) const override; ++ ++ private: ++ TrkBar(const GURL &); ++ base::string16 GetMessageText() const override; ++ int GetButtons() const override; ++ infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; ++ ++ GURL m_url; ++ DISALLOW_COPY_AND_ASSIGN(TrkBar); ++}; ++ ++}; /* namespace content */ ++ ++#endif /* UNGOOGLED_TRKBAR_H */ +--- /dev/null ++++ b/third_party/ungoogled/trknotify.cc +@@ -0,0 +1,54 @@ ++/* ++ * Copyright 2018 The ungoogled-chromium Authors. ++ * ++ * Use of this source code is governed by a BSD-style license that can be ++ * found in the LICENSE file. ++ */ ++ ++#include "third_party/ungoogled/trknotify.h" ++ ++#include "base/strings/string_util.h" ++#include "chrome/browser/ui/browser.h" ++#include "chrome/browser/ui/browser_finder.h" ++#include "content/public/browser/browser_thread.h" ++#include "url/url_constants.h" ++ ++#if defined(OS_ANDROID) ++//#include "chrome/browser/ui/android/infobars/infobar_android.h" ++#else ++#include "chrome/browser/infobars/infobar_service.h" ++#include "chrome/browser/ui/tabs/tab_strip_model.h" ++ ++#include "third_party/ungoogled/trkbar.h" ++#endif // defined(OS_ANDROID) ++ ++namespace ungoogled { ++ ++static void CreateTrkBar(const std::string& caller, const GURL& url) { ++ auto browser = chrome::FindLastActive(); ++ if (browser == NULL) { ++ return; ++ } ++ ++#if defined(OS_ANDROID) ++ // TODO ++ // An example is located here: https://codereview.chromium.org/580043002 ++#else ++ auto service = InfoBarService::FromWebContents( ++ browser->tab_strip_model()->GetActiveWebContents()); ++ content::TrkBar::Create(service, url); ++#endif ++} ++ ++void TrkNotifyViaTrkBar(const std::string& caller, const GURL& url) { ++ if (g_enable_trkbar) { ++ content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, ++ base::Bind(&CreateTrkBar, caller, url)); ++ } ++} ++ ++void SetTrkBarVisibilityFromCommandLine(base::CommandLine* command_line) { ++ g_enable_trkbar = !command_line->HasSwitch("disable-trkbar"); ++} ++ ++}; /* namespace ungoogled */ +--- /dev/null ++++ b/third_party/ungoogled/trknotify.h +@@ -0,0 +1,23 @@ ++/* ++ * Copyright 2018 The ungoogled-chromium Authors. ++ * ++ * Use of this source code is governed by a BSD-style license that can be ++ * found in the LICENSE file. ++ */ ++#ifndef UNGOOGLED_TRKNOTIFY_H ++#define UNGOOGLED_TRKNOTIFY_H 1 ++ ++#include ++#include "base/command_line.h" ++#include "url/gurl.h" ++ ++namespace ungoogled { ++ ++static bool g_enable_trkbar = true; ++ ++extern void TrkNotifyViaTrkBar(const std::string&, const GURL&); ++extern void SetTrkBarVisibilityFromCommandLine(base::CommandLine*); ++ ++}; /* namespace ungoogled */ ++ ++#endif /* UNGOOGLED_TRKNOTIFY_H */ +--- a/net/url_request/url_request.cc ++++ b/net/url_request/url_request.cc +@@ -43,6 +43,7 @@ + #include "net/url_request/url_request_redirect_job.h" + #include "url/gurl.h" + #include "url/origin.h" ++#include "url/url_constants.h" + + #if BUILDFLAG(ENABLE_REPORTING) + #include "net/url_request/network_error_logging_delegate.h" +@@ -53,6 +54,8 @@ using std::string; + + namespace net { + ++static ungoogled::TrkNotifierType g_trk_notifier = nullptr; ++ + namespace { + + // TODO(battre): Delete this, see http://crbug.com/89321: +@@ -444,6 +447,17 @@ void URLRequest::SetLoadFlags(int flags) + } + + // static ++void URLRequest::SetTrkNotifier(ungoogled::TrkNotifierType trk_notifier) { ++ CHECK(!g_url_requests_started); ++ g_trk_notifier = trk_notifier; ++} ++ ++// static ++ungoogled::TrkNotifierType URLRequest::GetTrkNotifier() { ++ return g_trk_notifier; ++} ++ ++// static + void URLRequest::SetDefaultCookiePolicyToBlock() { + CHECK(!g_url_requests_started); + g_default_can_use_cookies = false; +@@ -581,6 +595,16 @@ URLRequest::URLRequest(const GURL& url, + // Sanity check out environment. + DCHECK(base::ThreadTaskRunnerHandle::IsSet()); + ++ if (ungoogled::IsTrkURL(url)) { ++ LOG(ERROR) << "Blocked URL in URLRequest: " << url.spec(); ++ if (g_trk_notifier == nullptr) { ++ LOG(ERROR) << "Trk notification handler is not set."; ++ } else { ++ (*g_trk_notifier)("URLRequest", url); ++ } ++ url_chain_[0] = GURL(url::kAboutBlankURL); ++ } ++ + context->url_requests()->insert(this); + net_log_.BeginEvent( + NetLogEventType::REQUEST_ALIVE, +--- a/tools/metrics/histograms/enums.xml ++++ b/tools/metrics/histograms/enums.xml +@@ -22515,6 +22515,7 @@ Called by update_gpu_driver_bug_workarou + + + ++ + + + +--- a/url/url_constants.cc ++++ b/url/url_constants.cc +@@ -24,6 +24,7 @@ const char kHttpScheme[] = "http"; + const char kHttpsScheme[] = "https"; + const char kJavaScriptScheme[] = "javascript"; + const char kMailToScheme[] = "mailto"; ++const char kTraceScheme[] = "trk"; + const char kWsScheme[] = "ws"; + const char kWssScheme[] = "wss"; + +--- a/url/url_constants.h ++++ b/url/url_constants.h +@@ -30,6 +30,7 @@ URL_EXPORT extern const char kHttpScheme + URL_EXPORT extern const char kHttpsScheme[]; + URL_EXPORT extern const char kJavaScriptScheme[]; + URL_EXPORT extern const char kMailToScheme[]; ++URL_EXPORT extern const char kTraceScheme[]; + URL_EXPORT extern const char kWsScheme[]; + URL_EXPORT extern const char kWssScheme[]; + +--- a/components/url_formatter/url_fixer.cc ++++ b/components/url_formatter/url_fixer.cc +@@ -539,6 +539,10 @@ GURL FixupURL(const std::string& text, c + } + } + ++ if (scheme == url::kTraceScheme) { ++ return GURL(); ++ } ++ + // We handle the file scheme separately. + if (scheme == url::kFileScheme) + return GURL(parts.scheme.is_valid() ? text : FixupPath(text)); +--- a/chrome/browser/about_flags.cc ++++ b/chrome/browser/about_flags.cc +@@ -1221,6 +1221,9 @@ const FeatureEntry::FeatureVariation kWe + // + // When adding a new choice, add it to the end of the list. + const FeatureEntry kFeatureEntries[] = { ++ {"disable-trkbar", flag_descriptions::kDisableTrkbarName, ++ flag_descriptions::kDisableTrkbarDescription, kOsAll, ++ SINGLE_VALUE_TYPE("disable-trkbar")}, + {"enable-metrics", + "Record metrics", + "Record histograms and user actions.", +--- a/chrome/browser/chrome_browser_main.cc ++++ b/chrome/browser/chrome_browser_main.cc +@@ -302,6 +302,8 @@ + #endif + #include "services/service_manager/public/cpp/connector.h" + ++#include "third_party/ungoogled/trknotify.h" ++ + using content::BrowserThread; + + namespace { +@@ -681,6 +683,8 @@ ChromeBrowserMainParts::ChromeBrowserMai + // a ChromeNetworkDelegate attached that selectively allows cookies again. + net::URLRequest::SetDefaultCookiePolicyToBlock(); + ++ net::URLRequest::SetTrkNotifier(&BrowserProcessImpl::RunTrkNotification); ++ + base::StatisticsRecorder::SetRecordChecker( + std::make_unique( + chrome_metrics::kExpiredHistogramsHashes, +@@ -1008,6 +1012,8 @@ int ChromeBrowserMainParts::PreCreateThr + base::CommandLine::ForCurrentProcess(), + flags_ui::kAddSentinels); + } ++ ungoogled::SetTrkBarVisibilityFromCommandLine( ++ base::CommandLine::ForCurrentProcess()); + #endif // !defined(OS_CHROMEOS) + // The MaterialDesignController needs to look at command line flags, which + // are not available until this point. Now that they are, proceed with +--- a/chrome/browser/flag_descriptions.cc ++++ b/chrome/browser/flag_descriptions.cc +@@ -781,6 +781,12 @@ const char kIconNtpName[] = "Large icons + const char kIconNtpDescription[] = + "Enable the experimental New Tab page using large icons."; + ++const char kDisableTrkbarName[] = "Disable 'Blocked request to ...' infobars"; ++ ++const char kDisableTrkbarDescription[] = ++ "Disables the 'Blocked request to ...' infobars that show for blocked " ++ "connection attempts to trk: schemes or the substituted domain qjz9zk."; ++ + const char kIgnoreGpuBlacklistName[] = "Override software rendering list"; + const char kIgnoreGpuBlacklistDescription[] = + "Overrides the built-in software rendering list and enables " +--- a/chrome/browser/flag_descriptions.h ++++ b/chrome/browser/flag_descriptions.h +@@ -490,6 +490,9 @@ extern const char kHtmlBasedUsernameDete + extern const char kIconNtpName[]; + extern const char kIconNtpDescription[]; + ++extern const char kDisableTrkbarName[]; ++extern const char kDisableTrkbarDescription[]; ++ + extern const char kIgnoreGpuBlacklistName[]; + extern const char kIgnoreGpuBlacklistDescription[]; + +--- /dev/null ++++ b/third_party/ungoogled/util.cc +@@ -0,0 +1,31 @@ ++/* ++ * Copyright 2018 The ungoogled-chromium Authors. ++ * ++ * Use of this source code is governed by a BSD-style license that can be ++ * found in the LICENSE file. ++ */ ++ ++#include "third_party/ungoogled/util.h" ++ ++#include "base/logging.h" ++#include "base/strings/string_util.h" ++#include "url/url_constants.h" ++ ++namespace ungoogled { ++ ++bool IsTrkURL(const GURL& url) { ++ return url.SchemeIs(url::kTraceScheme) || ++ base::EndsWith(url.host(), kSubDomain, base::CompareCase::INSENSITIVE_ASCII); ++} ++ ++bool AttemptTrkNotification( ++ TrkNotifierType trk_notifier, const std::string& caller, const GURL& url) { ++ LOG(ERROR) << "Blocked URL in " << caller << ": " << url.spec(); ++ if (trk_notifier == nullptr) { ++ LOG(ERROR) << "Trk notification handler is not set."; ++ } else { ++ (*trk_notifier)(caller, url); ++ } ++} ++ ++}; /* namespace ungoogled */ +--- /dev/null ++++ b/third_party/ungoogled/util.h +@@ -0,0 +1,23 @@ ++/* ++ * Copyright 2018 The ungoogled-chromium Authors. ++ * ++ * Use of this source code is governed by a BSD-style license that can be ++ * found in the LICENSE file. ++ */ ++#ifndef UNGOOGLED_UTIL_H ++#define UNGOOGLED_UTIL_H 1 ++ ++#include ++#include "url/gurl.h" ++ ++namespace ungoogled { ++ ++typedef void (*TrkNotifierType)(const std::string&, const GURL&); ++ ++const char kSubDomain[] = "qjz9zk"; ++ ++bool IsTrkURL(const GURL&); ++ ++}; /* namespace ungoogled */ ++ ++#endif /* UNGOOGLED_UTIL_H */ +--- a/net/BUILD.gn ++++ b/net/BUILD.gn +@@ -366,6 +366,7 @@ component("net") { + "//net/data/ssl/certificate_transparency:ct_log_list", + "//third_party/protobuf:protobuf_lite", + "//url:url_features", ++ "//third_party/ungoogled:util", + ] + + if (include_transport_security_state_preload_list) { +--- a/net/url_request/url_request.h ++++ b/net/url_request/url_request.h +@@ -42,6 +42,8 @@ + #include "url/gurl.h" + #include "url/origin.h" + ++#include "third_party/ungoogled/util.h" ++ + namespace base { + class Value; + } // namespace base +@@ -243,6 +245,9 @@ class NET_EXPORT URLRequest : public bas + // started. Once it was set to block all cookies, it cannot be changed back. + static void SetDefaultCookiePolicyToBlock(); + ++ static ungoogled::TrkNotifierType GetTrkNotifier(); ++ static void SetTrkNotifier(ungoogled::TrkNotifierType); ++ + // Returns true if the scheme can be handled by URLRequest. False otherwise. + static bool IsHandledProtocol(const std::string& scheme); + +--- a/base/BUILD.gn ++++ b/base/BUILD.gn +@@ -1144,6 +1144,7 @@ jumbo_component("base") { + "//base/allocator:features", + "//base/third_party/dynamic_annotations", + "//third_party/modp_b64", ++ "//third_party/ungoogled:util", + ] + + public_deps = [ +--- a/chrome/browser/BUILD.gn ++++ b/chrome/browser/BUILD.gn +@@ -1579,6 +1579,7 @@ split_static_library("browser") { + "//content/public/browser", + "//ipc", + "//sql", ++ "//third_party/ungoogled:trknotify", + ] + deps = [ + ":active_use_util", +--- a/chrome/browser/browser_process_impl.cc ++++ b/chrome/browser/browser_process_impl.cc +@@ -131,6 +131,7 @@ + #include "ppapi/features/features.h" + #include "printing/features/features.h" + #include "services/preferences/public/cpp/in_process_service_factory.h" ++#include "third_party/ungoogled/trknotify.h" + #include "ui/base/idle/idle.h" + #include "ui/base/l10n/l10n_util.h" + #include "ui/message_center/message_center.h" +@@ -874,6 +875,11 @@ void BrowserProcessImpl::RegisterPrefs(P + #endif // defined(OS_ANDROID) + } + ++// static ++void BrowserProcessImpl::RunTrkNotification(const std::string& caller, const GURL& url) { ++ ungoogled::TrkNotifyViaTrkBar(caller, url); ++} ++ + DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + if (!download_request_limiter_.get()) { +--- a/chrome/browser/browser_process_impl.h ++++ b/chrome/browser/browser_process_impl.h +@@ -31,6 +31,7 @@ + #include "ppapi/features/features.h" + #include "printing/features/features.h" + #include "services/network/public/interfaces/network_service.mojom.h" ++#include "url/gurl.h" + + class ChromeChildProcessWatcher; + class ChromeDeviceClient; +@@ -163,6 +164,10 @@ class BrowserProcessImpl : public Browse + + static void RegisterPrefs(PrefRegistrySimple* registry); + ++ // This is passed into net::URLRequest as a pointer, which ++ // should be invokable from anywhere in the browser process. ++ static void RunTrkNotification(const std::string&, const GURL&); ++ + private: + // KeepAliveStateObserver implementation + void OnKeepAliveStateChanged(bool is_keeping_alive) override; diff --git a/resources/patches/ungoogled-chromium/change-trace-infobar-message.patch b/resources/patches/ungoogled-chromium/change-trace-infobar-message.patch deleted file mode 100644 index 6c78948c..00000000 --- a/resources/patches/ungoogled-chromium/change-trace-infobar-message.patch +++ /dev/null @@ -1,13 +0,0 @@ -# Change the message displayed by Iridium's trace infobar to reflect prevent-trace-url-requests.patch - ---- a/iridium/trkbar.cpp -+++ b/iridium/trkbar.cpp -@@ -29,7 +29,7 @@ TrkBar::TrkBar(const GURL &url) : - - base::string16 TrkBar::GetMessageText(void) const - { -- return base::ASCIIToUTF16("Loading traced URL: " + m_url.spec()); -+ return base::ASCIIToUTF16("Blocked attempted request to: " + m_url.spec()); - } - - int TrkBar::GetButtons(void) const diff --git a/resources/patches/ungoogled-chromium/clear-http-auth-cache-menu-item.patch b/resources/patches/ungoogled-chromium/clear-http-auth-cache-menu-item.patch index e32b847e..d25eaba4 100644 --- a/resources/patches/ungoogled-chromium/clear-http-auth-cache-menu-item.patch +++ b/resources/patches/ungoogled-chromium/clear-http-auth-cache-menu-item.patch @@ -12,7 +12,7 @@ #define IDC_BOOKMARKS_MENU 40029 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd -@@ -1064,6 +1064,9 @@ +@@ -1064,6 +1064,9 @@ are declared in build/common.gypi. &Clear browsing data... @@ -22,7 +22,7 @@ &Downloads -@@ -1102,6 +1105,9 @@ +@@ -1102,6 +1105,9 @@ are declared in build/common.gypi. &Clear Browsing Data... @@ -34,7 +34,7 @@ --- a/chrome/browser/ui/toolbar/app_menu_model.cc +++ b/chrome/browser/ui/toolbar/app_menu_model.cc -@@ -215,6 +215,7 @@ +@@ -215,6 +215,7 @@ void ToolsMenuModel::Build(Browser* brow AddSeparator(ui::NORMAL_SEPARATOR); AddItemWithStringId(IDC_CLEAR_BROWSING_DATA, IDS_CLEAR_BROWSING_DATA); @@ -42,7 +42,7 @@ AddItemWithStringId(IDC_MANAGE_EXTENSIONS, IDS_SHOW_EXTENSIONS); if (chrome::CanOpenTaskManager()) AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); -@@ -475,6 +476,13 @@ +@@ -475,6 +476,13 @@ void AppMenuModel::LogMenuMetrics(int co } LogMenuAction(MENU_ACTION_CLEAR_BROWSING_DATA); break; @@ -58,7 +58,7 @@ UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.ViewSource", delta); --- a/chrome/browser/ui/toolbar/app_menu_model.h +++ b/chrome/browser/ui/toolbar/app_menu_model.h -@@ -76,6 +76,7 @@ +@@ -76,6 +76,7 @@ enum AppMenuAction { MENU_ACTION_OPEN_IN_CHROME = 48, MENU_ACTION_SITE_SETTINGS = 49, MENU_ACTION_APP_INFO = 50, @@ -68,7 +68,7 @@ --- a/chrome/browser/ui/views/frame/global_menu_bar_x11.cc +++ b/chrome/browser/ui/views/frame/global_menu_bar_x11.cc -@@ -225,6 +225,7 @@ +@@ -225,6 +225,7 @@ GlobalMenuBarCommand tools_menu[] = { {IDS_TASK_MANAGER, IDC_TASK_MANAGER}, {IDS_CLEAR_BROWSING_DATA, IDC_CLEAR_BROWSING_DATA}, @@ -88,7 +88,7 @@ #if defined(OS_MACOSX) #include "chrome/browser/ui/browser_commands_mac.h" -@@ -625,6 +628,9 @@ +@@ -625,6 +628,9 @@ bool BrowserCommandController::ExecuteCo case IDC_CLEAR_BROWSING_DATA: ShowClearBrowsingDataDialog(browser_); break; @@ -98,7 +98,7 @@ case IDC_IMPORT_SETTINGS: ShowImportDialog(browser_); break; -@@ -867,6 +873,7 @@ +@@ -867,6 +873,7 @@ void BrowserCommandController::InitComma !profile()->IsOffTheRecord()); command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA, !guest_session); @@ -108,7 +108,7 @@ #else --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml -@@ -112591,6 +112591,7 @@ +@@ -112591,6 +112591,7 @@ http://cs/file:chrome/histograms.xml - b @@ -118,7 +118,7 @@ --- a/net/http/http_auth_cache.cc +++ b/net/http/http_auth_cache.cc -@@ -250,6 +250,10 @@ +@@ -250,6 +250,10 @@ bool HttpAuthCache::Remove(const GURL& o return false; } @@ -131,7 +131,7 @@ base::EraseIf(entries_, [begin_time](const Entry& entry) { --- a/net/http/http_auth_cache.h +++ b/net/http/http_auth_cache.h -@@ -166,6 +166,8 @@ +@@ -166,6 +166,8 @@ class NET_EXPORT HttpAuthCache { HttpAuth::Scheme scheme, const AuthCredentials& credentials); @@ -142,7 +142,7 @@ --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml -@@ -46155,6 +46155,7 @@ +@@ -46154,6 +46154,7 @@ Called by update_traffic_annotation_hist diff --git a/resources/patches/ungoogled-chromium/disable-logging-urls-to-stderr.patch b/resources/patches/ungoogled-chromium/disable-logging-urls-to-stderr.patch deleted file mode 100644 index 05caab6c..00000000 --- a/resources/patches/ungoogled-chromium/disable-logging-urls-to-stderr.patch +++ /dev/null @@ -1,63 +0,0 @@ -# Disable log_url_request, which logs URLs to stderr - ---- a/iridium/trknotify.cpp -+++ b/iridium/trknotify.cpp -@@ -4,10 +4,6 @@ - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ --#include --#ifdef __linux__ --# include --#endif - #include "chrome/browser/infobars/infobar_service.h" - #include "chrome/browser/ui/browser.h" - #include "chrome/browser/ui/browser_finder.h" -@@ -19,27 +15,6 @@ - - namespace iridium { - --void log_url_request(const std::string &caller, const GURL &url) --{ --#ifdef __linux__ -- bool tty = isatty(fileno(stderr)); --#else -- bool tty = false; --#endif -- const char *xred = tty ? "\033[1;37;41m" : ""; // ] -- const char *xfruit = tty ? "\033[33m" : ""; // ] -- const char *xdark = tty ? "\033[1;30m" : ""; // ] -- const char *xreset = tty ? "\033[0m" : ""; // ] -- -- if (url.scheme() == url::kTraceScheme) -- fprintf(stderr, "%s*** %s(%s)%s\n", xred, caller.c_str(), -- url.possibly_invalid_spec().c_str(), xreset); -- else -- fprintf(stderr, "%s***%s %s(%s)%s\n", xfruit, xdark, -- caller.c_str(), url.possibly_invalid_spec().c_str(), -- xreset); --} -- - static void __trace_url_request(const std::string &caller, const GURL &url) - { - auto browser = chrome::FindLastActive(); ---- a/iridium/trknotify.h -+++ b/iridium/trknotify.h -@@ -12,7 +12,6 @@ - - namespace iridium { - --extern void log_url_request(const std::string &, const GURL &); - extern void trace_url_request(const std::string &, const GURL &); - - }; /* namespace iridium */ ---- a/chrome/app/chrome_main.cc -+++ b/chrome/app/chrome_main.cc -@@ -56,7 +56,6 @@ int ChromeMain(int argc, const char** ar - #if !defined(CHROME_MULTIPLE_DLL_CHILD) - static void trace_url_request(const std::string &caller, const GURL &url) - { -- iridium::log_url_request(caller, url); - if (url.scheme() != url::kTraceScheme) - /* Do not show infobar for non-trk URLs */ - return; diff --git a/resources/patches/ungoogled-chromium/disable-mei-preload.patch b/resources/patches/ungoogled-chromium/disable-mei-preload.patch index 3623c677..db773e6f 100644 --- a/resources/patches/ungoogled-chromium/disable-mei-preload.patch +++ b/resources/patches/ungoogled-chromium/disable-mei-preload.patch @@ -7,7 +7,7 @@ --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn -@@ -304,7 +304,6 @@ +@@ -303,7 +303,6 @@ if (!is_android && !is_mac) { } data_deps += [ @@ -15,7 +15,7 @@ "//third_party/widevine/cdm:widevinecdmadapter", ] -@@ -1239,7 +1238,6 @@ +@@ -1237,7 +1236,6 @@ if (is_win) { ":widevine_cdm_library", "//build/config:exe_and_shlib_deps", "//chrome/app/nibs:chrome_xibs", diff --git a/resources/patches/ungoogled-chromium/intercept-all-modified-domains.patch b/resources/patches/ungoogled-chromium/intercept-all-modified-domains.patch deleted file mode 100644 index f4de3ecd..00000000 --- a/resources/patches/ungoogled-chromium/intercept-all-modified-domains.patch +++ /dev/null @@ -1,57 +0,0 @@ -# Intercept all URLs with 'qjz9zk' in it (the domain added with domain_patcher.sh) - ---- a/chrome/app/chrome_main.cc -+++ b/chrome/app/chrome_main.cc -@@ -20,6 +20,7 @@ - #if !defined(CHROME_MULTIPLE_DLL_CHILD) - # include "net/url_request/url_request.h" - # include "iridium/trknotify.h" -+# include "base/strings/string_util.h" - #endif - - #if BUILDFLAG(ENABLE_MUS) -@@ -56,11 +57,13 @@ int ChromeMain(int argc, const char** ar - #if !defined(CHROME_MULTIPLE_DLL_CHILD) - static void trace_url_request(const std::string &caller, const GURL &url) - { -- if (url.scheme() != url::kTraceScheme) -- /* Do not show infobar for non-trk URLs */ -- return; -- if (url.is_trq()) -- return; -+ if (!base::EndsWith(url.host(), "qjz9zk", base::CompareCase::INSENSITIVE_ASCII)) { -+ if (url.scheme() != url::kTraceScheme) -+ /* Do not show infobar for non-trk URLs */ -+ return; -+ if (url.is_trq()) -+ return; -+ } - iridium::trace_url_request(caller, url); - } - #endif ---- a/content/browser/browser_url_handler_impl.cc -+++ b/content/browser/browser_url_handler_impl.cc -@@ -20,8 +20,10 @@ namespace content { - - static bool handle_trace_scheme(GURL *url, BrowserContext *) - { -- if (!url->SchemeIs(url::kTraceScheme)) -- return false; -+ if (!base::EndsWith(url->host(), "qjz9zk", base::CompareCase::INSENSITIVE_ASCII)) { -+ if (!url->SchemeIs(url::kTraceScheme)) -+ return false; -+ } - if (net::trace_urlreq_cb != NULL) - (*net::trace_urlreq_cb)("handle_trace_scheme", *url); - *url = url->strip_trk(); ---- a/url/gurl.cc -+++ b/url/gurl.cc -@@ -484,7 +484,7 @@ bool gurl_is_trq(const std::string &s) - - GURL GURL::strip_trk(void) const - { -- if (!SchemeIs(url::kTraceScheme)) -+ if (!SchemeIs(url::kTraceScheme) && !base::EndsWith(this->host(), "qjz9zk", base::CompareCase::INSENSITIVE_ASCII)) - return *this; - auto s = spec(); - return GURL(gurl_strip_trk(s)); diff --git a/resources/patches/ungoogled-chromium/prevent-trace-url-requests.patch b/resources/patches/ungoogled-chromium/prevent-trace-url-requests.patch deleted file mode 100644 index 83255975..00000000 --- a/resources/patches/ungoogled-chromium/prevent-trace-url-requests.patch +++ /dev/null @@ -1,48 +0,0 @@ -# Stop requests on inner URLs of "trk:" URLs - ---- a/url/gurl.cc -+++ b/url/gurl.cc -@@ -472,15 +472,7 @@ - - std::string &gurl_strip_trk(std::string &s) - { -- auto slen = strlen(url::kTraceScheme); -- if (!isdigit(s[slen+1])) -- /* trk:https://... */ -- return s.erase(0, slen); -- /* trk:123:https://... (or so we hope) */ -- auto pos = s.find(':', slen + 1); -- if (pos == std::string::npos) -- return s.erase(0, slen); -- return s.erase(0, pos + 1); -+ s.clear(); s.append("about:blank"); return s; - } - - bool gurl_is_trq(const std::string &s) ---- a/chrome/browser/ui/browser_navigator.cc -+++ b/chrome/browser/ui/browser_navigator.cc -@@ -697,10 +697,7 @@ - } - - if (url.SchemeIs(url::kTraceScheme)) { -- /* Same as view-source:, strip prefix and re-check. */ -- auto url2 = url.strip_trk(); -- return url2.is_valid() && -- IsURLAllowedInIncognito(url2, browser_context); -+ return false; - } - - // Most URLs are allowed in incognito; the following are exceptions. ---- a/components/url_formatter/url_fixer.cc -+++ b/components/url_formatter/url_fixer.cc -@@ -539,6 +539,10 @@ - } - } - -+ if (scheme == url::kTraceScheme) { -+ return GURL(); -+ } -+ - // We handle the file scheme separately. - if (scheme == url::kFileScheme) - return GURL(parts.scheme.is_valid() ? text : FixupPath(text));