Layering: Fix the jobs infrastructure
Presenter: Daniel Ehrenberg
Author: Domenic Denicola
June 2019 TC39 meeting
What are Jobs?
When do Jobs run?
When do Jobs run?
This is a huge simplification
Goal: Let job ordering be specified precisely, to ensure interoperability between implementations
Embedder-specific ordering of event loops
JavaScript specifies an algorithm full of implementation-defined steps.
Ordering, priority remain vague.
No clean "host hooks" for other specifications to use.
HTML doesn't use this part of the JavaScript specification
It specifies its own, precise algorithms
Why does this matter?
Some proposals may touch the job queue
Let's let embedders cleanly specify their own event loop and how the job queue interacts with it
The general approach
Cross-environment invariants
Alternative: One-off callbacks
Approach taken by WeakRefs, Atomics.waitAsync
HostCleanupFinalizationGroup expected to queue a call to CleanupFinalizationGroup. No use of Jobs.
We could do this with Promises similarly
These are all normatively equivalent to RunJobs;
Editorial alterantives allow more precise use by embedders
Thoughts?
Adopt this notation?