Skip to content

fix(theme): don't defer scripts the async loader already defers - #515

Merged
oxyc merged 1 commit into
masterfrom
fix/duplicate-defer-nonce
Dec 3, 2026
Merged

oxyc merged 1 commit into
masterfrom
fix/duplicate-defer-nonce

Conversation

@oxyc

@oxyc oxyc commented Dec 3, 2026

Copy link
Copy Markdown
Member

Follow-up to #514.

sage/app.js is in assets.deferred_scripts, so AsyncLoaderServiceProvider adds defer to its tag, and the core defer strategy from #514 added a second one. Chrome ignores the nonce of a <script> with a duplicated attribute, so on a site with a nonce-based CSP the theme's main script is blocked.

Fix: also skip assets.deferred_scripts handles, leaving their defer to the async loader, as before. A new test prints sage/app.js and checks it has exactly one defer.

🤖 Generated with Claude Code

sage/app.js is in assets.deferred_scripts, so AsyncLoaderServiceProvider
adds defer to its tag; the core defer strategy from #514 added a second
one. Chrome drops the nonce of a script with a duplicated attribute, so
a nonce-based CSP blocks app.js.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oxyc
oxyc merged commit 488cb97 into master Dec 3, 2026
1 check passed
@oxyc
oxyc deleted the fix/duplicate-defer-nonce branch December 3, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant