You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b57eb2e
Browse filesBrowse the repository at this point in the historyBrowse files
authored
fix(web): stylesheet-gated fragments reveal under a nonce CSP and when a sheet loads early (#3755)
* fix(web): stylesheet-gated fragments reveal under a nonce CSP and when a sheet loads early
A fragment whose boundary streamed stylesheet links waited on inline
`onload`/`onerror` handlers. Those can't carry a nonce, so under a strict
`script-src` CSP the gate never released and the boundary stayed on its
fallback. The links now carry `data-dfc`, and the fragment helpers install
one capture-phase `load`/`error` listener, from the nonce-carrying task
script, that counts each link down once.
The links were also written ahead of the content template. A sheet that
loads before the parser reaches the template (a cached sheet, or a chunk
boundary between the two) ran `$dfc` while the template was missing, and
`$dfr` treats a missing template as a swap that already ran, so the reveal
was dropped. The template now goes first.
Fixes#3747
* test(web): remove the stylesheet gate spec's document listeners between tests
Each test evaluates the stream helpers, which install their capture-phase
listener on the shared jsdom document. Record and remove them so a test only
sees listeners its own scripts added, which is what the count-once test means
to exercise.
Co-authored-by: Claude via Cursor <[email protected]>
---------
Co-authored-by: Ryan Carniato <[email protected]>
Co-authored-by: Claude via Cursor <[email protected]>
Streamed fragments gated on their stylesheets now reveal under a nonce-based CSP, and no longer stay on the fallback when a sheet loads before its fragment's template is parsed (#3747). The gated links carry `data-dfc` instead of inline `onload`/`onerror` handlers, which a strict `script-src` blocks; a capture-phase listener installed by the stream's fragment helpers, from a script that carries the nonce, counts them down. The content template is now written ahead of its links: a cached sheet could fire `load` before the parser reached the template, and `$dfr` dropped the reveal.
0 commit comments