Open Bug 1659454 Opened 4 years ago Updated 10 months ago

ChromeWorker construction / creation of a Worker from a system principal should take/require an async shutdown blocker

Categories

(Core :: DOM: Workers, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: asuth, Unassigned)

References

(Blocks 1 open bug)

Details

System JS code using workers should always have its life-cycle bounded by use of an async shutdown blocker. In order to make this expectation more explicit and to help worker using-code, worker creation for system-principalled code should require a shutdown blocker. This shutdown blocker will both serve as proof that the code is using a shutdown blocker, help the workers subsystem verify the blocker is actually shutting down the worker, and provide a means for workers to check that no attempt is being made to spawn a new worker past the point the database should have shutdown.

Note that there currently Is a "web-workers-shutdown" observer notification which the async shutdown system does expose as a shutdown blocker. But on its own it hasn't been sufficient to stop system code from trying to spawn Workers later than that point.

Blocks: 1659464

Note that in bug 1762840 we look at harmonizing async shutdown phases with the well known phases from ShutdownPhase. "web-workers-shutdown" is not part of those and thus unknown to AdvanceShutdownPhase or ClearOnShutdown.

I can see only one concrete use in PromiseWorker.

Given the apparently rare use of it, I'd tend to make it collapse with "xpcom-shutdown" / ShutdownPhase::XPCOMShutdown. If instead we really want to emphasize this phase, we should make it become a full-fledged ShutdownPhase and advance it in ShutdownXPCOM in the right moment etc.

Flags: needinfo?(bugmail)
See Also: → 1762840

I agree that it makes sense to collapse existing uses of "web-workers-shutdown" into "xpcom-shutdown" (which is already what we notify "web-workers-shutdown" from) and remove "web-workers-shutdown". I also concur that the only place that seems to use the phase is in the now MJS-ified subprocess_common PromiseWorker wrapper (which differs from the PromiseWorker implemented in the not-yet-MJS-ified PromiseWorker.jsm.

Flags: needinfo?(bugmail)
Flags: needinfo?(jstutte)

(thanks)

Flags: needinfo?(jstutte)
You need to log in before you can comment on or make changes to this bug.