Skip to content

fix(csp): skip fence when enumerating globalThis properties - #4935

Open
yeapea wants to merge 1 commit into
alpinejs:mainfrom
yeapea:fix/csp-skip-fence
Open

yeapea wants to merge 1 commit into
alpinejs:mainfrom
yeapea:fix/csp-skip-fence

Conversation

@yeapea

@yeapea yeapea commented Oct 18, 2026

Copy link
Copy Markdown

Problem

The CSP parser reads every own property of globalThis to build its set of known globals. In Chrome 158 (Canary today, stable on November 17 according to the Chromium schedule), reading window.fence raises a FencedFrame deprecation issue in DevTools → Issues on every page that loads the CSP build. Chrome 155 doesn't report it, and I haven't checked 156 or 157.

Lighthouse counts it, so Best Practices drops from 100 to 81. That's the same drop #4787 fixed for sharedStorage.

Solution

Add "fence" to the skip list next to "styleMedia" and "sharedStorage".

Testing

I read the globals the way the parser does, one fresh page per run, and listened for DeprecationIssue events over the DevTools protocol:

Chrome current skip list with fence skipped
158.0.8109.1 (Canary) FencedFrame none
155.0.8059.84 (stable) none none

Reading the four globals with "fence" in their name one at a time in 158, only fence raises it. Fence, FencedFrameConfig and HTMLFencedFrameElement don't.

The new tests/vitest/csp-globals.spec.js puts getters on styleMedia, sharedStorage and fence before importing the parser and checks that none of them gets read. It fails on main, where fence is read, and passes with this change.

Chrome 158 raises a FencedFrame deprecation issue when window.fence is
read, and the parser reads every own property of globalThis to collect
its known globals. Skip it the way styleMedia and sharedStorage are
skipped, and test that the parser reads none of the three.

This branch has not been deployed

No deployments
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