src: clean up usage of __proto__
authorJackson Tian <shyvo1987@gmail.com>
Thu, 4 Feb 2016 02:53:17 +0000 (10:53 +0800)
committerMyles Borins <mborins@us.ibm.com>
Wed, 2 Mar 2016 22:01:11 +0000 (14:01 -0800)
Prefer using Object.setPrototypeOf() instead.

PR-URL: https://github.com/nodejs/node/pull/5069
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
src/node.js

index 41e8fb1..1e90cbd 100644 (file)
   function startup() {
     var EventEmitter = NativeModule.require('events');
 
-    process.__proto__ = Object.create(EventEmitter.prototype, {
+    Object.setPrototypeOf(process, Object.create(EventEmitter.prototype, {
       constructor: {
         value: process.constructor
       }
-    });
+    }));
+
     EventEmitter.call(process);
 
     process.EventEmitter = EventEmitter; // process.EventEmitter is deprecated