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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
From: uazo <uazo@users.noreply.github.com>
|
||||
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();
|
||||
}
|
||||
|
||||
--
|
||||
Reference in New Issue
Block a user