diff --git a/build/cromite_patches_list.txt b/build/cromite_patches_list.txt index 939e2208..5a74e2a8 100644 --- a/build/cromite_patches_list.txt +++ b/build/cromite_patches_list.txt @@ -306,6 +306,7 @@ Disable-Sticky-User-Activation-Across-Same-Origin-Navigation.patch Supporting-Dangling-Ptr-Detection-via-BackupRefPtr.patch Disable-device-bound-session.patch Keep-disabled-CpuPerformance.patch +Immediately-destroy-shared-workers-when-closing-the-page.patch # temporary or wip patches Temp-disable-predictive-back-gesture.patch diff --git a/build/patches/Immediately-destroy-shared-workers-when-closing-the-page.patch b/build/patches/Immediately-destroy-shared-workers-when-closing-the-page.patch new file mode 100644 index 00000000..2bb1a0a8 --- /dev/null +++ b/build/patches/Immediately-destroy-shared-workers-when-closing-the-page.patch @@ -0,0 +1,45 @@ +From: uazo +Date: Sat, 24 Jan 2026 16:40:11 +0000 +Subject: Immediately destroy shared workers when closing the page + +Chromium is planning to keep shared workers active even after the page is closed, +up to a timeout, to compensate for the permanent deactivation of the unload event. +This feature is used to send pings from the page. +Cromite already does not allow any information to be sent via the network to the unload event. + +License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html +--- + content/browser/worker_host/shared_worker_host.cc | 13 +------------ + 1 file changed, 1 insertion(+), 12 deletions(-) + +diff --git a/content/browser/worker_host/shared_worker_host.cc b/content/browser/worker_host/shared_worker_host.cc +--- a/content/browser/worker_host/shared_worker_host.cc ++++ b/content/browser/worker_host/shared_worker_host.cc +@@ -69,7 +69,7 @@ namespace { + // TODO(crbug.com/400473072): revisit the duration. + // Also, we may want to use the same constant we use for service workers. + // Current value come from `ServiceWorkerVersion::kRequestTimeout`. +-constexpr base::TimeDelta kSharedWorkerDestructionDelay = base::Minutes(5); ++// constexpr base::TimeDelta kSharedWorkerDestructionDelay = base::Minutes(5); + + // These values are persisted to logs. Entries should not be renumbered and + // numeric values should never be reused. +@@ -1033,17 +1033,6 @@ void SharedWorkerHost::OnClientConnectionLost() { + break; + } + } +- if (instance_.extended_lifetime()) { +- if (!clients_.empty()) { // Early return. +- return; +- } +- base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask( +- FROM_HERE, +- base::BindOnce(&SharedWorkerHost::DestructIfNoClients, +- weak_factory_.GetWeakPtr()), +- kSharedWorkerDestructionDelay); +- return; +- } + DestructIfNoClients(); + } + +--