Skip to content
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

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

Merged
merged 1 commit into from
Apr 19, 2016

Conversation

mscdex
Copy link
Contributor

@mscdex mscdex commented Apr 7, 2016

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

@mscdex mscdex 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
Copy link
Contributor Author

mscdex commented Apr 7, 2016

@mscdex
Copy link
Contributor Author

mscdex commented Apr 7, 2016

Also, there is no performance regression with this change 💃

@mscdex mscdex added this to the 6.0.0 milestone Apr 7, 2016
@thefourtheye
Copy link
Contributor

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

@mscdex
Copy link
Contributor Author

mscdex commented Apr 7, 2016

@thefourtheye The included tests should cover it I think

@evanlucas
Copy link
Contributor

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

@vkurchatkin
Copy link
Contributor

@evanlucas it makes sense to simply call EventEmitter on process

@mscdex
Copy link
Contributor Author

mscdex commented Apr 7, 2016

@evanlucas
Copy link
Contributor

LGTM

process->Set(env->events_string(), Object::New(env->isolate()));
Local<Object> events_obj = Object::New(env->isolate());
events_obj->SetPrototype(env->context(), Null(env->isolate()));
process->Set(env->events_string(), events_obj);
Copy link
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
Contributor Author

Choose a reason for hiding this comment

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

Yes.

@Fishrock123
Copy link
Contributor

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

@mscdex
Copy link
Contributor Author

mscdex commented Apr 7, 2016

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

@mscdex
Copy link
Contributor Author

mscdex commented Apr 7, 2016

@jasnell
Copy link
Member

jasnell commented Apr 7, 2016

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

@jasnell
Copy link
Member

jasnell commented Apr 7, 2016

LGTM

@mscdex
Copy link
Contributor Author

mscdex commented Apr 7, 2016

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

@mscdex
Copy link
Contributor Author

mscdex commented Apr 18, 2016

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

@jasnell
Copy link
Member

jasnell commented Apr 18, 2016

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 mscdex merged commit e38bade into nodejs:master Apr 19, 2016
@mscdex mscdex deleted the events-empty-prototype branch April 19, 2016 01:49
@Fishrock123
Copy link
Contributor

iirc usually we don't care about warnings

@jasnell
Copy link
Member

jasnell commented Apr 19, 2016

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

@Fishrock123
Copy link
Contributor

Fishrock123 commented Apr 19, 2016

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants