Restricted JS Execution Contexts

From MozillaWiki
Revision as of 04:49, 8 February 2015 by Roc (talk | contribs) (Created page with "Various Web platform features have a need for script to run in "restricted contexts", where some features accessible to regular main-thread page JS are not available. == Audi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Various Web platform features have a need for script to run in "restricted contexts", where some features accessible to regular main-thread page JS are not available.

Audio Workers

Web Audio wants an "audio worker" --- processing audio samples on a real-time audio thread. Hopefully small snippets of code doing small amounts of work on each callback (e.g. processing 128 audio samples).

Vertex Shaders

For CSS Filter-ish use-cases, we want to be able to generate meshes by applying a JS function to vertices of a grid, mapping 2D points to 2D points.

CSS Style Callbacks

To extend the CSS style system, we want to provide callbacks that run during style computation to parse values and generate computed style values.

CSS Layout Callbacks

To extend CSS layout, we want to provide callbacks that run during layout, to layout the contents of container elements.

CSS Painting Callbacks

To extend CSS painting, we want to provide callbacks that run during painting, to paint the contents of elements.

APIWork per callbackRetain state between callbacks?Isolated worlds per pageSend/receive messagesOther Web platform APIs needed
Audio workersVery littleYesdozensYesMinima
Vertex shadersVery littleNoflexibleNoMinima
CSS style extensionsVery littleNolotsNoMinimal
CSS layout extensionsLots (e.g. constraint solving)Yes (caching)potentially lotsNoMinimal
CSS painting extensionsPotentially a lotprobably notdozensNoCanvas