-
Notifications
You must be signed in to change notification settings - Fork 74
Description
Introduction
Depending on the browser, an extension being switched from disabled to enabled and on reload results in different lifecycle events being fired.
Inconsistencies and demo
This is an overview:
| disabled -> enabled | reloaded | |
|---|---|---|
| Chrome | - | onInstalled:update |
| Firefox | - | onInstalled:update |
| Safari | onInstalled:install | onInstalled:install |
| Orion | onStartup | onStartup |
Demo extension:
https://github.com/carlosjeurissen/webext-tech-demo-extensions/tree/main/demos/background-lifetime-events
To clarify, orion does not fire onInstalled, yet magically fires onStartup. See bugreport:
https://orionfeedback.org/d/12603-when-extensions-get-reloaded-and-changed-from-disabled-to-enabled-it-fires-onstartup-instead-of-oninstalled
Next steps
Finding agreement on what should happen in these situations would be very valuable before browsers implement the proposed onEnabled and onExtensionLoaded events so at least these events will behave consistent across browsers.
See: #353 and https://github.com/w3c/webextensions/blob/main/proposals/runtime_on_load_on_enabled_events.md
In general seems on reload, onInstalled:update is most intuitive. If removing onInstalled:install on enabled, a potential alternative could be to add onInstalled:enabled, while not native to onInstalled, it could be a nice middle ground.