lib: make String(global) === '[object global]'
This inadvertently changed to `[object Object]` with the V8 upgrade in 8a24728...96933df. Use `Symbol.toStringTag` to undo this particular change. Fixes: https://github.com/nodejs/node/issues/9274 PR-URL: https://github.com/nodejs/node/pull/9279 Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
This commit is contained in:
parent
45a716c968
commit
0fb21df6e6
6
lib/internal/bootstrap_node.js
vendored
6
lib/internal/bootstrap_node.js
vendored
@ -190,6 +190,12 @@
|
||||
}
|
||||
|
||||
function setupGlobalVariables() {
|
||||
Object.defineProperty(global, Symbol.toStringTag, {
|
||||
value: 'global',
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
global.process = process;
|
||||
const util = NativeModule.require('util');
|
||||
|
||||
|
@ -21,3 +21,5 @@ const fooBar = module.fooBar;
|
||||
assert.strictEqual('foo', fooBar.foo, 'x -> global.x in sub level not working');
|
||||
|
||||
assert.strictEqual('bar', fooBar.bar, 'global.x -> x in sub level not working');
|
||||
|
||||
assert.strictEqual(Object.prototype.toString.call(global), '[object global]');
|
||||
|
Loading…
x
Reference in New Issue
Block a user