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/https.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib/https.js') diff --git a/lib/https.js b/lib/https.js index 6d799d0c92..d8383a0305 100644 --- a/lib/https.js +++ b/lib/https.js @@ -21,7 +21,10 @@ 'use strict'; -const { Object } = primordials; +const { + ObjectAssign, + ObjectSetPrototypeOf, +} = primordials; require('internal/util').assertCrypto(); @@ -76,8 +79,8 @@ function Server(opts, requestListener) { this.maxHeadersCount = null; this.headersTimeout = 40 * 1000; // 40 seconds } -Object.setPrototypeOf(Server.prototype, tls.Server.prototype); -Object.setPrototypeOf(Server, tls.Server); +ObjectSetPrototypeOf(Server.prototype, tls.Server.prototype); +ObjectSetPrototypeOf(Server, tls.Server); Server.prototype.setTimeout = HttpServer.prototype.setTimeout; @@ -153,8 +156,8 @@ function Agent(options) { list: [] }; } -Object.setPrototypeOf(Agent.prototype, HttpAgent.prototype); -Object.setPrototypeOf(Agent, HttpAgent); +ObjectSetPrototypeOf(Agent.prototype, HttpAgent.prototype); +ObjectSetPrototypeOf(Agent, HttpAgent); Agent.prototype.createConnection = createConnection; Agent.prototype.getName = function getName(options) { @@ -296,7 +299,7 @@ function request(...args) { } if (args[0] && typeof args[0] !== 'function') { - Object.assign(options, args.shift()); + ObjectAssign(options, args.shift()); } options._defaultAgent = module.exports.globalAgent; -- cgit v1.2.3