From 0646eda4fc0affb98e13c30acb522e63b7fd6dde Mon Sep 17 00:00:00 2001 From: Michaƫl Zasso Date: Fri, 22 Nov 2019 18:04:46 +0100 Subject: lib: flatten access to primordials Store all primordials as properties of the primordials object. Static functions are prefixed by the constructor's name and prototype methods are prefixed by the constructor's name followed by "Prototype". For example: primordials.Object.keys becomes primordials.ObjectKeys. PR-URL: https://github.com/nodejs/node/pull/30610 Refs: https://github.com/nodejs/node/issues/29766 Reviewed-By: Anna Henningsen Reviewed-By: Matteo Collina Reviewed-By: Colin Ihrig Reviewed-By: Trivikram Kamat --- lib/_http_incoming.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/_http_incoming.js') diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js index 36d81153fe..bc04e8779f 100644 --- a/lib/_http_incoming.js +++ b/lib/_http_incoming.js @@ -21,7 +21,10 @@ 'use strict'; -const { Object } = primordials; +const { + ObjectDefineProperty, + ObjectSetPrototypeOf, +} = primordials; const Stream = require('stream'); @@ -80,10 +83,10 @@ function IncomingMessage(socket) { // read by the user, so there's no point continuing to handle it. this._dumped = false; } -Object.setPrototypeOf(IncomingMessage.prototype, Stream.Readable.prototype); -Object.setPrototypeOf(IncomingMessage, Stream.Readable); +ObjectSetPrototypeOf(IncomingMessage.prototype, Stream.Readable.prototype); +ObjectSetPrototypeOf(IncomingMessage, Stream.Readable); -Object.defineProperty(IncomingMessage.prototype, 'connection', { +ObjectDefineProperty(IncomingMessage.prototype, 'connection', { get: function() { return this.socket; }, -- cgit v1.2.3