From 112cc7c27551254aa2b17098fb774867f05ed0d9 Mon Sep 17 00:00:00 2001 From: Michaƫl Zasso Date: Fri, 5 Apr 2019 11:11:26 +0200 Subject: lib: use safe methods from primordials This changes the primordials to expose built-in prototypes with their methods already uncurried. The uncurryThis function is therefore moved to the primordials. All uses of uncurryThis on built-ins are changed to import the relevant prototypes from primordials. All uses of Function.call.bind are also changed to use primordials. PR-URL: https://github.com/nodejs/node/pull/27096 Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Joyee Cheung --- lib/_http_outgoing.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/_http_outgoing.js') diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 34b064a6a3..2c2346d211 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -21,6 +21,8 @@ 'use strict'; +const { ObjectPrototype } = primordials; + const assert = require('internal/assert'); const Stream = require('stream'); const internalUtil = require('internal/util'); @@ -53,8 +55,6 @@ const { CRLF, debug } = common; const kIsCorked = Symbol('isCorked'); -const hasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty); - const RE_CONN_CLOSE = /(?:^|\W)close(?:$|\W)/i; const RE_TE_CHUNKED = common.chunkExpression; @@ -310,7 +310,7 @@ function _storeHeader(firstLine, headers) { } } else { for (const key in headers) { - if (hasOwnProperty(headers, key)) { + if (ObjectPrototype.hasOwnProperty(headers, key)) { processHeader(this, state, key, headers[key], true); } } -- cgit v1.2.3