Closed Bug 1757855 Opened 2 years ago Closed 2 years ago

persistent listeners are not handled correctly in upgrades

Categories

(WebExtensions :: General, enhancement, P1)

enhancement

Tracking

(firefox100 fixed)

RESOLVED FIXED
100 Branch
Tracking Status
firefox100 --- fixed

People

(Reporter: mixedpuppy, Assigned: mixedpuppy)

References

Details

(Whiteboard: [addons-jira])

Attachments

(1 file)

from Rob:

  1. Non-blocking webRequest listeners are not removed from the lz4 file if not registered again.
  2. Persistent listeners are persisted across updates. The logic that determines whether an event page should wake up skips that if there are persistent listeners. This is especially a problem for updates, where the set of listeners may change due to source code changes

The second situation also required the fix for the first situation so they are both included in this.

1 is a regression of bug 1749871, but I'll just mark as see also because the second one is not directly related to it.

Issue 1 causes redundant listeners to accumulate over time, which on its own is not really nice but otherwise not a very significant issue. However, combined with issue 2, it would prevent extensions with event pages from ever updating its set of listeners when updated (unless there was another trigger for event page startup, other than https://searchfox.org/mozilla-central/rev/ad7ecfa618ec3a65db8405d9f1125059fe4a6a15/toolkit/components/extensions/parent/ext-backgroundPage.js#378-385).

The EventManager.clearPersistentListeners that are scattered all over the place don't actually clean up the listeners, for the reason explained in bug 1755589. Specifically the "final clean-up (step 4) doesn't clear events when listener.primed is void." part. The latest code is at https://searchfox.org/mozilla-central/rev/ad7ecfa618ec3a65db8405d9f1125059fe4a6a15/toolkit/components/extensions/ExtensionCommon.jsm#2464,2466, which has "// When a new listener has beed added, primed is undefined.". This comment is not fully accurate: it could also be that the module is marked as startupBlocking and that the extensionApi.primeListener method hasn't returned anything (or threw).
If startupBlocking listeners are not primed after "early startup" (i.e. no EventManager.primeListeners call), then there is nothing that would ever clean up the listeners.

See Also: → 1749871, 1755589
Pushed by scaraveo@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d705f8e9b4ee
fix background startup and persistent listeners during addon upgrades r=robwu
Pushed by scaraveo@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c295e6801d39
fix background startup and persistent listeners during addon upgrades r=robwu
Pushed by scaraveo@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8ca3b8d52983
fix background startup and persistent listeners during addon upgrades r=robwu
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch

Clearing needinfo (already handled in the meantime).

Flags: needinfo?(mixedpuppy)
See Also: → 1822735
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: