Closed Bug 1408226 Opened 7 years ago Closed 5 years ago

Uninstalling a disabled extension doesn't update ExtensionPreferencesManager

Categories

(WebExtensions :: General, enhancement, P3)

enhancement

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: mstriemer, Assigned: mstriemer)

References

(Blocks 1 open bug)

Details

When a disabled extension is uninstalled the ExtensionPreferencesManager doesn't get updated because there is no Management.on("shutdown") event fired with the ADDON_UNINSTALL shutdownReason. This causes issues when the extension is installed again since the settings won't be re-enabled. Instead of only listening for "shutdown" it looks like we could move the uninstall handing code into an "uninstall" handler. http://searchfox.org/mozilla-central/rev/ed1d5223adcdc07e9a2589ee20f4e5ee91b4df10/toolkit/components/extensions/ExtensionPreferencesManager.jsm#47-49
(In reply to Mark Striemer [:mstriemer] from comment #0) > When a disabled extension is uninstalled the ExtensionPreferencesManager > doesn't get updated because there is no Management.on("shutdown") event > fired with the ADDON_UNINSTALL shutdownReason. > > This causes issues when the extension is installed again since the settings > won't be re-enabled. > > Instead of only listening for "shutdown" it looks like we could move the > uninstall handing code into an "uninstall" handler. > > http://searchfox.org/mozilla-central/rev/ > ed1d5223adcdc07e9a2589ee20f4e5ee91b4df10/toolkit/components/extensions/ > ExtensionPreferencesManager.jsm#47-49 That sounds like it would work, if such a handler exists. I wonder, though, is there a bug that should be fixed? It seems to me that uninstalling a disabled extension _should_ fire a Management.on("shutdown") event.
The Management startup and shutdown events are about an extension starting and stopping. A disabled extension is not running so it can't be stopped. I think you should probably actually be using an AddonListener instead. Remarkably we have what appears to be an accurate MDN page describing them: https://developer.mozilla.org/en-US/Add-ons/Add-on_Manager/AddonListener
This is still an issue for code using ExtensionSettingsStore directly that disable or remove the setting in an `extension.callOnClose()` handler. The handler maps to a shutdown listener so we will only get called once for that.
Assignee: nobody → mstriemer
There are some TODOs in the tests pointing to this bug which might get fixed by bug 1411123. That might fix this too, actually. I'll check if this is fixed and look into the TODOs.
Still able to reproduce, but looks like https://bugzilla.mozilla.org/show_bug.cgi?id=1411123 is verified fixed?
Product: Toolkit → WebExtensions

I just tested this, it is working as expected now, possibly due to fixes in the meta bug or prior.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.