Open Bug 1285221 Opened 8 years ago Updated 2 years ago

Reloading an extension with changed ID doesn't remove the previous version

Categories

(DevTools :: about:debugging, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: freaktechnik, Unassigned)

References

(Blocks 1 open bug)

Details

Steps to reproduce:
 - Load a temporary WebExtension without ID in about:debugging
 - Add an ID to its manifest
 - Reload the extension

Expected results:
The previous ID-less version gets replaced by the new version with ID.

Actual results:
The previous version doesn't get removed and now the extension is loaded twice, however the first instance is no longer listed.


This is potentially a bug within addon.reload() from the Add-ons Manager.
Thank you Martin for reporting this bug!

(In reply to Martin Giger [:freaktechnik] from comment #0)
> This is potentially a bug within addon.reload() from the Add-ons Manager.

Kumar, could you please have a look to see if that's the case?
Flags: needinfo?(kumar.mcmillan)
Priority: -- → P2
> The previous version doesn't get removed and now the extension is loaded twice, 
> however the first instance is no longer listed.

To clarify, what I see is this (in Nightly):
- about:debugging does not list the old add-on, it only lists the new one (this behaves as expected)
- about:addons lists both the old and new add-on (this is unexpected)

Regardless of what the UI shows, logging tells me that the old add-on (which has a different ID) is not getting removed. This does sound like a bug in reload(), specifically in that it is passing addon._sourceBundle (the add-on directory) to installTemporaryAddon() but is not passing in the old add-on ID https://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/internal/XPIProvider.jsm#7512 The installTemporaryAddon() function is the one responsible for removing the old add-on but in this case it does not check for any running add-ons having the old ID.

It seems like a bit of an obscure edge case to be changing the add-on ID during development though. I don't think it would be so hard to workaround (as a developer) so I'm not sure if it's a P2.
Flags: needinfo?(kumar.mcmillan)
Product: Firefox → DevTools

Still applies to webextensions, although I guess setting an ID is less common now and done via:

"browser_specific_settings": {
  "gecko": {
    "id": "addon@example.com",
    "strict_min_version": "42.0"
  }
}

Severity: normal → S3
Priority: P2 → P3
You need to log in before you can comment on or make changes to this bug.