File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,27 @@ MessagePort.prototype.close = function(cb) {
125125const drainMessagePort = MessagePort . prototype . drain ;
126126delete MessagePort . prototype . drain ;
127127
128+ Object . defineProperty ( MessagePort . prototype , util . inspect . custom , {
129+ enumerable : false ,
130+ writable : false ,
131+ value : function inspect ( ) { // eslint-disable-line func-name-matching
132+ let ref ;
133+ try {
134+ // This may throw when `this` does not refer to a native object,
135+ // e.g. when accessing the prototype directly.
136+ ref = this . hasRef ( ) ;
137+ } catch { return this ; }
138+ return Object . assign ( Object . create ( MessagePort . prototype ) ,
139+ ref === undefined ? {
140+ active : false ,
141+ } : {
142+ active : true ,
143+ refed : ref
144+ } ,
145+ this ) ;
146+ }
147+ } ) ;
148+
128149function setupPortReferencing ( port , eventEmitter , eventName ) {
129150 // Keep track of whether there are any workerMessage listeners:
130151 // If there are some, ref() the channel so it keeps the event loop alive.
You can’t perform that action at this time.
0 commit comments