summaryrefslogtreecommitdiff
path: root/lib/events.js
diff options
context:
space:
mode:
authorAntoine du Hamel <duhamelantoine1995@gmail.com>2020-10-27 20:41:34 +0100
committerNode.js GitHub Bot <github-bot@iojs.org>2020-10-30 11:08:20 +0000
commit1da672994ac26658375db2b6a60fb00e56d02a4d (patch)
treec6976f2c55f20f07a179aeb3e98e098aadfea6c8 /lib/events.js
parent05bb1b3f9460f96a0241ecd2fada6d3abfdaf61d (diff)
downloadnode-new-1da672994ac26658375db2b6a60fb00e56d02a4d.tar.gz
lib: use primordials when calling methods of Error
This is to unsure that code using those methods won't crash if the methods are deleted in userland. PR-URL: https://github.com/nodejs/node/pull/35837 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Diffstat (limited to 'lib/events.js')
-rw-r--r--lib/events.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/events.js b/lib/events.js
index 7d3ee54018..f82776072b 100644
--- a/lib/events.js
+++ b/lib/events.js
@@ -24,6 +24,7 @@
const {
Boolean,
Error,
+ ErrorCaptureStackTrace,
MathMin,
NumberIsNaN,
ObjectCreate,
@@ -291,8 +292,7 @@ EventEmitter.prototype.emit = function emit(type, ...args) {
if (er instanceof Error) {
try {
const capture = {};
- // eslint-disable-next-line no-restricted-syntax
- Error.captureStackTrace(capture, EventEmitter.prototype.emit);
+ ErrorCaptureStackTrace(capture, EventEmitter.prototype.emit);
ObjectDefineProperty(er, kEnhanceStackBeforeInspector, {
value: enhanceStackTrace.bind(this, er, capture),
configurable: true