mirror of https://github.com/lukechilds/node.git
Browse Source
Now parts of our public and public-ish APIs fall back to old-style
listenerCount() if the emitter does not have a listenerCount function.
Fixes: https://github.com/nodejs/node/issues/2655
Refs: 8f58fb92ff
PR-URL: https://github.com/nodejs/node/pull/2661
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v5.x
Jeremiah Senkpiel
9 years ago
committed by
Rod Vagg
5 changed files with 31 additions and 7 deletions
@ -0,0 +1,19 @@ |
|||
'use strict'; |
|||
const common = require('../common'); |
|||
const stream = require('stream'); |
|||
|
|||
const r = new stream.Stream(); |
|||
r.listenerCount = undefined; |
|||
|
|||
const w = new stream.Stream(); |
|||
w.listenerCount = undefined; |
|||
|
|||
w.on('pipe', function() { |
|||
r.emit('error', new Error('Readable Error')); |
|||
w.emit('error', new Error('Writable Error')); |
|||
}); |
|||
r.on('error', common.mustCall(noop)); |
|||
w.on('error', common.mustCall(noop)); |
|||
r.pipe(w); |
|||
|
|||
function noop() {}; |
Loading…
Reference in new issue