Closed Bug 1826390 Opened 2 years ago Closed 6 months ago

Persistent state and prefs (e.g. extensions.webextensions.uuids) from generated test extensions are not cleaned up at extension.unload()

Categories

(WebExtensions :: General, defect, P2)

defect

Tracking

(firefox127 fixed)

RESOLVED FIXED
127 Branch
Tracking Status
firefox127 --- fixed

People

(Reporter: robwu, Assigned: robwu)

References

(Blocks 1 open bug)

Details

(Whiteboard: [addons-jira])

Attachments

(1 file)

Ordinarily (outside of tests), when an extension is uninstalled, any remaining state is cleaned up in ExtensionAddonObserver.onUninstalled. This is triggered by the AddonManager internals.

In tests, when ExtensionTestUtils.loadExtension is used without useAddonManager, a bare Extension instance is created without the AddonManager. Consequently, the cleanup logic never runs. As a result, persistent state is never cleaned up:

  • extensions.webextensions.uuids will continuously accumulate values for every new extension (bug 1363464).
    This is particularly problematic in mochitests, because eventually a ceiling will be reached on the permitted length of the pref value, e.g.: https://bugzilla.mozilla.org/show_bug.cgi?id=1611913#c1
  • ExtensionPermissions is not cleared.
  • Extension API state is not cleaned up (storage API, scripting API, DNR API).
  • DOM state (cache, storage, permissions, service workers)

This can easily be observed when you run a mochitest with the --compare-preferences flag, as shown in https://bugzilla.mozilla.org/show_bug.cgi?id=1825953#c5 . This flag is enabled by default on TV builds.

See Also: → 1611913
Whiteboard: [addons-jira]
Assignee: nobody → rob
Status: NEW → ASSIGNED

The severity field is not set for this bug.
:willdurand, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(wdurand)
Severity: -- → N/A
Priority: -- → P2
Flags: needinfo?(wdurand)

The severity field is not set for this bug.
:rpl, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(lgreco)
Severity: N/A → S4
Flags: needinfo?(lgreco)
Attachment #9327122 - Attachment description: Bug 1826390 - Make sure that post-uninstall cleanup runs for generated extensions → Bug 1826390 - Make sure that post-uninstall cleanup runs for generated extensions in mochitests

There is an r+ patch which didn't land and no activity in this bug for 2 weeks.
:robwu, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(tomica)
Flags: needinfo?(rob)
Flags: needinfo?(tomica)
Flags: needinfo?(rob)
Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/707620083346 Make sure that post-uninstall cleanup runs for generated extensions in mochitests r=zombie
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: