Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
events: don't inherit from Object.prototype#6092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -21,7 +21,6 @@ assert(fl.length === 1); | ||
| assert(fl[0] === assert.fail); | ||
| e.listeners('bar'); | ||
| assert(!e._events.hasOwnProperty('bar')); | ||
| ||
| e.on('foo', assert.ok); | ||
| fl = e.listeners('foo'); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| 'use strict' | ||
| const common = require('../common'); | ||
| const EventEmitter = require('events'); | ||
| const assert = require('assert'); | ||
| const ee = new EventEmitter(); | ||
| const handler = () =>{}; | ||
| assert.strictEqual(ee._events.hasOwnProperty, undefined); | ||
| assert.strictEqual(ee._events.toString, undefined); | ||
| ee.on('__proto__', handler); | ||
| ee.on('__defineGetter__', handler); | ||
| ee.on('toString', handler); | ||
| assert.deepStrictEqual(ee.eventNames(), [ | ||
| '__proto__', | ||
| '__defineGetter__', | ||
| 'toString' | ||
| ]); | ||
| assert.deepStrictEqual(ee.listeners('__proto__'), [handler]); | ||
| assert.deepStrictEqual(ee.listeners('__defineGetter__'), [handler]); | ||
| assert.deepStrictEqual(ee.listeners('toString'), [handler]); | ||
| ee.on('__proto__', common.mustCall(function(val){ | ||
| assert.strictEqual(val, 1); | ||
| })); | ||
| ee.emit('__proto__', 1); | ||
| process.on('__proto__', common.mustCall(function(val){ | ||
| assert.strictEqual(val, 1); | ||
| })); | ||
| process.emit('__proto__', 1); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this
process._events?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.