Files
helium/patches/core/ungoogled-chromium/disable-webstore-urls.patch

189 lines
7.6 KiB
Diff
Raw Normal View History

# Disables Chrome Webstore-related URLs and other internal functionality. Mainly for disabling auto updates via the Chrome Webstore.
--- a/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
+++ b/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
2025-07-30 18:19:08 -05:00
@@ -677,12 +677,6 @@ std::vector<url::Origin> ChromeContentBr
GetOriginsRequiringDedicatedProcess() {
std::vector<url::Origin> list;
- // Require a dedicated process for the webstore origin. See
- // https://crbug.com/939108.
- list.push_back(url::Origin::Create(extension_urls::GetWebstoreLaunchURL()));
2022-09-21 15:22:10 -05:00
- list.push_back(
- url::Origin::Create(extension_urls::GetNewWebstoreLaunchURL()));
-
return list;
}
--- a/chrome/browser/extensions/chrome_content_verifier_delegate.cc
+++ b/chrome/browser/extensions/chrome_content_verifier_delegate.cc
2025-05-21 18:16:56 -05:00
@@ -303,17 +303,7 @@ bool ChromeContentVerifierDelegate::IsFr
2017-12-07 14:59:09 -05:00
// between which extensions are considered in-store.
// See https://crbug.com/766806 for details.
2021-02-22 12:46:44 -06:00
if (!InstallVerifier::IsFromStore(extension, context_)) {
- // It's possible that the webstore update url was overridden for testing
- // so also consider extensions with the default (production) update url
2021-02-22 12:46:44 -06:00
- // to be from the store as well. Therefore update URL is compared with
- // |GetDefaultWebstoreUpdateUrl|, not the |GetWebstoreUpdateUrl| used by
- // |IsWebstoreUpdateUrl|.
- ExtensionManagement* extension_management =
- ExtensionManagementFactory::GetForBrowserContext(context_);
- if (extension_management->GetEffectiveUpdateURL(extension) !=
- extension_urls::GetDefaultWebstoreUpdateUrl()) {
2020-04-08 01:58:51 -04:00
- return false;
- }
2020-04-08 01:58:51 -04:00
+ return false;
}
2020-04-08 01:58:51 -04:00
return true;
}
--- a/chrome/browser/extensions/extension_migrator.cc
+++ b/chrome/browser/extensions/extension_migrator.cc
2023-04-26 10:38:53 -05:00
@@ -19,7 +19,9 @@ namespace extensions {
ExtensionMigrator::ExtensionMigrator(Profile* profile,
const std::string& old_id,
const std::string& new_id)
- : profile_(profile), old_id_(old_id), new_id_(new_id) {}
+ : profile_(profile), old_id_(old_id), new_id_(new_id) {
+ chrome_blank_ = GURL("chrome://blank/");
+}
2023-01-04 10:47:02 -06:00
ExtensionMigrator::~ExtensionMigrator() = default;
2023-04-26 10:38:53 -05:00
@@ -31,7 +33,7 @@ void ExtensionMigrator::StartLoading() {
if (should_have_extension) {
2023-01-04 10:47:02 -06:00
base::Value::Dict entry;
entry.Set(ExternalProviderImpl::kExternalUpdateUrl,
- extension_urls::GetWebstoreUpdateUrl().spec());
+ chrome_blank_.spec());
2023-01-04 10:47:02 -06:00
prefs.Set(new_id_, std::move(entry));
}
--- a/chrome/browser/extensions/extension_migrator.h
+++ b/chrome/browser/extensions/extension_migrator.h
2025-05-21 18:16:56 -05:00
@@ -10,6 +10,7 @@
#include "base/memory/raw_ptr.h"
#include "chrome/browser/extensions/external_loader.h"
2025-05-21 18:16:56 -05:00
#include "extensions/buildflags/buildflags.h"
+#include "url/gurl.h"
2025-05-21 18:16:56 -05:00
static_assert(BUILDFLAG(ENABLE_EXTENSIONS_CORE));
2025-05-21 18:16:56 -05:00
@@ -43,6 +44,7 @@ class ExtensionMigrator : public Externa
raw_ptr<Profile> profile_;
const std::string old_id_;
const std::string new_id_;
+ GURL chrome_blank_;
};
} // namespace extensions
--- a/extensions/browser/updater/extension_downloader.cc
+++ b/extensions/browser/updater/extension_downloader.cc
2024-03-12 10:35:41 -05:00
@@ -92,28 +92,19 @@ const char kNotFromWebstoreInstallSource
const char kDefaultInstallSource[] = "";
const char kReinstallInstallSource[] = "reinstall";
-const char kGoogleDotCom[] = "google.com";
const char kTokenServiceConsumerId[] = "extension_downloader";
const char kWebstoreOAuth2Scope[] =
- "https://www.googleapis.com/auth/chromewebstore.readonly";
+ "trk:10:https://www.googleapis.com/auth/chromewebstore.readonly";
2023-03-27 14:23:02 -05:00
ExtensionDownloader::TestObserver* g_test_observer = nullptr;
ExtensionDownloaderTestDelegate* g_test_delegate = nullptr;
#define RETRY_HISTOGRAM(name, retry_count, url) \
- if ((url).DomainIs(kGoogleDotCom)) { \
- UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions." name "RetryCountGoogleUrl", \
- retry_count, \
- 1, \
- kMaxRetries, \
- kMaxRetries + 1); \
- } else { \
UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions." name "RetryCountOtherUrl", \
retry_count, \
1, \
kMaxRetries, \
- kMaxRetries + 1); \
- }
+ kMaxRetries + 1);
bool ShouldRetryRequest(const network::SimpleURLLoader* loader) {
2018-10-04 21:58:11 +02:00
DCHECK(loader);
2024-03-12 10:35:41 -05:00
@@ -169,7 +160,7 @@ std::optional<GURL> SanitizeUpdateURL(co
2024-01-14 09:08:33 -06:00
const GURL& update_url) {
2023-10-03 15:48:31 -05:00
if (update_url.is_empty()) {
// Fill in default update URL.
- return extension_urls::GetWebstoreUpdateUrl();
2024-02-13 13:54:32 -06:00
+ return std::nullopt;
2023-10-03 15:48:31 -05:00
}
// Skip extensions with non-empty invalid update URLs.
2024-03-12 10:35:41 -05:00
@@ -187,11 +178,6 @@ std::optional<GURL> SanitizeUpdateURL(co
2024-01-14 09:08:33 -06:00
return std::nullopt;
2023-10-03 15:48:31 -05:00
}
- // Make sure we use SSL for store-hosted extensions.
- if (extension_urls::IsWebstoreUpdateUrl(update_url) &&
- !update_url.SchemeIsCryptographic()) {
- return extension_urls::GetWebstoreUpdateUrl();
- }
return update_url;
}
2024-03-12 10:35:41 -05:00
@@ -369,10 +355,6 @@ void ExtensionDownloader::DoStartAllPend
AddToFetches(fetches_preparing, std::move(task));
pending_tasks_.clear();
- for (auto& fetch_list : fetches_preparing) {
- for (auto& fetch : fetch_list.second)
- StartUpdateCheck(std::move(fetch));
- }
}
void ExtensionDownloader::SetIdentityManager(
2024-03-12 10:35:41 -05:00
@@ -833,20 +815,6 @@ void ExtensionDownloader::HandleManifest
update.second->info);
}
- // If the manifest response included a <daystart> element, we want to save
- // that value for any extensions which had sent a ping in the request.
- if (fetch_data->base_url().DomainIs(kGoogleDotCom) &&
- results->daystart_elapsed_seconds >= 0) {
- Time day_start =
- Time::Now() - base::Seconds(results->daystart_elapsed_seconds);
-
2020-08-26 02:04:55 -04:00
- for (const ExtensionId& id : extension_ids) {
- ExtensionDownloaderDelegate::PingResult& result = ping_results_[id];
- result.did_ping = fetch_data->DidPing(id, ManifestFetchData::ROLLCALL);
- result.day_start = day_start;
- }
- }
-
ExtensionIdSet extension_ids_with_errors;
for (const auto& failure : failures)
extension_ids_with_errors.insert(failure.first.id);
2024-03-12 10:35:41 -05:00
@@ -1428,11 +1396,7 @@ bool ExtensionDownloader::IterateFetchCr
// fetch.
switch (fetch->credentials) {
case ExtensionFetch::CREDENTIALS_NONE:
2019-03-26 08:19:19 +03:00
- if (fetch->url.DomainIs(kGoogleDotCom) && identity_manager_) {
- fetch->credentials = ExtensionFetch::CREDENTIALS_OAUTH2_TOKEN;
- } else {
- fetch->credentials = ExtensionFetch::CREDENTIALS_COOKIES;
- }
+ fetch->credentials = ExtensionFetch::CREDENTIALS_COOKIES;
return true;
case ExtensionFetch::CREDENTIALS_OAUTH2_TOKEN:
fetch->oauth2_attempt_count++;
2025-01-28 11:24:46 -06:00
--- a/extensions/common/extension_urls.cc
+++ b/extensions/common/extension_urls.cc
2025-07-30 18:19:08 -05:00
@@ -77,8 +77,6 @@ GURL AppendUtmSource(const GURL& url, st
2025-01-28 11:24:46 -06:00
GURL GetWebstoreExtensionsCategoryURL() {
GURL base_url = GetNewWebstoreLaunchURL();
- CHECK_EQ(base_url.path_piece(), "/")
- << "GURL::Resolve() won't work with a URL with a path.";
return base_url.Resolve("category/extensions");
}