lib: fix TypeError with EventEmitter#on() abuse
authorBen Noordhuis <info@bnoordhuis.nl>
Tue, 20 Jan 2015 18:30:50 +0000 (19:30 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Tue, 20 Jan 2015 22:25:57 +0000 (23:25 +0100)
commitee9cd004d8a211871439fc77c0696b79c5d0e52d
treeb7af0b11de5b56d31aeafe93174483fad480994d
parent77d68070dafe56b5593ad92759a57c64de6b4cf1
lib: fix TypeError with EventEmitter#on() abuse

Commit 2931348 added EventEmitter#getMaxListeners() but introduced a
regression when people abuse EventEmitter.prototype.on.call() to call
EventEmitter#on() on a non-EE object.  Add a workaround for that.

Fixes: https://github.com/iojs/io.js/issues/523
PR-URL: https://github.com/iojs/io.js/pull/527
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
lib/events.js
test/parallel/test-event-emitter-get-max-listeners.js