summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMasashi Hirano <cherrydog07@gmail.com>2018-10-09 08:10:07 +0900
committerRich Trott <rtrott@gmail.com>2018-12-05 11:47:05 -0800
commit63b06551f4c51d8868f36b184a6539ebc51cf0b4 (patch)
treec1e172c5fbcf2e0f457653269e59a6821d160915 /lib
parent89740a4f0e15478403551ca86ac362d135319bd6 (diff)
downloadandroid-node-v8-63b06551f4c51d8868f36b184a6539ebc51cf0b4.tar.gz
android-node-v8-63b06551f4c51d8868f36b184a6539ebc51cf0b4.tar.bz2
android-node-v8-63b06551f4c51d8868f36b184a6539ebc51cf0b4.zip
src,lib: make process.binding('config') internal
PR-URL: https://github.com/nodejs/node/pull/23400 Refs: https://github.com/nodejs/node/issues/22160 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/buffer.js4
-rw-r--r--lib/crypto.js2
-rw-r--r--lib/internal/async_hooks.js2
-rw-r--r--lib/internal/bootstrap/loaders.js4
-rw-r--r--lib/internal/bootstrap/node.js4
-rw-r--r--lib/internal/encoding.js2
-rw-r--r--lib/internal/inspector_async_hook.js2
-rw-r--r--lib/internal/print_help.js2
-rw-r--r--lib/internal/process/warning.js2
-rw-r--r--lib/internal/readline.js2
-rw-r--r--lib/trace_events.js2
-rw-r--r--lib/url.js2
12 files changed, 16 insertions, 14 deletions
diff --git a/lib/buffer.js b/lib/buffer.js
index af69f43735..ac5e19c408 100644
--- a/lib/buffer.js
+++ b/lib/buffer.js
@@ -50,7 +50,7 @@ const {
} = require('internal/util/types');
const {
pendingDeprecation
-} = process.binding('config');
+} = internalBinding('config');
const {
ERR_BUFFER_OUT_OF_BOUNDS,
ERR_OUT_OF_RANGE,
@@ -1067,7 +1067,7 @@ Buffer.prototype.swap64 = function swap64() {
Buffer.prototype.toLocaleString = Buffer.prototype.toString;
let transcode;
-if (process.binding('config').hasIntl) {
+if (internalBinding('config').hasIntl) {
const {
icuErrName,
transcode: _transcode
diff --git a/lib/crypto.js b/lib/crypto.js
index a3865ab7e4..4707ab2b35 100644
--- a/lib/crypto.js
+++ b/lib/crypto.js
@@ -40,7 +40,7 @@ const pendingDeprecation = getOptionValue('--pending-deprecation');
const {
fipsMode,
fipsForced
-} = process.binding('config');
+} = internalBinding('config');
const { getFipsCrypto, setFipsCrypto } = internalBinding('crypto');
const {
randomBytes,
diff --git a/lib/internal/async_hooks.js b/lib/internal/async_hooks.js
index a42f603293..d382fe36e1 100644
--- a/lib/internal/async_hooks.js
+++ b/lib/internal/async_hooks.js
@@ -107,7 +107,7 @@ function fatalError(e) {
Error.captureStackTrace(o, fatalError);
process._rawDebug(o.stack);
}
- if (process.binding('config').shouldAbortOnUncaughtException) {
+ if (internalBinding('config').shouldAbortOnUncaughtException) {
process.abort();
}
process.exit(1);
diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js
index 155d9c9239..dfe904857f 100644
--- a/lib/internal/bootstrap/loaders.js
+++ b/lib/internal/bootstrap/loaders.js
@@ -73,6 +73,7 @@ ObjectDefineProperty(process, 'moduleLoadList', {
writable: false
});
+
// internalBindingWhitelist contains the name of internalBinding modules
// that are whitelisted for access via process.binding()... This is used
// to provide a transition path for modules that are being moved over to
@@ -81,6 +82,7 @@ const internalBindingWhitelist = [
'async_wrap',
'buffer',
'cares_wrap',
+ 'config',
'constants',
'contextify',
'crypto',
@@ -168,7 +170,7 @@ function NativeModule(id) {
NativeModule._source = getInternalBinding('natives');
NativeModule._cache = {};
-const config = getBinding('config');
+const config = getInternalBinding('config');
// Think of this as module.exports in this file even though it is not
// written in CommonJS style.
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
index 414cbec733..51e27afeca 100644
--- a/lib/internal/bootstrap/node.js
+++ b/lib/internal/bootstrap/node.js
@@ -176,7 +176,7 @@ function startup() {
{
// Install legacy getters on the `util` binding for typechecking.
// TODO(addaleax): Turn into a full runtime deprecation.
- const { pendingDeprecation } = process.binding('config');
+ const { pendingDeprecation } = internalBinding('config');
const utilBinding = internalBinding('util');
const types = internalBinding('types');
for (const name of [
@@ -638,7 +638,7 @@ function setupProcessFatal() {
}
function setupProcessICUVersions() {
- const icu = process.binding('config').hasIntl ?
+ const icu = internalBinding('config').hasIntl ?
internalBinding('icu') : undefined;
if (!icu) return; // no Intl/ICU: nothing to add here.
// With no argument, getVersion() returns a comma separated list
diff --git a/lib/internal/encoding.js b/lib/internal/encoding.js
index ce3cc7411a..ad056fd0bd 100644
--- a/lib/internal/encoding.js
+++ b/lib/internal/encoding.js
@@ -342,7 +342,7 @@ Object.defineProperties(
} });
const TextDecoder =
- process.binding('config').hasIntl ?
+ internalBinding('config').hasIntl ?
makeTextDecoderICU() :
makeTextDecoderJS();
diff --git a/lib/internal/inspector_async_hook.js b/lib/internal/inspector_async_hook.js
index 6a7489af97..1ad0cbf3a5 100644
--- a/lib/internal/inspector_async_hook.js
+++ b/lib/internal/inspector_async_hook.js
@@ -12,7 +12,7 @@ let config;
function lazyHookCreation() {
const { createHook } = require('async_hooks');
- config = process.binding('config');
+ config = internalBinding('config');
hook = createHook({
init(asyncId, type, triggerAsyncId, resource) {
diff --git a/lib/internal/print_help.js b/lib/internal/print_help.js
index 5d2c1daa07..c3e984dd9f 100644
--- a/lib/internal/print_help.js
+++ b/lib/internal/print_help.js
@@ -9,7 +9,7 @@ for (const key of Object.keys(types))
// Environment variables are parsed ad-hoc throughout the code base,
// so we gather the documentation here.
-const { hasIntl, hasSmallICU, hasNodeOptions } = process.binding('config');
+const { hasIntl, hasSmallICU, hasNodeOptions } = internalBinding('config');
const envVars = new Map([
['NODE_DEBUG', { helpText: "','-separated list of core modules that " +
'should print debug information' }],
diff --git a/lib/internal/process/warning.js b/lib/internal/process/warning.js
index 637b9ffb54..5dac78082b 100644
--- a/lib/internal/process/warning.js
+++ b/lib/internal/process/warning.js
@@ -1,6 +1,6 @@
'use strict';
-const config = process.binding('config');
+const config = internalBinding('config');
const prefix = `(${process.release.name}:${process.pid}) `;
const { ERR_INVALID_ARG_TYPE } = require('internal/errors').codes;
diff --git a/lib/internal/readline.js b/lib/internal/readline.js
index 0f7d969d20..c325f42cf4 100644
--- a/lib/internal/readline.js
+++ b/lib/internal/readline.js
@@ -30,7 +30,7 @@ CSI.kClearToEnd = CSI`0K`;
CSI.kClearLine = CSI`2K`;
CSI.kClearScreenDown = CSI`0J`;
-if (process.binding('config').hasIntl) {
+if (internalBinding('config').hasIntl) {
const icu = internalBinding('icu');
getStringWidth = function getStringWidth(str, options) {
options = options || {};
diff --git a/lib/trace_events.js b/lib/trace_events.js
index 878580c67f..d2977679e1 100644
--- a/lib/trace_events.js
+++ b/lib/trace_events.js
@@ -1,6 +1,6 @@
'use strict';
-const { hasTracing } = process.binding('config');
+const { hasTracing } = internalBinding('config');
const kHandle = Symbol('handle');
const kEnabled = Symbol('enabled');
const kCategories = Symbol('categories');
diff --git a/lib/url.js b/lib/url.js
index a5f8f45d01..eac9d1511b 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -21,7 +21,7 @@
'use strict';
-const { toASCII } = process.binding('config').hasIntl ?
+const { toASCII } = internalBinding('config').hasIntl ?
internalBinding('icu') : require('punycode');
const { hexTable } = require('internal/querystring');