Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/raw-mirror-paths.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
# Keep one path per line.

rss.xml
images/branding/logo-light.png
images/branding/logo-dark.png
9 changes: 8 additions & 1 deletion static/js/core/trusted-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
* Must run BEFORE any code that touches DOM injection sinks.
*/
export function ensureDefaultPolicy() {
// Avoid attempting to create the policy if it already exists. Creating
// a TrustedTypes policy with the same name can trigger a CSP violation
// (browsers may block duplicate creations when CSP doesn't allow
// duplicates). The main site sets `window.__defaultPolicy` when it
// bootstraps — check that first to keep this function idempotent.
if (window.__defaultPolicy) return;

if (window.trustedTypes && window.trustedTypes.createPolicy) {
try {
window.__defaultPolicy = window.trustedTypes.createPolicy("default", {
Expand All @@ -19,7 +26,7 @@ export function ensureDefaultPolicy() {
},
});
} catch {
/* policy already exists — safe to ignore */
/* policy already exists or creation blocked by CSP — safe to ignore */
}
}

Expand Down
Loading
Loading