mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
src: use the config binding to carry --no-browser-globals
Instead of setting it in the process object, since this is a configure-time option. Also added a shim that can be deprecated and removed some time later. PR-URL: https://github.com/nodejs/node/pull/26228 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
1 parent
fe6c419503
commit
0d810b7ef0
4 files changed
+22
-7
No files matched your search
@@ -180,8 +180,7 @@ if (config.hasInspector) {
|
||||
internalBinding('inspector').registerAsyncHook(enable, disable);
|
||||
}
|
||||
|
||||
const browserGlobals = !process._noBrowserGlobals;
|
||||
if (browserGlobals) {
|
||||
if (!config.noBrowserGlobals) {
|
||||
// Override global console from the one provided by the VM
|
||||
// to the one implemented by Node.js
|
||||
// https://console.spec.whatwg.org/#console-namespace
|
||||
|
||||
@@ -135,6 +135,20 @@ function initializeDeprecations() {
|
||||
'DEP0103') :
|
||||
types[name];
|
||||
}
|
||||
|
||||
// TODO(joyeecheung): this is a legacy property exposed to process.
|
||||
// Now that we use the config binding to carry this information, remove
|
||||
// it from the process. We may consider exposing it properly in
|
||||
// process.features.
|
||||
const { noBrowserGlobals } = internalBinding('config');
|
||||
if (noBrowserGlobals) {
|
||||
Object.defineProperty(process, '_noBrowserGlobals', {
|
||||
writable: false,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
value: noBrowserGlobals
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function setupChildProcessIpcChannel() {
|
||||
|
||||
@@ -70,6 +70,13 @@ static void Initialize(Local<Object> target,
|
||||
READONLY_FALSE_PROPERTY(target, "hasInspector");
|
||||
#endif
|
||||
|
||||
// configure --no-browser-globals
|
||||
#ifdef NODE_NO_BROWSER_GLOBALS
|
||||
READONLY_TRUE_PROPERTY(target, "noBrowserGlobals");
|
||||
#else
|
||||
READONLY_FALSE_PROPERTY(target, "noBrowserGlobals");
|
||||
#endif // NODE_NO_BROWSER_GLOBALS
|
||||
|
||||
READONLY_PROPERTY(target,
|
||||
"bits",
|
||||
Number::New(env->isolate(), 8 * sizeof(intptr_t)));
|
||||
|
||||
@@ -233,11 +233,6 @@ MaybeLocal<Object> CreateProcessObject(
|
||||
READONLY_PROPERTY(process, "throwDeprecation", True(env->isolate()));
|
||||
}
|
||||
|
||||
#ifdef NODE_NO_BROWSER_GLOBALS
|
||||
// configure --no-browser-globals
|
||||
READONLY_PROPERTY(process, "_noBrowserGlobals", True(env->isolate()));
|
||||
#endif // NODE_NO_BROWSER_GLOBALS
|
||||
|
||||
// --prof-process
|
||||
// TODO(addaleax): Remove this.
|
||||
if (env->options()->prof_process) {
|
||||
|
||||
Reference in new issue
Block a user