Skip to content

Commit 82895b3

Browse files
committed
src,lib: move natives and constants to internalBinding()
Refs: #22160
1 parent 35ed66c commit 82895b3

21 files changed

+32
-30
lines changed

lib/_tls_common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const {
2929
ERR_INVALID_ARG_TYPE
3030
} = require('internal/errors').codes;
3131

32-
const { SSL_OP_CIPHER_SERVER_PREFERENCE } = process.binding('constants').crypto;
32+
const { SSL_OP_CIPHER_SERVER_PREFERENCE } = internalBinding('constants').crypto;
3333

3434
// Lazily loaded from internal/crypto/util.
3535
let toBuf = null;

lib/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// towards using the specific constants exposed by the individual modules on
2626
// which they are most relevant.
2727
// Deprecation Code: DEP0008
28-
const constants = process.binding('constants');
28+
const constants = internalBinding('constants');
2929
Object.assign(exports,
3030
constants.os.dlopen,
3131
constants.os.errno,

lib/crypto.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const {
3434
ERR_CRYPTO_FIPS_FORCED,
3535
ERR_CRYPTO_FIPS_UNAVAILABLE
3636
} = require('internal/errors').codes;
37-
const constants = process.binding('constants').crypto;
37+
const constants = internalBinding('constants').crypto;
3838
const { getOptions } = internalBinding('options');
3939
const pendingDeprecation = getOptions('--pending-deprecation');
4040
const {

lib/dgram.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const {
5252
defaultTriggerAsyncIdScope,
5353
symbols: { async_id_symbol, owner_symbol }
5454
} = require('internal/async_hooks');
55-
const { UV_UDP_REUSEADDR } = process.binding('constants').os;
55+
const { UV_UDP_REUSEADDR } = internalBinding('constants').os;
5656

5757
const { UDP, SendWrap } = internalBinding('udp_wrap');
5858

lib/fs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
'use strict';
2626

27-
const { fs: constants } = process.binding('constants');
27+
const { fs: constants } = internalBinding('constants');
2828
const {
2929
S_IFIFO,
3030
S_IFLNK,

lib/internal/bootstrap/loaders.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
this.script = null; // The ContextifyScript of the module
124124
}
125125

126-
NativeModule._source = getBinding('natives');
126+
NativeModule._source = getInternalBinding('natives');
127127
NativeModule._cache = {};
128128

129129
const config = getBinding('config');
@@ -256,12 +256,12 @@
256256
// 1. `internalBinding('code_cache_hash')` must be in sync with
257257
// `internalBinding('code_cache')` (same C++ file)
258258
// 2. `internalBinding('natives_hash')` must be in sync with
259-
// `process.binding('natives')` (same C++ file)
259+
// `internalBinding('natives')` (same C++ file)
260260
// 3. If `internalBinding('natives_hash')` is in sync with
261261
// `internalBinding('natives_hash')`, then the (unwrapped)
262262
// code used to generate `internalBinding('code_cache')`
263263
// should be in sync with the (unwrapped) code in
264-
// `process.binding('natives')`
264+
// `internalBinding('natives')`
265265
// There will be, however, false positives if the wrapper used
266266
// to generate the cache is different from the one used at run time,
267267
// and the length of the wrapper somehow stays the same.

lib/internal/bootstrap/node.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,9 @@
414414
'spawn_sync',
415415
'js_stream',
416416
'zlib',
417-
'buffer']);
417+
'buffer',
418+
'natives',
419+
'constants']);
418420
process.binding = function binding(name) {
419421
return internalBindingWhitelist.has(name) ?
420422
internalBinding(name) :

lib/internal/crypto/cipher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const {
44
RSA_PKCS1_OAEP_PADDING,
55
RSA_PKCS1_PADDING
6-
} = process.binding('constants').crypto;
6+
} = internalBinding('constants').crypto;
77

88
const {
99
ERR_CRYPTO_INVALID_STATE,

lib/internal/crypto/diffiehellman.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const {
2424
POINT_CONVERSION_COMPRESSED,
2525
POINT_CONVERSION_HYBRID,
2626
POINT_CONVERSION_UNCOMPRESSED
27-
} = process.binding('constants').crypto;
27+
} = internalBinding('constants').crypto;
2828

2929
const DH_GENERATOR = 2;
3030

lib/internal/crypto/sig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const { Sign: _Sign, Verify: _Verify } = internalBinding('crypto');
99
const {
1010
RSA_PSS_SALTLEN_AUTO,
1111
RSA_PKCS1_PADDING
12-
} = process.binding('constants').crypto;
12+
} = internalBinding('constants').crypto;
1313
const {
1414
getDefaultEncoding,
1515
kHandle,

0 commit comments

Comments
 (0)