stream: fix removeAllListeners() for Stream.Readable#20924
stream: fix removeAllListeners() for Stream.Readable#20924kaelzhang wants to merge 1 commit intonodejs:masterfrom
Conversation
apapirovski
left a comment
There was a problem hiding this comment.
LGTM but we could make the condition simpler (or, well, get rid of it).
lib/_stream_readable.js
Outdated
There was a problem hiding this comment.
Actually, could you do this instead: Stream.prototype.removeAllListeners.apply(this, arguments)?
771108d to
24320ec
Compare
|
Perhaps a better fix might be to change |
ryzokuken
left a comment
There was a problem hiding this comment.
Looks nice, going forward, but I wasn't really satisfied by the unit test. Could you make the changes I asked for?
There was a problem hiding this comment.
What if you remove this line right here? Do the tests still pass? They probably should because we never added any listeners to begin with. Could you try adding a few listeners, assert that r.eventNames() is non-zero, call this line and then assert it's zero please?
There was a problem hiding this comment.
I've changed the test a little bit. Any suggestions?
I don't think |
Which is why I said it'd be semver-major. I can't imagine anyone relying on |
|
I agree with @mscdex that it would be best to change |
|
@apapirovski @mcollina @lpinca is anyone of you strongly in favor of this over just fixing not converting |
|
@BridgeAR this fix a bad bug which could lead a potential memory leak. If you want to change the underlining function in a semver-major might be a good call to avoid this in the future. |
|
This should just land barring the CI being red. I'm whatever on the other change... if people want to, fine by me but I don't really care either way. |
|
CI failures are unrelated. This can land. |
|
Landed as 9f4bf4c. |
Notable Changes:
* **deps**:
- upgrade npm to 6.1.0 (Rebecca Turner)
#20190
* **fs**:
- fix reads with pos \> 4GB (Mathias Buus)
#21003
* **net**:
- new option to allow IPC servers to be readable and writable
by all users (Bartosz Sosnowski)
#19472
* **stream**:
- fix removeAllListeners() for Stream.Readable to work as expected
when no arguments are passed (Kael Zhang)
#20924
* **Added new collaborators**
- John-David Dalton (https://github.com/jdalton)
PR-URL: #21011
Notable Changes:
* **deps**:
- upgrade npm to 6.1.0 (Rebecca Turner)
#20190
* **fs**:
- fix reads with pos \> 4GB (Mathias Buus)
#21003
* **net**:
- new option to allow IPC servers to be readable and writable
by all users (Bartosz Sosnowski)
#19472
* **stream**:
- fix removeAllListeners() for Stream.Readable to work as expected
when no arguments are passed (Kael Zhang)
#20924
* **Added new collaborators**
- John-David Dalton (https://github.com/jdalton)
PR-URL: #21011
Notable Changes:
* **deps**:
- upgrade npm to 6.1.0 (Rebecca Turner)
#20190
* **fs**:
- fix reads with pos \> 4GB (Mathias Buus)
#21003
* **net**:
- new option to allow IPC servers to be readable and writable
by all users (Bartosz Sosnowski)
#19472
* **stream**:
- fix removeAllListeners() for Stream.Readable to work as expected
when no arguments are passed (Kael Zhang)
#20924
* **Added new collaborators**
- John-David Dalton (https://github.com/jdalton)
PR-URL: #21011
This change is necessary for Electron 3 to a bug in Node.js 10.2.x which causes the `removeAllListeners` method to no longer remove all listeners for any event name when no argument is passed: nodejs/node#20924 This issue has been fixed in Node.js 10.3.0+ so we will have to remove this workaround when we move to Electron 4.0 to avoid future event handler leaks.
This change is necessary for Electron 3 to a bug in Node.js 10.2.x which causes the `removeAllListeners` method to no longer remove all listeners for any event name when no argument is passed: nodejs/node#20924 This issue has been fixed in Node.js 10.3.0+ so we will have to remove this workaround when we move to Electron 4.0 to avoid future event handler leaks.
This change is necessary for Electron 3 to a bug in Node.js 10.2.x which causes the `removeAllListeners` method to no longer remove all listeners for any event name when no argument is passed: nodejs/node#20924 This issue has been fixed in Node.js 10.3.0+ so we will have to remove this workaround when we move to Electron 4.0 to avoid future event handler leaks.
Refs: #20923
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes