diff options
author | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2022-06-03 10:23:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-03 09:23:58 +0100 |
commit | 06d860696033b67a8f4aa97b083009ad3d82ef26 (patch) | |
tree | 35c2c4a08254640cb1b2c83aafc6c2c30c39a5cf /lib/events.js | |
parent | 218664f638a91e331b800b2d49eca55a65899a50 (diff) | |
download | node-new-06d860696033b67a8f4aa97b083009ad3d82ef26.tar.gz |
lib: use null-prototype objects for property descriptors
Refs: https://github.com/nodejs/node/pull/42921
PR-URL: https://github.com/nodejs/node/pull/43270
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Diffstat (limited to 'lib/events.js')
-rw-r--r-- | lib/events.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/events.js b/lib/events.js index 7b5de246b9..ad5ded2d0e 100644 --- a/lib/events.js +++ b/lib/events.js @@ -219,6 +219,7 @@ EventEmitter.usingDomains = false; EventEmitter.captureRejectionSymbol = kRejection; ObjectDefineProperty(EventEmitter, 'captureRejections', { + __proto__: null, get() { return EventEmitter.prototype[kCapture]; }, @@ -231,6 +232,7 @@ ObjectDefineProperty(EventEmitter, 'captureRejections', { }); ObjectDefineProperty(EventEmitter, 'EventEmitterAsyncResource', { + __proto__: null, enumerable: true, get: lazyEventEmitterAsyncResource, set: undefined, @@ -241,6 +243,7 @@ EventEmitter.errorMonitor = kErrorMonitor; // The default for captureRejections is false ObjectDefineProperty(EventEmitter.prototype, kCapture, { + __proto__: null, value: false, writable: true, enumerable: false @@ -260,6 +263,7 @@ function checkListener(listener) { } ObjectDefineProperty(EventEmitter, 'defaultMaxListeners', { + __proto__: null, enumerable: true, get: function() { return defaultMaxListeners; @@ -276,12 +280,14 @@ ObjectDefineProperty(EventEmitter, 'defaultMaxListeners', { ObjectDefineProperties(EventEmitter, { kMaxEventTargetListeners: { + __proto__: null, value: kMaxEventTargetListeners, enumerable: false, configurable: false, writable: false, }, kMaxEventTargetListenersWarned: { + __proto__: null, value: kMaxEventTargetListenersWarned, enumerable: false, configurable: false, @@ -493,6 +499,7 @@ EventEmitter.prototype.emit = function emit(type, ...args) { const capture = {}; ErrorCaptureStackTrace(capture, EventEmitter.prototype.emit); ObjectDefineProperty(er, kEnhanceStackBeforeInspector, { + __proto__: null, value: FunctionPrototypeBind(enhanceStackTrace, this, er, capture), configurable: true }); |