Closed Bug 1203331 Opened 9 years ago Closed 9 years ago

Use SingletonEventManager in a few places

Categories

(WebExtensions :: Untriaged, defect)

defect
Not set
normal

Tracking

(firefox44 fixed)

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: billm, Assigned: billm)

References

Details

Attachments

(1 file)

I've realized that EventManager is causing a lot of problems. In theory, it consolidates event registration. So if the extension calls addListener 10 times, we only register a real listener once and then notify the add-on 10 times.

Some of our code takes advantage of this behavior by assuming a single callback can be registered per extension rather than having to deal with a Set of callbacks. However, there's a subtle problem with this. The EventManager is does one registration per content, and a given extension can have many contexts (one for the background page, one for a popup, and some for extension tabs). So if you try to register an onAlarm listener in a popup and again in a background page, one of them will be ignored.

Ideally I would convert these to SingletonEventManagers in preparation for bug 1203330. However, SingletonEventManager needs some additional work for that to happen, so I'd like to land this as-is. A number of tests in other bugs depend on it, so this blocks several things.
Attached patch patchSplinter Review
Attachment #8658978 - Flags: review?(gkrizsanits)
Attachment #8658978 - Flags: review?(gkrizsanits) → review+
https://hg.mozilla.org/mozilla-central/rev/14b95ac5262b
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: