diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-12-06 00:17:44 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-12-13 15:16:52 +0100 |
commit | c992639fbdc61fa78dc407ac09f633b102c55925 (patch) | |
tree | af37d2441e5d907b8dbb7e2680be199cb520dff8 /lib/internal | |
parent | a3801e96835821b71dd97b3f8513c56814bcf8fa (diff) | |
download | android-node-v8-c992639fbdc61fa78dc407ac09f633b102c55925.tar.gz android-node-v8-c992639fbdc61fa78dc407ac09f633b102c55925.tar.bz2 android-node-v8-c992639fbdc61fa78dc407ac09f633b102c55925.zip |
bootstrap: make Buffer and process non-enumerable
This makes sure these two properties are non-enumerable. This aligns
them with all other globals that are not enumerable by spec.
Refs: https://github.com/nodejs/node/issues/20565
PR-URL: https://github.com/nodejs/node/pull/24874
Refs: https://github.com/nodejs/node/issues/20565
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'lib/internal')
-rw-r--r-- | lib/internal/bootstrap/node.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index b537e62fe9..31ab0f986c 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -408,7 +408,12 @@ function setupGlobalVariables() { enumerable: false, configurable: true }); - global.process = process; + Object.defineProperty(global, 'process', { + value: process, + enumerable: false, + writable: true, + configurable: true + }); const util = NativeModule.require('util'); function makeGetter(name) { @@ -445,7 +450,12 @@ function setupGlobalVariables() { // and exposes it on `internal/buffer`. NativeModule.require('internal/buffer'); - global.Buffer = NativeModule.require('buffer').Buffer; + Object.defineProperty(global, 'Buffer', { + value: NativeModule.require('buffer').Buffer, + enumerable: false, + writable: true, + configurable: true + }); process.domain = null; process._exiting = false; } |