diff --git a/lib/internal/streams/readable.js b/lib/internal/streams/readable.js index ccbe6434577c0f..51444deb355c3b 100644 --- a/lib/internal/streams/readable.js +++ b/lib/internal/streams/readable.js @@ -1233,9 +1233,6 @@ function nReadingNextTick(self) { // If the user uses them, then switch into old mode. Readable.prototype.resume = function() { const state = this._readableState; - if ((state[kState] & kDestroyed) !== 0) { - return this; - } if ((state[kState] & kFlowing) === 0) { debug('resume'); // We flow only if there is no one listening @@ -1276,9 +1273,6 @@ function resume_(stream, state) { Readable.prototype.pause = function() { const state = this._readableState; - if ((state[kState] & kDestroyed) !== 0) { - return this; - } debug('call pause'); if ((state[kState] & (kHasFlowing | kFlowing)) !== kHasFlowing) { debug('pause'); diff --git a/test/parallel/test-stream-destroy.js b/test/parallel/test-stream-destroy.js index 88bba6b8348894..12706714aa7c8a 100644 --- a/test/parallel/test-stream-destroy.js +++ b/test/parallel/test-stream-destroy.js @@ -118,13 +118,3 @@ const http = require('http'); req.end('asd'); })); } - -{ - // resume() and pause() should be no-ops on destroyed streams. - const r = new Readable({ read() {} }); - r.destroy(); - r.on('resume', common.mustNotCall()); - r.on('pause', common.mustNotCall()); - r.resume(); - r.pause(); -}