crypto: move process.binding('tls_wrap') internal
This commit makes the tls_wrap builtin an internal builtin, and changes usage of the builtin from using process.binding('tls_wrap') to use internalBinding instead. Refs: https://github.com/nodejs/node/issues/22160 PR-URL: https://github.com/nodejs/node/pull/22429 Refs: https://github.com/nodejs/node/issues/22160 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
656da16e1c
commit
eab916c4e8
@ -32,9 +32,9 @@ const common = require('_tls_common');
|
||||
const { StreamWrap } = require('_stream_wrap');
|
||||
const { Buffer } = require('buffer');
|
||||
const debug = util.debuglog('tls');
|
||||
const tls_wrap = process.binding('tls_wrap');
|
||||
const { internalBinding } = require('internal/bootstrap/loaders');
|
||||
const { TCP, constants: TCPConstants } = internalBinding('tcp_wrap');
|
||||
const tls_wrap = internalBinding('tls_wrap');
|
||||
const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap');
|
||||
const { owner_symbol } = require('internal/async_hooks').symbols;
|
||||
const { SecureContext: NativeSecureContext } = internalBinding('crypto');
|
||||
|
@ -353,7 +353,8 @@
|
||||
'signal_wrap',
|
||||
'crypto',
|
||||
'contextify',
|
||||
'tcp_wrap']);
|
||||
'tcp_wrap',
|
||||
'tls_wrap']);
|
||||
process.binding = function binding(name) {
|
||||
return internalBindingWhitelist.has(name) ?
|
||||
internalBinding(name) :
|
||||
|
@ -915,4 +915,4 @@ void TLSWrap::Initialize(Local<Object> target,
|
||||
|
||||
} // namespace node
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(tls_wrap, node::TLSWrap::Initialize)
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(tls_wrap, node::TLSWrap::Initialize)
|
||||
|
@ -1,3 +1,4 @@
|
||||
// Flags: --expose-internals
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
@ -5,7 +6,8 @@ if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const util = require('util');
|
||||
const TLSWrap = process.binding('tls_wrap').TLSWrap;
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const TLSWrap = internalBinding('tls_wrap').TLSWrap;
|
||||
|
||||
// This will abort if internal pointer is not set to nullptr.
|
||||
util.inspect(new TLSWrap());
|
||||
|
@ -266,7 +266,7 @@ if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check
|
||||
const credentials = require('tls').createSecureContext({ ca, cert, key });
|
||||
|
||||
// TLSWrap is exposed, but needs to be instantiated via tls_wrap.wrap().
|
||||
const tls_wrap = process.binding('tls_wrap');
|
||||
const tls_wrap = internalBinding('tls_wrap');
|
||||
testInitialized(
|
||||
tls_wrap.wrap(tcp._externalStream, credentials.context, true), 'TLSWrap');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user