The MDN pages for these two events read as almost identical. When is one used and the other not used, or do both always need to be used in an extension?
Neither needs to be used for the extension to work.
Incorrect: according to MDN, ignoring these can cause an extension to be updated while it is in operation. In my case, for a password manager, this can have undetermined results.
Incorrect. Also fired when the extension is updated.
As I read the docs:
runtime.onInstalledis fired when your extension has just been installed or updated. Use it if you want to do something once your extension has been installed/updated.
runtime.onUpdateAvailableis fired when the browser wants to update your extension, but it hasn’t, yet. The behavior of
runtime.onUpdateAvailableis that, if you are listening to it, then the update will not be applied until your extension is reloaded. So you can listen to this event while you are doing something that should not be interrupted by an update. It’s a little unusual for an event listener in that just the act of listening to the event changes the browser’s behavior.
wbamberg, Thank you! I just could see no difference at all, but what you’re saying makes sense. I did not expect that listening to an event would prevent updating, but this is really useful. If I knew for sure that you are correct, I would edit the two MDN pages to make the difference clearer. Maybe someone else will do the editing. Thanks again.
But that doesn’t mean that the extension won’t work if they’re not being used.
I said when the current version is installed, which implies updates.