-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
lib: remove Object from global's prototype #5888
Conversation
Removes some strange behavior from having Object in the global object's prototype chain. No longer introducing global variables coming from `Object.prototype`.
CC: @trevnorris |
@@ -208,7 +208,6 @@ | |||
|
|||
function setupGlobalVariables() { | |||
global.process = process; | |||
global.global = global; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, we were assigning this again?? Should I be removing this bit in my PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. But let's definitely see what citgm says. /cc @thealphanerd |
well the lack of a global |
Relevant: http://www.ecma-international.org/ecma-262/6.0/index.html#sec-global-object
|
@Slayer95 correct, but breaking existing libraries is a bad sign |
lodash: Oh my. Yeah I'm not sure this will be something we can do. Looks like Chrome also exposes |
Maybe we could expose specific ones like |
@Fishrock123 some people are explicitly checking all known globals by variable name, like in |
Going to close this after lots of CITGM attempts on my own, too many people using it in the wild. |
Pull Request check-list
Please make sure to review and check all of these items:
make -j8 test
(UNIX) orvcbuild test nosign
(Windows) pass withthis change (including linting)?
Affected core subsystem(s)
lib
Description of change
Removes some strange behavior from having Object in the global object's
prototype chain. No longer introducing global variables coming from
Object.prototype
.These globals have strange warts from existing but we should throw this in CITGM this to see if anything is affected. The only thing I really am suspicious of is
toString
might be used by some people via type coercion likevar_that_refs_global+''
.This would be a breaking change.