Introduce runtime.waitUntil API to keep background service worker / event page active during a specific task #416
Labels
proposal
Proposal for a change or new feature
supportive: chrome
Supportive from Chrome
supportive: firefox
Supportive from Firefox
supportive: safari
Supportive from Safari
topic: service worker
Related to service worker background scripts
Extension Service workers and (limited) event pages are terminated when they are idle for a period of time. The mechanisms for determining the termination triggers vary by browser version *, and extensions do currently not have an explicit mechanism to extend the lifetime until the completion of a specific task. This is a proposal for the
runtime.waitUntil
method to do so.* Chrome used to terminate service workers after 5 minutes, until recently when that restriction was lifted : extensions can extend their service worker's lifetime when they are actively calling extension APIs or handling events, and even some web platform APIs (see history of changes by Chrome version). The advantage of integrating the lifetime in specific web platform APIs is greater control by the browser. The downside is that the set of lifetime-extending APIs is seemingly arbitrary and the expected behavior cannot easily be determined (e.g. by developers or code reviewers).
On to the proposal:
runtime.waitUntil
method, modeled after the ExtendableEvent's waitUntil method.waitUntil
stops blocking termination.Related discussions / bugs:
webextensions/_minutes/2022-12-08-wecg.md
Lines 98 to 101 in 18c60c2
The text was updated successfully, but these errors were encountered: