electron/patches/chromium/custom_protocols_plzserviceworker.patch
electron-roller[bot] 2e4e6f10de
chore: bump chromium to 122.0.6236.2 (main) (#40871)
* chore: bump chromium in DEPS to 122.0.6223.0

* 5129828: Removes special cases for selenium-atoms dependencies.

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

* chore: fixup patch indices

* 5139789: Deduplicate BrowserContext's ResourceContext

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

* 5148579: Simplify SelectFileDialog::Listener

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

* 5134038: Code Health: Use string_view in base::i18n::BreakIterator::SetText

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

* 5137427: Code Health: Use string_view in SpellCheck::SpellCheckWord

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

* [libcxx] adds ranges::fold_left_with_iter and ranges::fold_left

Notable things in this commit:

* refactors `__indirect_binary_left_foldable`, making it slightly
different (but equivalent) to _`indirect-binary-left-foldable`_, which
improves readability (a [patch to the Working Paper][patch] was made)
* omits `__cpo` namespace, since it is not required for implementing
niebloids (a cleanup should happen in 2024)
* puts tests ensuring invocable robustness and dangling correctness
inside the correctness testing to ensure that the algorithms' results
are still correct

[patch]: https://github.com/cplusplus/draft/pull/6734

* chore: bump chromium in DEPS to 122.0.6224.0

* 5154766: [Refresh 2023] [GTK] Fix gap above toolbar with fractional scaling

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

* chore: fixup patch indices

* 5094458: Remove extra CGColorSpace parameters from skia and ui helpers

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

* chore: bump chromium in DEPS to 122.0.6226.0

* chore: update patches

* chore: bump chromium in DEPS to 122.0.6227.0

* chore: update patches

* chore: bump chromium in DEPS to 122.0.6228.0

* chore: update patches

* chore: bump chromium in DEPS to 122.0.6230.0

* chore: bump chromium in DEPS to 122.0.6232.0

* chore: bump chromium in DEPS to 122.0.6234.0

* chore: bump chromium in DEPS to 122.0.6236.2

* chore: update patches

* fix: remove --disable-color-correct-renderering

Per https://electronhq.slack.com/archives/CB6CG54DB/p1698444047862459 it is not used any more and was never documented.

* chore: add WEB_PRINTING to content permission converter

Unused in non-cros so no need to document

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5136178

* chore: Views is now vec<raw_ptr> instead of raw<T*>

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5140028

* spec: add Iterator to global intrinsics

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2024-01-11 19:33:40 +13: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 0d4098dda205475c75bf57706282f1118e6a0deb..075c91b22901ed5f6c9cc341ac22bf6fb9567319 100644
--- a/content/browser/service_worker/service_worker_context_wrapper.cc
+++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -1916,6 +1916,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
@@ -1935,9 +1955,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>()));
@@ -1945,9 +1963,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,