I’m working on a new add-on that has some UI that can be in injected in any page. When I reload add-on, I can see the UI is not responsive anymore, because the javascript part is gone but the DOM persists. This is very bad user experience.
If I’m right, this will happen for all users every time I release a new version.
As a possible solution I could:
- delay the update using runtime.onUpdateAvailable API
- save list of tabs with injected scripts
- remove all DOM nodes
- use
browser.runtime.reload()
to install update - use
browser.runtime.onInstalled.addListener
event to re-inject scripts and recreate DOM
This is a lot of work, maybe there is an easier way?