Skip to content

Lifecycle event inconsistencies on enable and reload #926

@carlosjeurissen

Description

@carlosjeurissen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    inconsistencyInconsistent behavior across browsersneeds-triage: chromeChrome needs to assess this issue for the first timeneeds-triage: firefoxFirefox needs to assess this issue for the first timeneeds-triage: safariSafari needs to assess this issue for the first timespec clarificationNeeds clarification when specifiedtopic: eventsIssues related to the registration, management, and dispatch of WebExtension events.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions