diff options
author | Vladimir Kurchatkin <vladimir.kurchatkin@gmail.com> | 2014-04-04 02:11:56 +0400 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2014-04-15 13:00:31 -0700 |
commit | 2c6b424829caf0a4c07839c4daac3a438c0f0c9a (patch) | |
tree | 9e069808647e62e41b872666710f07b652607a11 /test | |
parent | c7f424e44b7e61b89f91cd344599c3d1cdfb88fe (diff) | |
download | android-node-v8-2c6b424829caf0a4c07839c4daac3a438c0f0c9a.tar.gz android-node-v8-2c6b424829caf0a4c07839c4daac3a438c0f0c9a.tar.bz2 android-node-v8-2c6b424829caf0a4c07839c4daac3a438c0f0c9a.zip |
events: check if _events is an own property
Without this check it is possible to have the _events object shared
amongst instances.
Fixes #7157
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/simple/test-event-emitter-subclass.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/simple/test-event-emitter-subclass.js b/test/simple/test-event-emitter-subclass.js index 8a2e9c1564..60b4bf387d 100644 --- a/test/simple/test-event-emitter-subclass.js +++ b/test/simple/test-event-emitter-subclass.js @@ -53,3 +53,17 @@ process.on('exit', function() { assert.deepEqual(myee._events, {}); console.log('ok'); }); + + +function MyEE2() { + EventEmitter.call(this); +} + +MyEE2.prototype = new EventEmitter(); + +var ee1 = new MyEE2(); +var ee2 = new MyEE2(); + +ee1.on('x', function () {}); + +assert.equal(EventEmitter.listenerCount(ee2, 'x'), 0); |