- Version: v15.5.0
- Platform: Microsoft Windows NT 10.0.20279.0 x64
- Subsystem:
What steps will reproduce the bug?
let events = require('events');
let ac = new AbortController();
let e = new events.EventEmitter();
events.once(e, 'test', {signal: ac.signal});
ac.abort();
console.log(e.listeners('test'));
console.log(e.listeners('error'));
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
The error listener should be removed, so console.log should print an empty array.
What do you see instead?
console.log prints an array with one listener.
Additional information
It seems the wrong listener is being removed in the following line:
|
eventTargetAgnosticRemoveListener(emitter, 'error', resolver); |
The error listener is called errorListener, not resolver.