- From: Oliver Dunk <notifications@github.com>
- Date: Tue, 31 Oct 2023 05:06:21 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/ServiceWorker/issues/1696@github.com>
`close()` is supported in the DedicatedWorkerGlobalScope ([source](https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/close)), but not the ServiceWorkerGlobalScope. In [Manifest V3](https://developer.chrome.com/docs/extensions/mv3/intro/), the latest version of the Web Extensions platform, extensions can use service workers as a background context. In the Web Extensions Community Group, we have been [discussing](https://github.com/w3c/webextensions/issues/311) a feature request to support the immediate termination of a service worker. We would prefer a spec level solution over an extension specific API so filing this issue. There are a few key use cases we have identified: - A developer is handling sensitive data in the service worker (e.g a password manager). When the user asks the password manager to lock, immediately terminating the service worker would provide some additional certainty that any data in memory can be freed ([source](https://github.com/w3c/webextensions/issues/311#issuecomment-1326648334)). - A developer is writing tests and wants to immediately terminate the service worker ([source](https://github.com/w3c/webextensions/issues/311#issuecomment-1764675350)). - In general, a service worker no longer has any work to perform and wishes to free up resources. I found https://github.com/w3c/ServiceWorker/issues/865 which has some of the history: it appears this initially threw an error, and was then moved to avoid exposing it entirely. But I couldn't find any specific motivations for not supporting it. -- Reply to this email directly or view it on GitHub: https://github.com/w3c/ServiceWorker/issues/1696 You are receiving this because you are subscribed to this thread. Message ID: <w3c/ServiceWorker/issues/1696@github.com>
Received on Tuesday, 31 October 2023 12:06:26 UTC