Open Bug 1880215 Opened 8 months ago Updated 8 months ago

"prefs.js" fills up with 'temporary-addon' entries

Categories

(Toolkit :: Add-ons Manager, defect, P3)

Firefox 122
defect

Tracking

()

ASSIGNED

People

(Reporter: andrew.j.larson18+bugzilla, Assigned: rpl)

References

Details

(Whiteboard: [addons-jira])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0

Steps to reproduce:

  1. Prepare with some unpacked example extension on the side
  2. In FireFox, go to about:debugging#/runtime/this-firefox
  3. Click on "Load Temporary Add-on..."
  4. Select an unpacked extension
  5. Note the contents of "prefs.js" in the profile (at "extensions.webextensions.uuids")
  6. Restart the browser
  7. Note the contents of "prefs.js" in the profile (at "extensions.webextensions.uuids")

Actual results:

The file (from 4 to 6) keeps adding on more 'temporary-addon' uuid entries.

Expected results:

The file (from 4 to 6) should be removing entries, just the same as when you remove a temporary addon manually.

The Bugbug bot thinks this bug should belong to the 'DevTools::about:debugging' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → about:debugging
Product: Firefox → DevTools

We are reproducing this. When removing the addon from about:debugging, the entry is removed from the prefs.js file, but not when restarting Firefox.

Hello Luca, would you know if this should be the responsability of the Addon code that already takes care of removing the temporary addon?

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(lgreco)
Priority: -- → P3

(In reply to Nicolas Chevobbe [:nchevobbe] from comment #2)

We are reproducing this. When removing the addon from about:debugging, the entry is removed from the prefs.js file, but not when restarting Firefox.

Hello Luca, would you know if this should be the responsability of the Addon code that already takes care of removing the temporary addon?

yes, clearing up the mappings from that pref is not a responsability of the about:debugging internals, that map is managed from inside Extension.sys.mjs (defined here) and the ExtensionAddonObserver onUninstalled listener is where the entries from that map are currently being cleared (see here).

I'm moving this issue to WebExtensions :: General, where it belongs belongs in practice. It is not unlikely that when the temporarily addon is not explicitly uninstalled the ExtensionAddonObserver is not being notified and doesn't clear the temporarily installed addon from the map (and so it is also likely missing the rest of the cleanup that the ExtensionAddonObserver onUninstalled listener is meant to be clearing).

Severity: S3 → --
Component: about:debugging → General
Flags: needinfo?(lgreco)
Priority: P3 → --
Product: DevTools → WebExtensions
See Also: → 1410957, 1671681
Component: General → Add-ons Manager
Product: WebExtensions → Toolkit

The cleanup of the temporarily installed extension that may still be around when Firefox is shutting down
is being done from the XPIProvider method cleanupTemporaryAddons.

The cleanupTemporaryAddons method does remove the addon from the location and calls either bootstrap update or
uninstall (update if uninstalling the temporarily installed addon should reveal the same addon installed in
another location or uninstall if there isn't another instance of the addon to reveal from the other locations),
but it will not be calling the onUninstalled AOM addon listeners and so the ExtensionAddonObserver is not going
to be notified of the removal and will not be cleaning the uuid-addonid mapping stored in the prefs (nor cleaning
up other data associated with the temporarily installed addon in the profile).

As additional side notes:

  • there is a chance that a crash may prevent the cleanup on shutdown to be run or completed, I haven't digged yet
    into that corner case to determine if there would be some more changes needed (or a different approach)

  • The onUninstalled is not the only addon listener that is not going to be called and so there may be other
    things that may not be done for temporarily extensions in response of those events (e.g. Bug 1671681 was filed
    for other ones that are not emitted by temporarily addons), and so this patch (at least in its initial form)
    wouldn't solve other issues that are not hit because of missing calls to the onUninstalled addon listeners.

In the meantime I'm attaching this patch as is (and with only basic test coverage) for a preliminary feedback
from the perspective on a second peer.

Assignee: nobody → lgreco
Status: NEW → ASSIGNED
See Also: → 1826390
Severity: -- → S4
Priority: -- → P3
Whiteboard: [addons-jira]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: