Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ Readable.prototype.removeListener = function(ev, fn) {
};

Readable.prototype.removeAllListeners = function(ev) {
const res = Stream.prototype.removeAllListeners.call(this, ev);
const res = Stream.prototype.removeAllListeners.apply(this, arguments);

if (ev === 'readable' || ev === undefined) {
// We need to check if there is someone still listening to
Expand Down
13 changes: 13 additions & 0 deletions test/parallel/test-stream-readable-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,16 @@ const Readable = require('stream').Readable;
assert.deepStrictEqual(result, expected);
}));
}

{
// #20923
const r = new Readable();
r._read = function() {
// actually doing thing here
};
r.on('data', function() {});

r.removeAllListeners();

assert.strictEqual(r.eventNames().length, 0);
}