From d5a1b1ad7c4456e3c5747dadf8b12e981fe47e7c Mon Sep 17 00:00:00 2001 From: Trevor Norris Date: Sat, 26 Sep 2015 16:18:08 -0600 Subject: [PATCH] buffer: clean up usage of __proto__ Prefer using Object.setPrototypeOf() instead. PR-URL: https://github.com/nodejs/node/pull/3080 Reviewed-By: Ben Noordhuis --- lib/buffer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/buffer.js b/lib/buffer.js index fc4f2695f0b120..2da61f65051085 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -58,8 +58,8 @@ function Buffer(arg) { return fromObject(arg); } -Buffer.prototype.__proto__ = Uint8Array.prototype; -Buffer.__proto__ = Uint8Array; +Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype); +Object.setPrototypeOf(Buffer, Uint8Array); function SlowBuffer(length) { @@ -72,8 +72,8 @@ function SlowBuffer(length) { return ui8; } -SlowBuffer.prototype.__proto__ = Buffer.prototype; -SlowBuffer.__proto__ = Buffer; +Object.setPrototypeOf(SlowBuffer.prototype, Uint8Array.prototype); +Object.setPrototypeOf(SlowBuffer, Uint8Array); function allocate(size) {