demo · v134 · graphics

Attribute Lab

Toggle every context attribute on an OffscreenCanvas 2D context — alpha, colorSpace, desynchronized, willReadFrequently — and compare the requested settings against what getContextAttributes() reports the engine actually granted.

requested attributes

attributerequestedactual
click "create context" to start

why this matters

The engine is free to not honour requested context attributes. Most famously: ask for willReadFrequently: true in a worker, the platform may or may not switch to a software backend depending on heuristics; ask for colorSpace: 'display-p3' on a sRGB-only display, you get sRGB back; ask for desynchronized: true in a worker without a presented surface, you might get a normal sync context.

Before v134, OffscreenCanvas 2D contexts had no way to introspect the granted settings — you'd write code on guesswork. After v134, getContextAttributes() on a worker-side OffscreenCanvas tells you exactly what you got.

see also