disable-webstore-urls.patch 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. # Disables Chrome Webstore-related URLs and other internal functionality. Mainly for disabling auto updates via the Chrome Webstore.
  2. --- a/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
  3. +++ b/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
  4. @@ -605,10 +605,6 @@ std::vector<url::Origin> ChromeContentBr
  5. GetOriginsRequiringDedicatedProcess() {
  6. std::vector<url::Origin> list;
  7. - // Require a dedicated process for the webstore origin. See
  8. - // https://crbug.com/939108.
  9. - list.push_back(url::Origin::Create(extension_urls::GetWebstoreLaunchURL()));
  10. -
  11. return list;
  12. }
  13. --- a/chrome/browser/extensions/chrome_content_verifier_delegate.cc
  14. +++ b/chrome/browser/extensions/chrome_content_verifier_delegate.cc
  15. @@ -286,13 +286,7 @@ bool ChromeContentVerifierDelegate::IsFr
  16. // between which extensions are considered in-store.
  17. // See https://crbug.com/766806 for details.
  18. if (!InstallVerifier::IsFromStore(extension)) {
  19. - // It's possible that the webstore update url was overridden for testing
  20. - // so also consider extensions with the default (production) update url
  21. - // to be from the store as well.
  22. - if (ManifestURL::GetUpdateURL(&extension) !=
  23. - extension_urls::GetDefaultWebstoreUpdateUrl()) {
  24. - return false;
  25. - }
  26. + return false;
  27. }
  28. return true;
  29. }
  30. --- a/chrome/browser/extensions/extension_migrator.cc
  31. +++ b/chrome/browser/extensions/extension_migrator.cc
  32. @@ -18,7 +18,9 @@ namespace extensions {
  33. ExtensionMigrator::ExtensionMigrator(Profile* profile,
  34. const std::string& old_id,
  35. const std::string& new_id)
  36. - : profile_(profile), old_id_(old_id), new_id_(new_id) {}
  37. + : profile_(profile), old_id_(old_id), new_id_(new_id) {
  38. + chrome_blank_ = GURL("chrome://blank/");
  39. +}
  40. ExtensionMigrator::~ExtensionMigrator() {
  41. }
  42. @@ -31,7 +33,7 @@ void ExtensionMigrator::StartLoading() {
  43. if (should_have_extension) {
  44. std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue);
  45. entry->SetKey(ExternalProviderImpl::kExternalUpdateUrl,
  46. - base::Value(extension_urls::GetWebstoreUpdateUrl().spec()));
  47. + base::Value(chrome_blank_.spec()));
  48. prefs->SetWithoutPathExpansion(new_id_, std::move(entry));
  49. }
  50. --- a/chrome/browser/extensions/extension_migrator.h
  51. +++ b/chrome/browser/extensions/extension_migrator.h
  52. @@ -9,6 +9,7 @@
  53. #include "base/macros.h"
  54. #include "chrome/browser/extensions/external_loader.h"
  55. +#include "url/gurl.h"
  56. class Profile;
  57. @@ -37,6 +38,7 @@ class ExtensionMigrator : public Externa
  58. Profile* profile_;
  59. const std::string old_id_;
  60. const std::string new_id_;
  61. + GURL chrome_blank_;
  62. DISALLOW_COPY_AND_ASSIGN(ExtensionMigrator);
  63. };
  64. --- a/extensions/browser/updater/extension_downloader.cc
  65. +++ b/extensions/browser/updater/extension_downloader.cc
  66. @@ -95,27 +95,18 @@ const char kNotFromWebstoreInstallSource
  67. const char kDefaultInstallSource[] = "";
  68. const char kReinstallInstallSource[] = "reinstall";
  69. -const char kGoogleDotCom[] = "google.com";
  70. const char kTokenServiceConsumerId[] = "extension_downloader";
  71. const char kWebstoreOAuth2Scope[] =
  72. - "https://www.googleapis.com/auth/chromewebstore.readonly";
  73. + "trk:10:https://www.googleapis.com/auth/chromewebstore.readonly";
  74. ExtensionDownloaderTestDelegate* g_test_delegate = nullptr;
  75. #define RETRY_HISTOGRAM(name, retry_count, url) \
  76. - if ((url).DomainIs(kGoogleDotCom)) { \
  77. - UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions." name "RetryCountGoogleUrl", \
  78. - retry_count, \
  79. - 1, \
  80. - kMaxRetries, \
  81. - kMaxRetries + 1); \
  82. - } else { \
  83. UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions." name "RetryCountOtherUrl", \
  84. retry_count, \
  85. 1, \
  86. kMaxRetries, \
  87. - kMaxRetries + 1); \
  88. - }
  89. + kMaxRetries + 1);
  90. bool ShouldRetryRequest(const network::SimpleURLLoader* loader) {
  91. DCHECK(loader);
  92. @@ -304,12 +295,6 @@ void ExtensionDownloader::DoStartAllPend
  93. ReportStats();
  94. url_stats_ = URLStats();
  95. - for (auto it = fetches_preparing_.begin(); it != fetches_preparing_.end();
  96. - ++it) {
  97. - std::vector<std::unique_ptr<ManifestFetchData>>& list = it->second;
  98. - for (size_t i = 0; i < list.size(); ++i)
  99. - StartUpdateCheck(std::move(list[i]));
  100. - }
  101. fetches_preparing_.clear();
  102. }
  103. @@ -343,11 +328,6 @@ bool ExtensionDownloader::AddExtensionDa
  104. return false;
  105. }
  106. - // Make sure we use SSL for store-hosted extensions.
  107. - if (extension_urls::IsWebstoreUpdateUrl(update_url) &&
  108. - !update_url.SchemeIsCryptographic())
  109. - update_url = extension_urls::GetWebstoreUpdateUrl();
  110. -
  111. // Skip extensions with empty IDs.
  112. if (id.empty()) {
  113. DLOG(WARNING) << "Found extension with empty ID";
  114. @@ -356,12 +336,10 @@ bool ExtensionDownloader::AddExtensionDa
  115. return false;
  116. }
  117. - if (update_url.DomainIs(kGoogleDotCom)) {
  118. - url_stats_.google_url_count++;
  119. - } else if (update_url.is_empty()) {
  120. + if (update_url.is_empty()) {
  121. url_stats_.no_url_count++;
  122. // Fill in default update URL.
  123. - update_url = extension_urls::GetWebstoreUpdateUrl();
  124. + update_url = GURL("chrome://blank/");
  125. } else {
  126. url_stats_.other_url_count++;
  127. }
  128. @@ -708,20 +686,6 @@ void ExtensionDownloader::HandleManifest
  129. fetch_data->request_ids()));
  130. }
  131. - // If the manifest response included a <daystart> element, we want to save
  132. - // that value for any extensions which had sent a ping in the request.
  133. - if (fetch_data->base_url().DomainIs(kGoogleDotCom) &&
  134. - results->daystart_elapsed_seconds >= 0) {
  135. - Time day_start =
  136. - Time::Now() - TimeDelta::FromSeconds(results->daystart_elapsed_seconds);
  137. -
  138. - for (const std::string& id : fetch_data->extension_ids()) {
  139. - ExtensionDownloaderDelegate::PingResult& result = ping_results_[id];
  140. - result.did_ping = fetch_data->DidPing(id, ManifestFetchData::ROLLCALL);
  141. - result.day_start = day_start;
  142. - }
  143. - }
  144. -
  145. NotifyExtensionsDownloadStageChanged(
  146. no_updates, ExtensionDownloaderDelegate::Stage::FINISHED);
  147. NotifyExtensionsDownloadFailed(
  148. @@ -1217,11 +1181,7 @@ bool ExtensionDownloader::IterateFetchCr
  149. // fetch.
  150. switch (fetch->credentials) {
  151. case ExtensionFetch::CREDENTIALS_NONE:
  152. - if (fetch->url.DomainIs(kGoogleDotCom) && identity_manager_) {
  153. - fetch->credentials = ExtensionFetch::CREDENTIALS_OAUTH2_TOKEN;
  154. - } else {
  155. - fetch->credentials = ExtensionFetch::CREDENTIALS_COOKIES;
  156. - }
  157. + fetch->credentials = ExtensionFetch::CREDENTIALS_COOKIES;
  158. return true;
  159. case ExtensionFetch::CREDENTIALS_OAUTH2_TOKEN:
  160. fetch->oauth2_attempt_count++;
  161. --- a/extensions/common/extension_urls.cc
  162. +++ b/extensions/common/extension_urls.cc
  163. @@ -30,7 +30,7 @@ bool IsSourceFromAnExtension(const base:
  164. namespace extension_urls {
  165. -const char kChromeWebstoreBaseURL[] = "https://chrome.google.com/webstore";
  166. +const char kChromeWebstoreBaseURL[] = "trk:09:https://chrome.google.com/webstore";
  167. const char kChromeWebstoreUpdateURL[] =
  168. "trk:05:https://clients2.google.com/service/update2/crx";