Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
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>
  • Loading branch information
cjihrig committed Mar 3, 2021
commit 152de34fb1fbf3803cee8d7dac2c37ad5061e331
2 changes: 1 addition & 1 deletion lib/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-domain-dep0097.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down