summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/internal/async_hooks.js3
-rw-r--r--lib/internal/bootstrap/node.js3
-rw-r--r--lib/internal/crypto/pbkdf2.js4
-rw-r--r--lib/internal/crypto/random.js4
-rw-r--r--lib/internal/crypto/scrypt.js4
-rw-r--r--lib/internal/trace_events_async_hooks.js2
-rw-r--r--src/async_wrap.cc2
-rw-r--r--test/common/index.js3
-rw-r--r--test/parallel/test-async-wrap-destroyid.js4
-rw-r--r--test/pseudo-tty/test-async-wrap-getasyncid-tty.js4
-rw-r--r--test/sequential/test-async-wrap-getasyncid.js2
-rw-r--r--test/sequential/test-inspector-async-call-stack.js4
12 files changed, 24 insertions, 15 deletions
diff --git a/lib/internal/async_hooks.js b/lib/internal/async_hooks.js
index 9edb23f8a6..fd48e2b25b 100644
--- a/lib/internal/async_hooks.js
+++ b/lib/internal/async_hooks.js
@@ -4,7 +4,8 @@ const {
ERR_ASYNC_TYPE,
ERR_INVALID_ASYNC_ID
} = require('internal/errors').codes;
-const async_wrap = process.binding('async_wrap');
+const { internalBinding } = require('internal/bootstrap/loaders');
+const async_wrap = internalBinding('async_wrap');
/* async_hook_fields is a Uint32Array wrapping the uint32_t array of
* Environment::AsyncHooks::fields_[]. Each index tracks the number of active
* hooks for each type.
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
index c98ea20798..49dedc5fe2 100644
--- a/lib/internal/bootstrap/node.js
+++ b/lib/internal/bootstrap/node.js
@@ -356,7 +356,8 @@
'crypto',
'contextify',
'tcp_wrap',
- 'tls_wrap']);
+ 'tls_wrap',
+ 'async_wrap']);
process.binding = function binding(name) {
return internalBindingWhitelist.has(name) ?
internalBinding(name) :
diff --git a/lib/internal/crypto/pbkdf2.js b/lib/internal/crypto/pbkdf2.js
index 24498c73a6..e021f12db5 100644
--- a/lib/internal/crypto/pbkdf2.js
+++ b/lib/internal/crypto/pbkdf2.js
@@ -1,8 +1,8 @@
'use strict';
-const { AsyncWrap, Providers } = process.binding('async_wrap');
-const { Buffer } = require('buffer');
const { internalBinding } = require('internal/bootstrap/loaders');
+const { AsyncWrap, Providers } = internalBinding('async_wrap');
+const { Buffer } = require('buffer');
const { INT_MAX, pbkdf2: _pbkdf2 } = internalBinding('crypto');
const { validateInt32 } = require('internal/validators');
const {
diff --git a/lib/internal/crypto/random.js b/lib/internal/crypto/random.js
index 2d462bd756..3393da92d2 100644
--- a/lib/internal/crypto/random.js
+++ b/lib/internal/crypto/random.js
@@ -1,8 +1,8 @@
'use strict';
-const { AsyncWrap, Providers } = process.binding('async_wrap');
-const { Buffer, kMaxLength } = require('buffer');
const { internalBinding } = require('internal/bootstrap/loaders');
+const { AsyncWrap, Providers } = internalBinding('async_wrap');
+const { Buffer, kMaxLength } = require('buffer');
const { randomBytes: _randomBytes } = internalBinding('crypto');
const {
ERR_INVALID_ARG_TYPE,
diff --git a/lib/internal/crypto/scrypt.js b/lib/internal/crypto/scrypt.js
index f68a77aa86..a598a7cfb8 100644
--- a/lib/internal/crypto/scrypt.js
+++ b/lib/internal/crypto/scrypt.js
@@ -1,8 +1,8 @@
'use strict';
-const { AsyncWrap, Providers } = process.binding('async_wrap');
-const { Buffer } = require('buffer');
const { internalBinding } = require('internal/bootstrap/loaders');
+const { AsyncWrap, Providers } = internalBinding('async_wrap');
+const { Buffer } = require('buffer');
const { INT_MAX, scrypt: _scrypt } = internalBinding('crypto');
const { validateInt32 } = require('internal/validators');
const {
diff --git a/lib/internal/trace_events_async_hooks.js b/lib/internal/trace_events_async_hooks.js
index a983cb2fa2..6eb52f5949 100644
--- a/lib/internal/trace_events_async_hooks.js
+++ b/lib/internal/trace_events_async_hooks.js
@@ -2,7 +2,7 @@
const { internalBinding } = require('internal/bootstrap/loaders');
const { trace } = internalBinding('trace_events');
-const async_wrap = process.binding('async_wrap');
+const async_wrap = internalBinding('async_wrap');
const async_hooks = require('async_hooks');
const { SafeMap, SafeSet } = require('internal/safe_globals');
diff --git a/src/async_wrap.cc b/src/async_wrap.cc
index 51072bb8c9..acc61ea4b4 100644
--- a/src/async_wrap.cc
+++ b/src/async_wrap.cc
@@ -765,4 +765,4 @@ Local<Object> AsyncWrap::GetOwner(Environment* env, Local<Object> obj) {
} // namespace node
-NODE_BUILTIN_MODULE_CONTEXT_AWARE(async_wrap, node::AsyncWrap::Initialize)
+NODE_MODULE_CONTEXT_AWARE_INTERNAL(async_wrap, node::AsyncWrap::Initialize)
diff --git a/test/common/index.js b/test/common/index.js
index ad2a82f3ac..c6137b20ad 100644
--- a/test/common/index.js
+++ b/test/common/index.js
@@ -79,7 +79,8 @@ if (process.env.NODE_TEST_WITH_ASYNC_HOOKS) {
const destroydIdsList = {};
const destroyListList = {};
const initHandles = {};
- const async_wrap = process.binding('async_wrap');
+ const { internalBinding } = require('internal/test/binding');
+ const async_wrap = internalBinding('async_wrap');
process.on('exit', () => {
// iterate through handles to make sure nothing crashes
diff --git a/test/parallel/test-async-wrap-destroyid.js b/test/parallel/test-async-wrap-destroyid.js
index 56cc74871b..25a33246e7 100644
--- a/test/parallel/test-async-wrap-destroyid.js
+++ b/test/parallel/test-async-wrap-destroyid.js
@@ -1,7 +1,9 @@
+// Flags: --expose-internals
'use strict';
const common = require('../common');
-const async_wrap = process.binding('async_wrap');
+const { internalBinding } = require('internal/test/binding');
+const async_wrap = internalBinding('async_wrap');
const assert = require('assert');
const async_hooks = require('async_hooks');
const RUNS = 5;
diff --git a/test/pseudo-tty/test-async-wrap-getasyncid-tty.js b/test/pseudo-tty/test-async-wrap-getasyncid-tty.js
index d931a7fdb0..030ae9fdff 100644
--- a/test/pseudo-tty/test-async-wrap-getasyncid-tty.js
+++ b/test/pseudo-tty/test-async-wrap-getasyncid-tty.js
@@ -1,3 +1,4 @@
+// Flags: --expose-internals --no-warnings
'use strict';
// see also test/sequential/test-async-wrap-getasyncid.js
@@ -5,7 +6,8 @@
const common = require('../common');
const assert = require('assert');
const tty_wrap = process.binding('tty_wrap');
-const { TTYWRAP } = process.binding('async_wrap').Providers;
+const { internalBinding } = require('internal/test/binding');
+const { TTYWRAP } = internalBinding('async_wrap').Providers;
const providers = { TTYWRAP };
// Make sure that the TTYWRAP Provider is tested.
diff --git a/test/sequential/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js
index c4a4b9b058..18a6ed839e 100644
--- a/test/sequential/test-async-wrap-getasyncid.js
+++ b/test/sequential/test-async-wrap-getasyncid.js
@@ -7,7 +7,7 @@ const assert = require('assert');
const fs = require('fs');
const fsPromises = fs.promises;
const net = require('net');
-const providers = Object.assign({}, process.binding('async_wrap').Providers);
+const providers = Object.assign({}, internalBinding('async_wrap').Providers);
const fixtures = require('../common/fixtures');
const tmpdir = require('../common/tmpdir');
const { getSystemErrorName } = require('util');
diff --git a/test/sequential/test-inspector-async-call-stack.js b/test/sequential/test-inspector-async-call-stack.js
index 681697b8c4..f6a48b339d 100644
--- a/test/sequential/test-inspector-async-call-stack.js
+++ b/test/sequential/test-inspector-async-call-stack.js
@@ -1,10 +1,12 @@
+// Flags: --expose-internals
'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
common.skipIf32Bits();
const assert = require('assert');
-const async_wrap = process.binding('async_wrap');
+const { internalBinding } = require('internal/test/binding');
+const async_wrap = internalBinding('async_wrap');
const { kTotals } = async_wrap.constants;
const inspector = require('inspector');