electron/patches/chromium/custom_protocols_plzserviceworker.patch
trop[bot] c92a02ea17
chore: bump chromium to 134.0.6998.10 (35-x-y) (#45585)
* chore: bump chromium to 134.0.6992.0

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: add BrowserProcessImpl::CreateGlobalFeaturesForTesting() stub

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/6216193

Remove GlobalFeatures from TestingBrowserProcess::Init

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: bump chromium to 134.0.6994.0

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* 6208630: Mac sandbox: don't use protobuf for policy serialization | https://chromium-review.googlesource.com/c/chromium/src/+/6208630

Co-authored-by: alice <alice@makenotion.com>

* Remove HasUnsupportedFeature Mojo interface

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/6220800

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* 6217444: Remove scoped_gdi_object.h type aliases. | https://chromium-review.googlesource.com/c/chromium/src/+/6217444

Co-authored-by: alice <alice@makenotion.com>

* chore: bump chromium to 134.0.6998.10

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* 6221378: Revert [OBC] Exclude Aliasing Cookies in FilterCookiesWithOptions() | https://chromium-review.googlesource.com/c/chromium/src/+/6221378

Co-authored-by: alice <alice@makenotion.com>

* Update ExtensionPrefs::GetDisableReasons to return DisableReasonSet

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/6218840

change copied from 6218840 extensions/shell/browser/shell_extension_loader.cc

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* 6218402: Typemap ui.gfx.DXGIHandle <=> gfx::DXGIHandle | https://chromium-review.googlesource.com/c/chromium/src/+/6218402

Co-authored-by: alice <alice@makenotion.com>

* chore: disable flaky contentTracing test

not new to this roll; it is happening in main as well

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fixup! chore: disable flaky contentTracing test

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: update patches

* chore: disable flaky content tracing tests on Linux (#45612)

(cherry picked from commit a1e4550c9e5b2b220530a9238795286bd028dbfb)

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: alice <alice@makenotion.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-02-19 12:09:35 +01:00

62 lines
3.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Fri, 20 May 2022 00:29:34 +0900
Subject: custom_protocols_plzserviceworker.patch
Allow registering custom protocols to handle service worker main script fetching with PlzServiceWorker.
Refs https://bugs.chromium.org/p/chromium/issues/detail?id=996511
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc
index ff25eb3670d2391c6fb41b7c612c30ee8798983f..116763b520713a5c61462b2e048a7358486831a2 100644
--- a/content/browser/service_worker/service_worker_context_wrapper.cc
+++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -1969,6 +1969,26 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
loader_factory_bundle_info =
context()->loader_factory_bundle_for_update_check()->Clone();
+ // Give the embedder a chance to register custom schemes that can
+ // handle loading the service worker main script.
+ // Previous registration triggered by
+ // ServiceWorkerContextWrapper::CreateNonNetworkPendingURLLoaderFactoryBundleForUpdateCheck
+ // happens early on browser startup before the JS in the main process
+ // is run by the embedder.
+ auto& pending_scheme_specific_factories =
+ static_cast<blink::PendingURLLoaderFactoryBundle*>(
+ loader_factory_bundle_info.get())
+ ->pending_scheme_specific_factories();
+ ContentBrowserClient::NonNetworkURLLoaderFactoryMap non_network_factories;
+ GetContentClient()
+ ->browser()
+ ->RegisterNonNetworkServiceWorkerUpdateURLLoaderFactories(
+ storage_partition_->browser_context(), &non_network_factories);
+ for (auto& [scheme, factory_remote] : non_network_factories) {
+ pending_scheme_specific_factories.emplace(
+ scheme, std::move(factory_remote));
+ }
+
if (auto* config = content::WebUIConfigMap::GetInstance().GetConfig(
browser_context(), scope)) {
// If this is a Service Worker for a WebUI, the WebUI's URLDataSource
@@ -1988,9 +2008,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
features::kEnableServiceWorkersForChromeScheme) &&
scope.scheme_piece() == kChromeUIScheme) {
config->RegisterURLDataSource(browser_context());
- static_cast<blink::PendingURLLoaderFactoryBundle*>(
- loader_factory_bundle_info.get())
- ->pending_scheme_specific_factories()
+ pending_scheme_specific_factories
.emplace(kChromeUIScheme, CreateWebUIServiceWorkerLoaderFactory(
browser_context(), kChromeUIScheme,
base::flat_set<std::string>()));
@@ -1998,9 +2016,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
features::kEnableServiceWorkersForChromeUntrusted) &&
scope.scheme_piece() == kChromeUIUntrustedScheme) {
config->RegisterURLDataSource(browser_context());
- static_cast<blink::PendingURLLoaderFactoryBundle*>(
- loader_factory_bundle_info.get())
- ->pending_scheme_specific_factories()
+ pending_scheme_specific_factories
.emplace(kChromeUIUntrustedScheme,
CreateWebUIServiceWorkerLoaderFactory(
browser_context(), kChromeUIUntrustedScheme,