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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
cjihrig authored and Michaël Zasso committed 2021-05-01 12:25:17 +02:00
1 parent 13d972dd86
commit bd38dfbfcc
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -456,7 +456,7 @@ EventEmitter.init = function() {
};
const eventEmit = EventEmitter.prototype.emit;
EventEmitter.prototype.emit = function(...args) {
EventEmitter.prototype.emit = function emit(...args) {
const domain = this.domain;
const type = args[0];
+1 -1
View File
@@ -9,7 +9,7 @@ const inspector = require('inspector');
process.on('warning', common.mustCall((warning) => {
assert.strictEqual(warning.code, 'DEP0097');
assert.match(warning.message, /Triggered by calling <anonymous> on process/);
assert.match(warning.message, /Triggered by calling emit on process/);
}));
domain.create().run(() => {