diff options
Diffstat (limited to 'lib/internal/bootstrap/pre_execution.js')
-rw-r--r-- | lib/internal/bootstrap/pre_execution.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js index db50c3d0ee..b373801592 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -1,6 +1,9 @@ 'use strict'; -const { Object, SafeWeakMap } = primordials; +const { + ObjectDefineProperty, + SafeWeakMap, +} = primordials; const { getOptionValue } = require('internal/options'); const { Buffer } = require('buffer'); @@ -74,7 +77,7 @@ function patchProcessObject(expandArgv1) { patchProcessObjectNative(process); - Object.defineProperty(process, 'argv0', { + ObjectDefineProperty(process, 'argv0', { enumerable: true, configurable: false, value: process.argv[0] @@ -107,7 +110,7 @@ function patchProcessObject(expandArgv1) { function addReadOnlyProcessAlias(name, option, enumerable = true) { const value = getOptionValue(option); if (value) { - Object.defineProperty(process, name, { + ObjectDefineProperty(process, name, { writable: false, configurable: true, enumerable, @@ -153,7 +156,7 @@ function initializeReport() { } const { report } = require('internal/process/report'); const { emitExperimentalWarning } = require('internal/util'); - Object.defineProperty(process, 'report', { + ObjectDefineProperty(process, 'report', { enumerable: false, configurable: true, get() { @@ -273,7 +276,7 @@ function initializeDeprecations() { // process.features. const { noBrowserGlobals } = internalBinding('config'); if (noBrowserGlobals) { - Object.defineProperty(process, '_noBrowserGlobals', { + ObjectDefineProperty(process, '_noBrowserGlobals', { writable: false, enumerable: true, configurable: true, @@ -295,7 +298,7 @@ function initializeDeprecations() { // deprecation path for these in ES Modules. // See https://github.com/nodejs/node/pull/26334. let _process = process; - Object.defineProperty(global, 'process', { + ObjectDefineProperty(global, 'process', { get() { return _process; }, @@ -307,7 +310,7 @@ function initializeDeprecations() { }); let _Buffer = Buffer; - Object.defineProperty(global, 'Buffer', { + ObjectDefineProperty(global, 'Buffer', { get() { return _Buffer; }, |