Closed
Bug 1920245
Opened 1 year ago
Closed 1 year ago
Add extension task queue helper
Categories
(WebExtensions :: General, task, P2)
WebExtensions
General
Tracking
(firefox134 fixed)
RESOLVED
FIXED
134 Branch
| Tracking | Status | |
|---|---|---|
| firefox134 | --- | fixed |
People
(Reporter: robwu, Assigned: robwu)
References
Details
(Whiteboard: [addons-jira])
Attachments
(1 file)
An ordered task queue is occasionally needed in extension code. Because there was no generic utility, there are multiple implementations of queues, and even implicit ordering.
Examples:
Queueclass in ExtensionDNRStore - used for sequential initialization (internal data structures from file on disk), and data updates.extPermAccessQueues+_synchronizeExtPermAccessin ExtensionPermissions - ensuring that permission reads/writes are run in order, to fix data races in bug 1902011.scriptingAPI implementation ofregister/update/unregistermaintains an in-memory structure, and tries to ensure data consistency by ensuring that the implementation is fully synchronous, from the start of a method call, to reading internal data structures, validating a modification and registering the modifications. This currently works, but if future code were to addawaitin the method, the logic would break. This ordering requirement is not obvious and thus fragile.
There are more use cases:
- userScripts API also needs to register/update/unregister scripts. Unlike the
scriptingAPI, I don't want to force the implementation to be synchronous, because that is very restrictive and would force suboptimal implementation design choices, such as having to keep too much data in memory.
Updated•1 year ago
|
| Assignee | ||
Comment 1•1 year ago
|
||
This patch provides a task queue helper that supports the following:
-
Parallel reads + sequential writes. Running tasks as fast as possible.
-
Queue lifetime tied to extension lifetime, but without requiring an
Extension to be around, because that is not always available
(e.g. for operations past add-on uninstall).
Updated•1 year ago
|
Severity: -- → N/A
Priority: -- → P2
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/ecef33a461c9
Add read/write task queue helper r=zombie
Comment 3•1 year ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
status-firefox134:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 134 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•