256 lines
9.6 KiB
Diff
256 lines
9.6 KiB
Diff
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
|
Date: Sat, 25 Aug 2018 22:58:52 +0200
|
|
Subject: ungoogled-chromium: Disable domain reliability
|
|
|
|
---
|
|
.../domain_reliability/service_factory.cc | 24 +----------
|
|
components/domain_reliability/BUILD.gn | 42 +++++++------------
|
|
.../domain_reliability/bake_in_configs.py | 2 +-
|
|
.../domain_reliability/context_manager.cc | 22 +---------
|
|
.../domain_reliability/google_configs.cc | 10 ++---
|
|
.../domain_reliability/google_configs.h | 8 ++--
|
|
components/domain_reliability/uploader.cc | 2 +-
|
|
components/google/core/common/google_util.cc | 4 +-
|
|
8 files changed, 30 insertions(+), 84 deletions(-)
|
|
|
|
diff --git a/chrome/browser/domain_reliability/service_factory.cc b/chrome/browser/domain_reliability/service_factory.cc
|
|
--- a/chrome/browser/domain_reliability/service_factory.cc
|
|
+++ b/chrome/browser/domain_reliability/service_factory.cc
|
|
@@ -11,34 +11,12 @@
|
|
|
|
namespace domain_reliability {
|
|
|
|
-namespace {
|
|
-
|
|
-// If Domain Reliability is enabled in the absence of a flag or field trial.
|
|
-const bool kDefaultEnabled = true;
|
|
-
|
|
-// The name and value of the field trial to turn Domain Reliability on.
|
|
-const char kFieldTrialName[] = "DomRel-Enable";
|
|
-const char kFieldTrialValueEnable[] = "enable";
|
|
-
|
|
-} // namespace
|
|
-
|
|
// Identifies Chrome as the source of Domain Reliability uploads it sends.
|
|
const char DomainReliabilityServiceFactory::kUploadReporterString[] = "chrome";
|
|
|
|
// static
|
|
bool DomainReliabilityServiceFactory::ShouldCreateService() {
|
|
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
|
- if (command_line->HasSwitch(switches::kDisableDomainReliability))
|
|
- return false;
|
|
- if (command_line->HasSwitch(switches::kEnableDomainReliability))
|
|
- return true;
|
|
- if (!ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled())
|
|
- return false;
|
|
- if (base::FieldTrialList::TrialExists(kFieldTrialName)) {
|
|
- std::string value = base::FieldTrialList::FindFullName(kFieldTrialName);
|
|
- return (value == kFieldTrialValueEnable);
|
|
- }
|
|
- return kDefaultEnabled;
|
|
+ return false;
|
|
}
|
|
|
|
} // namespace domain_reliability
|
|
diff --git a/components/domain_reliability/BUILD.gn b/components/domain_reliability/BUILD.gn
|
|
--- a/components/domain_reliability/BUILD.gn
|
|
+++ b/components/domain_reliability/BUILD.gn
|
|
@@ -7,26 +7,6 @@ action("bake_in_configs") {
|
|
script = "bake_in_configs.py"
|
|
|
|
inputs = [
|
|
- "baked_in_configs/c_android_clients_google_com.json",
|
|
- "baked_in_configs/c_bigcache_googleapis_com.json",
|
|
- "baked_in_configs/c_doc-0-0-sj_sj_googleusercontent_com.json",
|
|
- "baked_in_configs/c_docs_google_com.json",
|
|
- "baked_in_configs/c_drive_google_com.json",
|
|
- "baked_in_configs/c_googlesyndication_com.json",
|
|
- "baked_in_configs/c_pack_google_com.json",
|
|
- "baked_in_configs/c_play_google_com.json",
|
|
- "baked_in_configs/c_youtube_com.json",
|
|
- "baked_in_configs/clients2_google_com.json",
|
|
- "baked_in_configs/docs_google_com.json",
|
|
- "baked_in_configs/gcp_gvt2_com.json",
|
|
- "baked_in_configs/gcp_gvt6_com.json",
|
|
- "baked_in_configs/google-analytics_com.json",
|
|
- "baked_in_configs/googlevideo_com.json",
|
|
- "baked_in_configs/gvt1_com.json",
|
|
- "baked_in_configs/gvt2_com.json",
|
|
- "baked_in_configs/gvt6_com.json",
|
|
- "baked_in_configs/ssl_gstatic_com.json",
|
|
- "baked_in_configs/www_google_com.json",
|
|
]
|
|
|
|
output_file = "$target_gen_dir/baked_in_configs.cc"
|
|
@@ -34,13 +14,21 @@ action("bake_in_configs") {
|
|
|
|
# The JSON file list is too long for the command line on Windows, so put
|
|
# them in a response file.
|
|
- response_file_contents = rebase_path(inputs, root_build_dir)
|
|
- args = [
|
|
- "--file-list",
|
|
- "{{response_file_name}}",
|
|
- "--output",
|
|
- rebase_path(output_file, root_build_dir),
|
|
- ]
|
|
+ if (is_win) {
|
|
+ args = [
|
|
+ "--file-list",
|
|
+ "nul",
|
|
+ "--output",
|
|
+ rebase_path(output_file, root_build_dir),
|
|
+ ]
|
|
+ } else {
|
|
+ args = [
|
|
+ "--file-list",
|
|
+ "/dev/null",
|
|
+ "--output",
|
|
+ rebase_path(output_file, root_build_dir),
|
|
+ ]
|
|
+ }
|
|
}
|
|
|
|
component("domain_reliability") {
|
|
diff --git a/components/domain_reliability/bake_in_configs.py b/components/domain_reliability/bake_in_configs.py
|
|
--- a/components/domain_reliability/bake_in_configs.py
|
|
+++ b/components/domain_reliability/bake_in_configs.py
|
|
@@ -490,7 +490,7 @@ def origin_is_whitelisted(origin):
|
|
domain = origin[8:-1]
|
|
else:
|
|
return False
|
|
- return any(domain == e or domain.endswith('.' + e) for e in DOMAIN_WHITELIST)
|
|
+ return False
|
|
|
|
|
|
def quote_and_wrap_text(text, width=79, prefix=' "', suffix='"'):
|
|
diff --git a/components/domain_reliability/context_manager.cc b/components/domain_reliability/context_manager.cc
|
|
--- a/components/domain_reliability/context_manager.cc
|
|
+++ b/components/domain_reliability/context_manager.cc
|
|
@@ -41,26 +41,8 @@ void DomainReliabilityContextManager::RouteBeacon(
|
|
DomainReliabilityContext* superdomain_context =
|
|
GetSuperdomainContext(beacon_host);
|
|
|
|
- // Try to get a Google config which may match the host itself, or the host's
|
|
- // parent domain.
|
|
- std::unique_ptr<const DomainReliabilityConfig> google_config =
|
|
- MaybeGetGoogleConfig(beacon_host);
|
|
-
|
|
- if (!google_config) {
|
|
- if (superdomain_context)
|
|
- superdomain_context->OnBeacon(std::move(beacon));
|
|
- return;
|
|
- }
|
|
-
|
|
- context_to_use = superdomain_context;
|
|
- bool google_config_is_exact = (google_config->origin.host() == beacon_host);
|
|
-
|
|
- // An exact match takes priority over an existing superdomain context, if any
|
|
- // exists.
|
|
- if (google_config_is_exact || !context_to_use)
|
|
- context_to_use = AddContextForConfig(std::move(google_config));
|
|
-
|
|
- context_to_use->OnBeacon(std::move(beacon));
|
|
+ if (superdomain_context)
|
|
+ superdomain_context->OnBeacon(std::move(beacon));
|
|
}
|
|
|
|
void DomainReliabilityContextManager::ClearBeacons(
|
|
diff --git a/components/domain_reliability/google_configs.cc b/components/domain_reliability/google_configs.cc
|
|
--- a/components/domain_reliability/google_configs.cc
|
|
+++ b/components/domain_reliability/google_configs.cc
|
|
@@ -9,7 +9,7 @@
|
|
#include "base/strings/string_util.h"
|
|
#include "net/base/url_util.h"
|
|
|
|
-namespace domain_reliability {
|
|
+namespace domain_reliability_disabled {
|
|
|
|
namespace {
|
|
|
|
@@ -28,7 +28,7 @@ struct GoogleConfigParams {
|
|
bool duplicate_for_www;
|
|
};
|
|
|
|
-const GoogleConfigParams kGoogleConfigs[] = {
|
|
+/*const GoogleConfigParams kGoogleConfigs[] = {
|
|
// Origins with subdomains and same-origin collectors. Currently, all
|
|
// origins with same-origin collectors also run collectors on their www
|
|
// subdomain. (e.g., both foo.com and www.foo.com.)
|
|
@@ -565,11 +565,11 @@ std::unique_ptr<const DomainReliabilityConfig> CreateGoogleConfig(
|
|
config->failure_sample_rate = 1.00;
|
|
config->path_prefixes.clear();
|
|
return config;
|
|
-}
|
|
+}*/
|
|
|
|
} // namespace
|
|
|
|
-std::unique_ptr<const DomainReliabilityConfig> MaybeGetGoogleConfig(
|
|
+/*std::unique_ptr<const DomainReliabilityConfig> MaybeGetGoogleConfig(
|
|
const std::string& hostname) {
|
|
bool is_www_subdomain =
|
|
base::StartsWith(hostname, "www.", base::CompareCase::SENSITIVE);
|
|
@@ -619,6 +619,6 @@ GetAllGoogleConfigsForTesting() {
|
|
configs_out.push_back(CreateGoogleConfig(params, true));
|
|
}
|
|
return configs_out;
|
|
-}
|
|
+} */
|
|
|
|
} // namespace domain_reliability
|
|
diff --git a/components/domain_reliability/google_configs.h b/components/domain_reliability/google_configs.h
|
|
--- a/components/domain_reliability/google_configs.h
|
|
+++ b/components/domain_reliability/google_configs.h
|
|
@@ -26,11 +26,11 @@ namespace domain_reliability {
|
|
// the www subdomain. A superdomain match occurs if removing the first label of
|
|
// |hostname| yields a string equal to a Google config's hostname and that
|
|
// config specifies that it includes subdomains.
|
|
-std::unique_ptr<const DomainReliabilityConfig> DOMAIN_RELIABILITY_EXPORT
|
|
-MaybeGetGoogleConfig(const std::string& hostname);
|
|
+//std::unique_ptr<const DomainReliabilityConfig> DOMAIN_RELIABILITY_EXPORT
|
|
+//MaybeGetGoogleConfig(const std::string& hostname);
|
|
|
|
-std::vector<std::unique_ptr<const DomainReliabilityConfig>>
|
|
- DOMAIN_RELIABILITY_EXPORT GetAllGoogleConfigsForTesting();
|
|
+//std::vector<std::unique_ptr<const DomainReliabilityConfig>>
|
|
+// DOMAIN_RELIABILITY_EXPORT GetAllGoogleConfigsForTesting();
|
|
|
|
} // namespace domain_reliability
|
|
|
|
diff --git a/components/domain_reliability/uploader.cc b/components/domain_reliability/uploader.cc
|
|
--- a/components/domain_reliability/uploader.cc
|
|
+++ b/components/domain_reliability/uploader.cc
|
|
@@ -79,7 +79,7 @@ class DomainReliabilityUploaderImpl : public DomainReliabilityUploader,
|
|
if (discard_uploads_)
|
|
discarded_upload_count_++;
|
|
|
|
- if (discard_uploads_ || shutdown_) {
|
|
+ if ((true)) {
|
|
DVLOG(1) << "Discarding report instead of uploading.";
|
|
UploadResult result;
|
|
result.status = UploadResult::SUCCESS;
|
|
diff --git a/components/google/core/common/google_util.cc b/components/google/core/common/google_util.cc
|
|
--- a/components/google/core/common/google_util.cc
|
|
+++ b/components/google/core/common/google_util.cc
|
|
@@ -43,7 +43,6 @@ GURL AppendGoogleLocaleParam(const GURL& url,
|
|
}
|
|
|
|
std::string GetGoogleCountryCode(const GURL& google_homepage_url) {
|
|
- base::StringPiece google_hostname = google_homepage_url.host_piece();
|
|
return std::string();
|
|
}
|
|
|
|
@@ -89,8 +88,7 @@ bool IsGoogleHostname(base::StringPiece host,
|
|
bool IsGoogleDomainUrl(const GURL& url,
|
|
SubdomainPermission subdomain_permission,
|
|
PortPermission port_permission) {
|
|
- return IsValidURL(url, port_permission) &&
|
|
- IsCanonicalHostGoogleHostname(url.host_piece(), subdomain_permission);
|
|
+ return false;
|
|
}
|
|
|
|
bool IsGoogleHomePageUrl(const GURL& url) {
|
|
--
|
|
2.17.1
|
|
|