v147 · developer trial · workers · security
Document Policy in Dedicated Workers
Chrome 147 adds developer trial support for propagating Document-Policy HTTP response headers into dedicated workers. When a page is loaded with a Document Policy, the same policy now applies to workers spawned by that page, enabling consistent enforcement of security and performance constraints across the main thread and its workers.
chrome://flags/#enable-experimental-web-platform-features to try it. The API surface may change before it ships. Do not use in production.
at a glance
| Status in Chrome 147 | Developer trial (behind a flag) |
|---|---|
| Flag | enable-experimental-web-platform-features |
| Spec | WICG Document Policy |
| ChromeStatus | 6242687411945472 — Document Policy in Dedicated Workers |
what is Document Policy?
Document Policy is an HTTP header (Document-Policy: directive=value) that allows servers to enforce or opt into behaviours for a document. Example directives include:
force-load-at-top— prevent JavaScript from scrolling the document to a mid-page position on loadlossless-images-max-bpp— enforce maximum bits-per-pixel for lossless imagesoversized-images— enforce a maximum image display/intrinsic size ratio
Previously, these policies applied only to the main document and iframes, not to workers. This extension propagates the policy to dedicated workers so that, for example, a worker that loads images or performs layout-adjacent operations respects the same constraints as the main thread.
Source: WICG Document Policy