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 |
|
|
||
| function setupGlobalVariables() { | ||
| global.process = process; | ||
| global.global = global; |
There was a problem hiding this comment.
Wait, we were assigning this again?? Should I be removing this bit in my PR?
There was a problem hiding this comment.
|
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
toStringmight be used by some people via type coercion likevar_that_refs_global+''.This would be a breaking change.