Skip to content

Commit bd38dfb

Browse files
cjihrigtargos
authored andcommitted
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 <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 13d972d commit bd38dfb

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)