mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
events: don't inherit from Object.prototype
This commit safely allows event names that are named the same as properties that are ordinarily inherited from Object.prototype such as __proto__. Fixes: https://github.com/nodejs/node/issues/728 PR-URL: https://github.com/nodejs/node/pull/6092 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
5 files changed
+52
-21
No files matched your search
+3
-1
@@ -3228,7 +3228,9 @@ void SetupProcessObject(Environment* env,
|
||||
env->SetMethod(process, "_setupDomainUse", SetupDomainUse);
|
||||
|
||||
// pre-set _events object for faster emit checks
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user