Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with "globalThis": ("the global across environments" content is outdated)) #10470

Closed
Southhill opened this issue Nov 12, 2021 · 1 comment · Fixed by #17337
Closed

Issue with "globalThis": ("the global across environments" content is outdated)) #10470

Southhill opened this issue Nov 12, 2021 · 1 comment · Fixed by #17337
Labels
Content:JS JavaScript docs

Comments

@Southhill
Copy link

MDN URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis

What information was incorrect, unhelpful, or incomplete?

Prior to globalThis, the only reliable cross-platform way to get the global object for an environment was Function('return this')(). However, this causes CSP violations in some settings, so es6-shim uses a check like this, for example:

the global across environments content is outdated.

es6-shim source code is changed, for example:

var getGlobal = new Function('return this;');

link: https://github.com/paulmillr/es6-shim/blob/master/es6-sham.js#L31

Specific section or headline?

What did you expect to see?

Did you test this? If so, how?

MDN Content page report details
@Rumyra Rumyra added Content:JS JavaScript docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Nov 22, 2021
@Josh-Cena
Copy link
Member

This is because es6-shim and es6-sham are two things. You can find es6-shim's related source here: https://github.com/paulmillr/es6-shim/blob/c3eb45b440092c53597e092cee47cedb578f4c24/es6-shim.js#L176-L187

The idea of a sham is that—IIUC—it just provides the existence of an API, but does not provide any behaviors, so the implementation appears to be quite cracky.

@sideshowbarker sideshowbarker removed the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jun 22, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Content:JS JavaScript docs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants