Can anyone explain the lifecycle of browser extensions in Chrome/Firefox? More specifically, I'm looking for what exactly happens when the onStartup
and onSuspend
events are triggered, and what triggers them. Here are a few different answers I'm looking for:
- When
onStartup
is triggered, will it automatically inject content scripts into all open tabs, or do I have to do that manually? - How is
onStartup
triggered once an extension has gone inactive? Is it just clicking the browserAction icon, or are there other ways to trigger it? - What triggers
onSuspend
? Does it just time out after a certain amount of inactivity? - Is there a way to prevent
onSuspend
from triggering (besides settingpersistent: true
in the manifest)? What if I keep a port open, rather than usingsendMessage
to communicate?