diff options
Diffstat (limited to 'www/chromium-uc/patches/core/ungoogled-chromium/block-trk-and-subdomains.patch')
| -rw-r--r-- | www/chromium-uc/patches/core/ungoogled-chromium/block-trk-and-subdomains.patch | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/www/chromium-uc/patches/core/ungoogled-chromium/block-trk-and-subdomains.patch b/www/chromium-uc/patches/core/ungoogled-chromium/block-trk-and-subdomains.patch index f8e7844..8b68a77 100644 --- a/www/chromium-uc/patches/core/ungoogled-chromium/block-trk-and-subdomains.patch +++ b/www/chromium-uc/patches/core/ungoogled-chromium/block-trk-and-subdomains.patch | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | # Block all connection requests with 'qjz9zk' in the domain name or with a 'trk:' scheme. | 1 | # Block all connection requests with 'qjz9zk' in the domain name or with a 'trk:' scheme. |
| 2 | # This patch is based on Iridium's 'net: add "trk:" scheme and help identify URLs being retrieved' | 2 | # This patch is based on Iridium's 'net: add "trk:" scheme and help identify URLs being retrieved' |
| 3 | 3 | ||
| 4 | --- a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc | 4 | --- chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.orig |
| 5 | +++ b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc | 5 | +++ chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc |
| 6 | @@ -58,6 +58,7 @@ ChromeAutocompleteSchemeClassifier::GetI | 6 | @@ -56,6 +56,7 @@ ChromeAutocompleteSchemeClassifier::GetI |
| 7 | if (base::IsStringASCII(scheme) && | 7 | if (base::IsStringASCII(scheme) && |
| 8 | (ProfileIOData::IsHandledProtocol(scheme) || | 8 | (ProfileIOData::IsHandledProtocol(scheme) || |
| 9 | base::LowerCaseEqualsASCII(scheme, content::kViewSourceScheme) || | 9 | base::LowerCaseEqualsASCII(scheme, content::kViewSourceScheme) || |
| @@ -11,8 +11,8 @@ | |||
| 11 | base::LowerCaseEqualsASCII(scheme, url::kJavaScriptScheme) || | 11 | base::LowerCaseEqualsASCII(scheme, url::kJavaScriptScheme) || |
| 12 | base::LowerCaseEqualsASCII(scheme, url::kDataScheme))) { | 12 | base::LowerCaseEqualsASCII(scheme, url::kDataScheme))) { |
| 13 | return metrics::OmniboxInputType::URL; | 13 | return metrics::OmniboxInputType::URL; |
| 14 | --- a/chrome/browser/history/history_utils.cc | 14 | --- chrome/browser/history/history_utils.cc.orig |
| 15 | +++ b/chrome/browser/history/history_utils.cc | 15 | +++ chrome/browser/history/history_utils.cc |
| 16 | @@ -21,6 +21,7 @@ bool CanAddURLToHistory(const GURL& url) | 16 | @@ -21,6 +21,7 @@ bool CanAddURLToHistory(const GURL& url) |
| 17 | url.SchemeIs(content::kChromeDevToolsScheme) || | 17 | url.SchemeIs(content::kChromeDevToolsScheme) || |
| 18 | url.SchemeIs(content::kChromeUIScheme) || | 18 | url.SchemeIs(content::kChromeUIScheme) || |
| @@ -21,21 +21,21 @@ | |||
| 21 | url.SchemeIs(chrome::kChromeNativeScheme) || | 21 | url.SchemeIs(chrome::kChromeNativeScheme) || |
| 22 | url.SchemeIs(chrome::kChromeSearchScheme) || | 22 | url.SchemeIs(chrome::kChromeSearchScheme) || |
| 23 | url.SchemeIs(dom_distiller::kDomDistillerScheme)) | 23 | url.SchemeIs(dom_distiller::kDomDistillerScheme)) |
| 24 | --- a/chrome/browser/ui/singleton_tabs.cc | 24 | --- chrome/browser/ui/singleton_tabs.cc.orig |
| 25 | +++ b/chrome/browser/ui/singleton_tabs.cc | 25 | +++ chrome/browser/ui/singleton_tabs.cc |
| 26 | @@ -102,7 +102,8 @@ int GetIndexOfExistingTab(Browser* brows | 26 | @@ -99,7 +99,8 @@ int GetIndexOfExistingTab(Browser* brows |
| 27 | // RewriteURLIfNecessary removes the "view-source:" scheme which could lead | 27 | |
| 28 | // to incorrect matching, so ensure that the target and the candidate are | 28 | // Skip view-source tabs. This is needed because RewriteURLIfNecessary |
| 29 | // either both view-source:, or neither is. | 29 | // removes the "view-source:" scheme which leads to incorrect matching. |
| 30 | - if (tab_url.SchemeIs(content::kViewSourceScheme) != target_is_view_source) { | 30 | - if (tab_url.SchemeIs(content::kViewSourceScheme)) |
| 31 | + if (tab_url.SchemeIs(content::kViewSourceScheme) != target_is_view_source || | 31 | + if (tab_url.SchemeIs(content::kViewSourceScheme) || |
| 32 | + tab_url.SchemeIs(url::kTraceScheme)) { | 32 | + tab_url.SchemeIs(url::kTraceScheme)) |
| 33 | continue; | 33 | continue; |
| 34 | } | ||
| 35 | 34 | ||
| 36 | --- a/components/omnibox/browser/autocomplete_input.cc | 35 | GURL rewritten_tab_url = tab_url; |
| 37 | +++ b/components/omnibox/browser/autocomplete_input.cc | 36 | --- components/omnibox/browser/autocomplete_input.cc.orig |
| 38 | @@ -560,7 +560,8 @@ void AutocompleteInput::ParseForEmphasiz | 37 | +++ components/omnibox/browser/autocomplete_input.cc |
| 38 | @@ -533,7 +533,8 @@ void AutocompleteInput::ParseForEmphasiz | ||
| 39 | // For the view-source and blob schemes, we should emphasize the host of the | 39 | // For the view-source and blob schemes, we should emphasize the host of the |
| 40 | // URL qualified by the view-source or blob prefix. | 40 | // URL qualified by the view-source or blob prefix. |
| 41 | if ((base::LowerCaseEqualsASCII(scheme_str, kViewSourceScheme) || | 41 | if ((base::LowerCaseEqualsASCII(scheme_str, kViewSourceScheme) || |
| @@ -45,8 +45,8 @@ | |||
| 45 | (static_cast<int>(text.length()) > after_scheme_and_colon)) { | 45 | (static_cast<int>(text.length()) > after_scheme_and_colon)) { |
| 46 | // Obtain the URL prefixed by view-source or blob and parse it. | 46 | // Obtain the URL prefixed by view-source or blob and parse it. |
| 47 | std::u16string real_url(text.substr(after_scheme_and_colon)); | 47 | std::u16string real_url(text.substr(after_scheme_and_colon)); |
| 48 | --- a/components/url_formatter/url_fixer.cc | 48 | --- components/url_formatter/url_fixer.cc.orig |
| 49 | +++ b/components/url_formatter/url_fixer.cc | 49 | +++ components/url_formatter/url_fixer.cc |
| 50 | @@ -562,6 +562,10 @@ GURL FixupURL(const std::string& text, c | 50 | @@ -562,6 +562,10 @@ GURL FixupURL(const std::string& text, c |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| @@ -58,19 +58,19 @@ | |||
| 58 | // We handle the file scheme separately. | 58 | // We handle the file scheme separately. |
| 59 | if (scheme == url::kFileScheme) | 59 | if (scheme == url::kFileScheme) |
| 60 | return GURL(parts.scheme.is_valid() ? text : FixupPath(text)); | 60 | return GURL(parts.scheme.is_valid() ? text : FixupPath(text)); |
| 61 | --- a/content/browser/child_process_security_policy_impl.cc | 61 | --- content/browser/child_process_security_policy_impl.cc.orig |
| 62 | +++ b/content/browser/child_process_security_policy_impl.cc | 62 | +++ content/browser/child_process_security_policy_impl.cc |
| 63 | @@ -735,6 +735,7 @@ ChildProcessSecurityPolicyImpl::ChildPro | 63 | @@ -861,6 +861,7 @@ ChildProcessSecurityPolicyImpl::ChildPro |
| 64 | RegisterWebSafeScheme(url::kWssScheme); | ||
| 65 | #endif // BUILDFLAG(ENABLE_WEBSOCKETS) | 64 | #endif // BUILDFLAG(ENABLE_WEBSOCKETS) |
| 65 | RegisterWebSafeScheme(url::kFtpScheme); | ||
| 66 | RegisterWebSafeScheme(url::kDataScheme); | 66 | RegisterWebSafeScheme(url::kDataScheme); |
| 67 | + RegisterWebSafeScheme(url::kTraceScheme); | 67 | + RegisterWebSafeScheme(url::kTraceScheme); |
| 68 | RegisterWebSafeScheme("feed"); | ||
| 68 | 69 | ||
| 69 | // TODO(nick): https://crbug.com/651534 blob: and filesystem: schemes embed | 70 | // TODO(nick): https://crbug.com/651534 blob: and filesystem: schemes embed |
| 70 | // other origins, so we should not treat them as web safe. Remove callers of | 71 | --- net/BUILD.gn.orig |
| 71 | --- a/net/BUILD.gn | 72 | +++ net/BUILD.gn |
| 72 | +++ b/net/BUILD.gn | 73 | @@ -1010,6 +1010,8 @@ component("net") { |
| 73 | @@ -1004,6 +1004,8 @@ component("net") { | ||
| 74 | "url_request/report_sender.h", | 74 | "url_request/report_sender.h", |
| 75 | "url_request/static_http_user_agent_settings.cc", | 75 | "url_request/static_http_user_agent_settings.cc", |
| 76 | "url_request/static_http_user_agent_settings.h", | 76 | "url_request/static_http_user_agent_settings.h", |
| @@ -80,7 +80,7 @@ | |||
| 80 | "url_request/url_fetcher.h", | 80 | "url_request/url_fetcher.h", |
| 81 | "url_request/url_fetcher_core.cc", | 81 | "url_request/url_fetcher_core.cc", |
| 82 | --- /dev/null | 82 | --- /dev/null |
| 83 | +++ b/net/url_request/trk_protocol_handler.cc | 83 | +++ net/url_request/trk_protocol_handler.cc |
| 84 | @@ -0,0 +1,25 @@ | 84 | @@ -0,0 +1,25 @@ |
| 85 | +// Copyright (c) 2018 The ungoogled-chromium Authors. All rights reserved. | 85 | +// Copyright (c) 2018 The ungoogled-chromium Authors. All rights reserved. |
| 86 | +// Use of this source code is governed by a BSD-style license that can be | 86 | +// Use of this source code is governed by a BSD-style license that can be |
| @@ -108,8 +108,8 @@ | |||
| 108 | + | 108 | + |
| 109 | +} // namespace net | 109 | +} // namespace net |
| 110 | --- /dev/null | 110 | --- /dev/null |
| 111 | +++ b/net/url_request/trk_protocol_handler.h | 111 | +++ net/url_request/trk_protocol_handler.h |
| 112 | @@ -0,0 +1,30 @@ | 112 | @@ -0,0 +1,32 @@ |
| 113 | +// Copyright (c) 2018 The ungoogled-chromium Authors. All rights reserved. | 113 | +// Copyright (c) 2018 The ungoogled-chromium Authors. All rights reserved. |
| 114 | +// Use of this source code is governed by a BSD-style license that can be | 114 | +// Use of this source code is governed by a BSD-style license that can be |
| 115 | +// found in the LICENSE file. | 115 | +// found in the LICENSE file. |
| @@ -118,6 +118,7 @@ | |||
| 118 | +#define NET_URL_REQUEST_TRK_PROTOCOL_HANDLER_H_ | 118 | +#define NET_URL_REQUEST_TRK_PROTOCOL_HANDLER_H_ |
| 119 | + | 119 | + |
| 120 | +#include "base/compiler_specific.h" | 120 | +#include "base/compiler_specific.h" |
| 121 | +#include "base/macros.h" | ||
| 121 | +#include "net/base/net_export.h" | 122 | +#include "net/base/net_export.h" |
| 122 | +#include "net/url_request/url_request_job_factory.h" | 123 | +#include "net/url_request/url_request_job_factory.h" |
| 123 | + | 124 | + |
| @@ -130,18 +131,19 @@ | |||
| 130 | + : public URLRequestJobFactory::ProtocolHandler { | 131 | + : public URLRequestJobFactory::ProtocolHandler { |
| 131 | + public: | 132 | + public: |
| 132 | + TrkProtocolHandler(); | 133 | + TrkProtocolHandler(); |
| 133 | + TrkProtocolHandler(const TrkProtocolHandler&) = delete; | ||
| 134 | + TrkProtocolHandler& operator=(const TrkProtocolHandler&) = delete; | ||
| 135 | + std::unique_ptr<URLRequestJob> CreateJob( | 134 | + std::unique_ptr<URLRequestJob> CreateJob( |
| 136 | + URLRequest* request) const override; | 135 | + URLRequest* request) const override; |
| 137 | + bool IsSafeRedirectTarget(const GURL& location) const override; | 136 | + bool IsSafeRedirectTarget(const GURL& location) const override; |
| 137 | + | ||
| 138 | + private: | ||
| 139 | + DISALLOW_COPY_AND_ASSIGN(TrkProtocolHandler); | ||
| 138 | +}; | 140 | +}; |
| 139 | + | 141 | + |
| 140 | +} // namespace net | 142 | +} // namespace net |
| 141 | + | 143 | + |
| 142 | +#endif // NET_URL_REQUEST_TRK_PROTOCOL_HANDLER_H_ | 144 | +#endif // NET_URL_REQUEST_TRK_PROTOCOL_HANDLER_H_ |
| 143 | --- a/net/url_request/url_request.cc | 145 | --- net/url_request/url_request.cc.orig |
| 144 | +++ b/net/url_request/url_request.cc | 146 | +++ net/url_request/url_request.cc |
| 145 | @@ -12,6 +12,7 @@ | 147 | @@ -12,6 +12,7 @@ |
| 146 | #include "base/compiler_specific.h" | 148 | #include "base/compiler_specific.h" |
| 147 | #include "base/metrics/histogram_macros.h" | 149 | #include "base/metrics/histogram_macros.h" |
| @@ -150,7 +152,7 @@ | |||
| 150 | #include "base/strings/utf_string_conversions.h" | 152 | #include "base/strings/utf_string_conversions.h" |
| 151 | #include "base/synchronization/lock.h" | 153 | #include "base/synchronization/lock.h" |
| 152 | #include "base/threading/thread_task_runner_handle.h" | 154 | #include "base/threading/thread_task_runner_handle.h" |
| 153 | @@ -45,6 +46,7 @@ | 155 | @@ -46,6 +47,7 @@ |
| 154 | #include "net/url_request/url_request_redirect_job.h" | 156 | #include "net/url_request/url_request_redirect_job.h" |
| 155 | #include "url/gurl.h" | 157 | #include "url/gurl.h" |
| 156 | #include "url/origin.h" | 158 | #include "url/origin.h" |
| @@ -158,7 +160,7 @@ | |||
| 158 | 160 | ||
| 159 | using base::Time; | 161 | using base::Time; |
| 160 | using std::string; | 162 | using std::string; |
| 161 | @@ -609,6 +611,12 @@ URLRequest::URLRequest(const GURL& url, | 163 | @@ -595,6 +597,12 @@ URLRequest::URLRequest(const GURL& url, |
| 162 | // Sanity check out environment. | 164 | // Sanity check out environment. |
| 163 | DCHECK(base::ThreadTaskRunnerHandle::IsSet()); | 165 | DCHECK(base::ThreadTaskRunnerHandle::IsSet()); |
| 164 | 166 | ||
| @@ -171,17 +173,17 @@ | |||
| 171 | context->url_requests()->insert(this); | 173 | context->url_requests()->insert(this); |
| 172 | net_log_.BeginEvent(NetLogEventType::REQUEST_ALIVE, [&] { | 174 | net_log_.BeginEvent(NetLogEventType::REQUEST_ALIVE, [&] { |
| 173 | return NetLogURLRequestConstructorParams(url, priority_, | 175 | return NetLogURLRequestConstructorParams(url, priority_, |
| 174 | --- a/net/url_request/url_request_context_builder.cc | 176 | --- net/url_request/url_request_context_builder.cc.orig |
| 175 | +++ b/net/url_request/url_request_context_builder.cc | 177 | +++ net/url_request/url_request_context_builder.cc |
| 176 | @@ -47,6 +47,7 @@ | 178 | @@ -46,6 +46,7 @@ |
| 177 | #include "net/socket/network_binding_client_socket_factory.h" | 179 | #include "net/quic/quic_stream_factory.h" |
| 178 | #include "net/ssl/ssl_config_service_defaults.h" | 180 | #include "net/ssl/ssl_config_service_defaults.h" |
| 179 | #include "net/url_request/static_http_user_agent_settings.h" | 181 | #include "net/url_request/static_http_user_agent_settings.h" |
| 180 | +#include "net/url_request/trk_protocol_handler.h" | 182 | +#include "net/url_request/trk_protocol_handler.h" |
| 181 | #include "net/url_request/url_request_context.h" | 183 | #include "net/url_request/url_request_context.h" |
| 182 | #include "net/url_request/url_request_context_storage.h" | 184 | #include "net/url_request/url_request_context_storage.h" |
| 183 | #include "net/url_request/url_request_job_factory.h" | 185 | #include "net/url_request/url_request_job_factory.h" |
| 184 | @@ -628,6 +629,9 @@ std::unique_ptr<URLRequestContext> URLRe | 186 | @@ -546,6 +547,9 @@ std::unique_ptr<URLRequestContext> URLRe |
| 185 | } | 187 | } |
| 186 | protocol_handlers_.clear(); | 188 | protocol_handlers_.clear(); |
| 187 | 189 | ||
| @@ -191,30 +193,28 @@ | |||
| 191 | storage->set_job_factory(std::move(job_factory)); | 193 | storage->set_job_factory(std::move(job_factory)); |
| 192 | 194 | ||
| 193 | return std::move(context); | 195 | return std::move(context); |
| 194 | --- a/url/url_constants.cc | 196 | --- url/url_constants.cc.orig |
| 195 | +++ b/url/url_constants.cc | 197 | +++ url/url_constants.cc |
| 196 | @@ -46,6 +46,8 @@ const char kQuicTransportScheme[] = "qui | 198 | @@ -28,6 +28,7 @@ const char kMailToScheme[] = "mailto"; |
| 197 | const char16_t kQuicTransportScheme16[] = u"quic-transport"; | 199 | // See also: https://www.iana.org/assignments/uri-schemes/prov/quic-transport |
| 200 | const char kQuicTransportScheme[] = "quic-transport"; | ||
| 198 | const char kTelScheme[] = "tel"; | 201 | const char kTelScheme[] = "tel"; |
| 199 | const char16_t kTelScheme16[] = u"tel"; | ||
| 200 | +const char kTraceScheme[] = "trk"; | 202 | +const char kTraceScheme[] = "trk"; |
| 201 | +const char16_t kTraceScheme16[] = u"trk"; | ||
| 202 | const char kUrnScheme[] = "urn"; | 203 | const char kUrnScheme[] = "urn"; |
| 203 | const char16_t kUrnScheme16[] = u"urn"; | 204 | const char kWsScheme[] = "ws"; |
| 204 | const char kUuidInPackageScheme[] = "uuid-in-package"; | 205 | const char kWssScheme[] = "wss"; |
| 205 | --- a/url/url_constants.h | 206 | --- url/url_constants.h.orig |
| 206 | +++ b/url/url_constants.h | 207 | +++ url/url_constants.h |
| 207 | @@ -50,6 +50,8 @@ COMPONENT_EXPORT(URL) extern const char | 208 | @@ -32,6 +32,7 @@ COMPONENT_EXPORT(URL) extern const char |
| 208 | COMPONENT_EXPORT(URL) extern const char16_t kQuicTransportScheme16[]; | 209 | COMPONENT_EXPORT(URL) extern const char kMailToScheme[]; |
| 210 | COMPONENT_EXPORT(URL) extern const char kQuicTransportScheme[]; | ||
| 209 | COMPONENT_EXPORT(URL) extern const char kTelScheme[]; | 211 | COMPONENT_EXPORT(URL) extern const char kTelScheme[]; |
| 210 | COMPONENT_EXPORT(URL) extern const char16_t kTelScheme16[]; | ||
| 211 | +COMPONENT_EXPORT(URL) extern const char kTraceScheme[]; | 212 | +COMPONENT_EXPORT(URL) extern const char kTraceScheme[]; |
| 212 | +COMPONENT_EXPORT(URL) extern const char16_t kTraceScheme16[]; | ||
| 213 | COMPONENT_EXPORT(URL) extern const char kUrnScheme[]; | 213 | COMPONENT_EXPORT(URL) extern const char kUrnScheme[]; |
| 214 | COMPONENT_EXPORT(URL) extern const char16_t kUrnScheme16[]; | 214 | COMPONENT_EXPORT(URL) extern const char kWsScheme[]; |
| 215 | COMPONENT_EXPORT(URL) extern const char kUuidInPackageScheme[]; | 215 | COMPONENT_EXPORT(URL) extern const char kWssScheme[]; |
| 216 | --- a/url/url_util.cc | 216 | --- url/url_util.cc.orig |
| 217 | +++ b/url/url_util.cc | 217 | +++ url/url_util.cc |
| 218 | @@ -63,7 +63,7 @@ struct SchemeRegistry { | 218 | @@ -63,7 +63,7 @@ struct SchemeRegistry { |
| 219 | 219 | ||
| 220 | // Schemes that do not trigger mixed content warning. | 220 | // Schemes that do not trigger mixed content warning. |
