Skip to content

Commit 236ba04

Browse files
cjihrigdanielleadams
authored andcommittedMar 16, 2021
domain: add name to monkey-patched emit function
The domain module monkey patches EventEmitter.prototype.emit(), however the function's name was becoming the empty string. This commit forces the new emit function to have the proper name. PR-URL: #37550 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 1c09776 commit 236ba04

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎lib/domain.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ EventEmitter.init = function() {
456456
};
457457

458458
const eventEmit = EventEmitter.prototype.emit;
459-
EventEmitter.prototype.emit = function(...args) {
459+
EventEmitter.prototype.emit = function emit(...args) {
460460
const domain = this.domain;
461461

462462
const type = args[0];

‎test/parallel/test-domain-dep0097.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const inspector = require('inspector');
99

1010
process.on('warning', common.mustCall((warning) => {
1111
assert.strictEqual(warning.code, 'DEP0097');
12-
assert.match(warning.message, /Triggered by calling <anonymous> on process/);
12+
assert.match(warning.message, /Triggered by calling emit on process/);
1313
}));
1414

1515
domain.create().run(() => {

0 commit comments

Comments
 (0)
Please sign in to comment.