File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -446,7 +446,7 @@ Domain.prototype.bind = function(cb) {
446
446
EventEmitter . usingDomains = true ;
447
447
448
448
const eventInit = EventEmitter . init ;
449
- EventEmitter . init = function ( ) {
449
+ EventEmitter . init = function ( opts ) {
450
450
ObjectDefineProperty ( this , 'domain' , {
451
451
configurable : true ,
452
452
enumerable : false ,
@@ -457,7 +457,7 @@ EventEmitter.init = function() {
457
457
this . domain = exports . active ;
458
458
}
459
459
460
- return FunctionPrototypeCall ( eventInit , this ) ;
460
+ return FunctionPrototypeCall ( eventInit , this , opts ) ;
461
461
} ;
462
462
463
463
const eventEmit = EventEmitter . prototype . emit ;
Original file line number Diff line number Diff line change @@ -321,6 +321,8 @@ EventEmitter.setMaxListeners =
321
321
}
322
322
} ;
323
323
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).
324
326
EventEmitter . init = function ( opts ) {
325
327
326
328
if ( this . _events === undefined ||
Original file line number Diff line number Diff line change @@ -18,3 +18,11 @@ d.on('error', common.mustCall((err) => {
18
18
19
19
d . add ( e ) ;
20
20
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
+ }
You can’t perform that action at this time.
0 commit comments