Skip to content

events: don't inherit from Object.prototype - #6092

Merged
mscdex merged 1 commit into
nodejs:masterfrom
mscdex:events-empty-prototype
Apr 19, 2016
Merged

events: don't inherit from Object.prototype#6092
mscdex merged 1 commit into
nodejs:masterfrom
mscdex:events-empty-prototype

Conversation

@mscdex

Copy link
Copy Markdown
Contributor
Checklist
  • tests and code linting passes
  • a test and/or benchmark is included
  • the commit message follows commit guidelines
Affected core subsystem(s)
  • events
Description of change

This commit safely allows event names that are named the same as properties that are ordinarily inherited from Object.prototype such as __proto__.

Fixes: #728

@mscdexmscdex added events Issues and PRs related to the events subsystem / EventEmitter. semver-major PRs that contain breaking changes and should be released in the next major version. labels Apr 7, 2016
@mscdex
mscdexforce-pushed the events-empty-prototype branch from 8680b06 to 2cec8a1CompareApril 7, 2016 00:39
@mscdex

Copy link
Copy Markdown
ContributorAuthor

@mscdex

Copy link
Copy Markdown
ContributorAuthor

Also, there is no performance regression with this change 💃

@mscdexmscdex added this to the 6.0.0 milestone Apr 7, 2016
@thefourtheye

Copy link
Copy Markdown
Contributor

Can we make use of the test changes in #2350?

@mscdex

Copy link
Copy Markdown
ContributorAuthor

@thefourtheye The included tests should cover it I think

@evanlucas

Copy link
Copy Markdown
Contributor

@mscdex will this have any affect on process since it sets _events to a regular object?

@vkurchatkin

Copy link
Copy Markdown
Contributor

@evanlucas it makes sense to simply call EventEmitter on process

@mscdex
mscdexforce-pushed the events-empty-prototype branch from 2cec8a1 to 3711c52CompareApril 7, 2016 13:06
@mscdex

Copy link
Copy Markdown
ContributorAuthor

@evanlucas

Copy link
Copy Markdown
Contributor

LGTM

Comment threadsrc/node.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this process._events?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@Fishrock123

Copy link
Copy Markdown
Contributor

Hmmm, can this be back-ported? Theoretically, this could be considered a security issue for unvalidated input.

@mscdex

Copy link
Copy Markdown
ContributorAuthor

@Fishrock123 It's definitely a semver-major change, but I don't recall how that plays out with backporting/LTS/etc.

@mscdexmscdex mentioned this pull request Apr 7, 2016
3 tasks
@mscdex

Copy link
Copy Markdown
ContributorAuthor

@jasnell

Copy link
Copy Markdown
Member

I don't believe back porting would be possible to v4. It might be safe to get into v5 tho.

@jasnell

Copy link
Copy Markdown
Member

LGTM

@mscdex

Copy link
Copy Markdown
ContributorAuthor

CI is green except for a flaky test and citgm is green.

@mscdex

Copy link
Copy Markdown
ContributorAuthor

CI again one last time: https://ci.nodejs.org/job/node-test-pull-request/2305/

@jasnell

Copy link
Copy Markdown
Member

Still LGTM

This commit safely allows event names that are named the same as
properties that are ordinarily inherited from Object.prototype such
as __proto__.
Fixes: nodejs#728
PR-URL: nodejs#6092
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@mscdex
mscdexforce-pushed the events-empty-prototype branch from 3711c52 to e38badeCompareApril 19, 2016 01:47
@mscdex
mscdex merged commit e38bade into nodejs:masterApr 19, 2016
@mscdex
mscdex deleted the events-empty-prototype branch April 19, 2016 01:49
@Fishrock123

Copy link
Copy Markdown
Contributor

iirc usually we don't care about warnings

@jasnell

Copy link
Copy Markdown
Member

Typically, but it's nice to avoid them when possible to do so, no?

@Fishrock123

Fishrock123 commented Apr 19, 2016

Copy link
Copy Markdown
Contributor

I guess, just consider though, that there are tons of warnings of the same and there isn't necessarily easy ways to avoid it.

thefourtheye added a commit to thefourtheye/io.js that referenced this pull request Apr 19, 2016
This patch fixes the warning introduced by the changes in e38bade.
Ref: nodejs#6092
thefourtheye added a commit that referenced this pull request Apr 19, 2016
This patch fixes the warning introduced by the changes in e38bade.
Ref: #6092
PR-URL: #6276
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
joelostrowski pushed a commit to joelostrowski/node that referenced this pull request Apr 25, 2016
This commit safely allows event names that are named the same as
properties that are ordinarily inherited from Object.prototype such
as __proto__.
Fixes: nodejs#728
PR-URL: nodejs#6092
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
joelostrowski pushed a commit to joelostrowski/node that referenced this pull request Apr 25, 2016
This patch fixes the warning introduced by the changes in e38bade.
Ref: nodejs#6092
PR-URL: nodejs#6276
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
jasnell pushed a commit that referenced this pull request Apr 26, 2016
This commit safely allows event names that are named the same as
properties that are ordinarily inherited from Object.prototype such
as __proto__.
Fixes: #728
PR-URL: #6092
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
jasnell pushed a commit that referenced this pull request Apr 26, 2016
This patch fixes the warning introduced by the changes in e38bade.
Ref: #6092
PR-URL: #6276
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
@BridgeARBridgeAR mentioned this pull request Apr 1, 2019
2 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

eventsIssues and PRs related to the events subsystem / EventEmitter.semver-majorPRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@mscdex@thefourtheye@evanlucas@vkurchatkin@Fishrock123@jasnell@addaleax