You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an extension needs to initialize by moving some storage items from local storage into session storage. There's no single event that can be used to do that.
You would have to use both onInstalled and onStartup. This has a few issues.
It can run multiple times. So you need to set some flag on session storage to ensure you're not initializing multiple times.
It's unclear if this approach handles 100% of scenarios as the docs don't mention it.
Proposal
browser.runtime.onSessionStart event that is fired when the extension's session starts.
browser.runtime.onSessionStart.addListener(()=>{// good place to initialize API labeled 'A' from the memo linked below. })
This proposal can supersede #353 (runtime.onEnabled) and the existing runtime.onInstalled if this event receives their params (reason, previousVersion, etc.) with "enabled" added to the enum of reasons.
This proposal is the same as proposal #353 just with a different name. runtime.onSessionStart, runtime.onExtensionStartup or runtime.onExtensionLoaded are the same thing just different names. Chrome is supportive of both this event and onEnabled#353 (comment) , other browsers are supportive too.
If an extension needs to initialize by moving some storage items from local storage into session storage. There's no single event that can be used to do that.
You would have to use both onInstalled and onStartup. This has a few issues.
Proposal
browser.runtime.onSessionStart
event that is fired when the extension's session starts.Relevant memo.
https://github.com/w3c/webextensions/blob/main/memo/persistence-of-states.md#definitions
The text was updated successfully, but these errors were encountered: