Skip to content

Harden window and navigator global property descriptors#57447

Open
rubennorte wants to merge 1 commit into
react:mainfrom
rubennorte:export-D110759948
Open

Harden window and navigator global property descriptors#57447
rubennorte wants to merge 1 commit into
react:mainfrom
rubennorte:export-D110759948

Conversation

@rubennorte

Copy link
Copy Markdown
Member

Summary:
The window and navigator globals were installed with plain property assignments, which produced writable and configurable data properties. This makes the global definitions safer and more spec-compliant: window is now non-writable and non-configurable (still enumerable), matching how browsers expose it, and navigator is now non-writable (still configurable and enumerable). self is unchanged and remains writable, configurable and enumerable. window and self are now installed on globalThis.

Also adds Fantom tests that assert the property descriptors of the window, self, navigator, Infinity, NaN and undefined globals so these guarantees don't regress.

Changelog:
[General][Changed] - Make the window global non-writable and non-configurable, and the navigator global non-writable

Differential Revision: D110759948

Summary:
The `window` and `navigator` globals were installed with plain property assignments, which produced writable and configurable data properties. This makes the global definitions safer and more spec-compliant: `window` is now non-writable and non-configurable (still enumerable), matching how browsers expose it, and `navigator` is now non-writable (still configurable and enumerable). `self` is unchanged and remains writable, configurable and enumerable. `window` and `self` are now installed on `globalThis`.

Also adds Fantom tests that assert the property descriptors of the `window`, `self`, `navigator`, `Infinity`, `NaN` and `undefined` globals so these guarantees don't regress.

Changelog:
[General][Changed] - Make the `window` global non-writable and non-configurable, and the `navigator` global non-writable

Differential Revision: D110759948
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 6, 2026
@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels Jul 6, 2026
@meta-codesync

meta-codesync Bot commented Jul 6, 2026

Copy link
Copy Markdown

@rubennorte has exported this pull request. If you are a Meta employee, you can view the originating Diff in D110759948.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant