Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 74bd312

Browse filesBrowse files
MoonBallBethGriggs
authored andcommitted
domain: pass opts to EventEmitter.init
PR-URL: #41414 Fixes: #41391 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent e8062bf commit 74bd312
Copy full SHA for 74bd312

File tree

Expand file treeCollapse file tree

3 files changed

+12
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+12
-2
lines changed
Open diff view settings
Collapse file

‎lib/domain.js‎

Copy file name to clipboardExpand all lines: lib/domain.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ Domain.prototype.bind = function(cb) {
446446
EventEmitter.usingDomains = true;
447447

448448
const eventInit = EventEmitter.init;
449-
EventEmitter.init = function() {
449+
EventEmitter.init = function(opts) {
450450
ObjectDefineProperty(this, 'domain', {
451451
configurable: true,
452452
enumerable: false,
@@ -457,7 +457,7 @@ EventEmitter.init = function() {
457457
this.domain = exports.active;
458458
}
459459

460-
return FunctionPrototypeCall(eventInit, this);
460+
return FunctionPrototypeCall(eventInit, this, opts);
461461
};
462462

463463
const eventEmit = EventEmitter.prototype.emit;
Collapse file

‎lib/events.js‎

Copy file name to clipboardExpand all lines: lib/events.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ EventEmitter.setMaxListeners =
321321
}
322322
};
323323

324+
// If you're updating this function definition, please also update any
325+
// re-definitions, such as the one in the Domain module (lib/domain.js).
324326
EventEmitter.init = function(opts) {
325327

326328
if (this._events === undefined ||
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-domain-ee.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@ d.on('error', common.mustCall((err) => {
1818

1919
d.add(e);
2020
e.emit('error', new Error('foobar'));
21+
22+
{
23+
// Ensure initial params pass to origin `EventEmitter.init` function
24+
const e = new EventEmitter({ captureRejections: true });
25+
const kCapture = Object.getOwnPropertySymbols(e)
26+
.find((it) => it.description === 'kCapture');
27+
assert.strictEqual(e[kCapture], true);
28+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.