How do the runtime.onUpdateAvailable and runtime.onInstall events follow each other?
(1°Q) First, can they coexist in the same background script?
The documentation states that onUpdateAvailable can be useful for
postpone an update for example, when you are in the middle of some important operation that we don't
want it to be interrupted.
If the extension has registered an event handler for onUpdateAvailable, then the update will be applied the next time the extension is reloaded.
This happens when:
- we restart the browser
- the extension is disabled and then re-enabled
- the extension reloads itself by calling the runtime.reload method
So I imagine that the onUpdateAvailable event handler that will be executed is the one referring to the old version.
(2nd Q) Am I right?
Now I ask myself:
(3nd Q) When the extension is reloaded later in one of the above ways, will the onInstall event be honored or ignored?
(4th Q) Is there a way to test this behavior by myself, specifically I am referring to the onUpdateAvailable event?