From 1468c9ff7c25426653f0944891cbc109e198ef1c Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 3 Mar 2021 07:55:08 -0800 Subject: [PATCH] lib: runtime deprecate access to process.binding('async_wrap') MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/37576 Fixes: https://github.com/nodejs/node/issues/37575 Reviewed-By: Matteo Collina Reviewed-By: Anna Henningsen Reviewed-By: Benjamin Gruenbaum Reviewed-By: Juan José Arboleda Reviewed-By: Michaël Zasso --- lib/internal/bootstrap/loaders.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index 40b54fa9c63e5a..9d8a41fc33e5b2 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -105,6 +105,10 @@ const internalBindingAllowlist = new SafeSet([ 'zlib', ]); +const runtimeDeprecatedList = new SafeSet([ + 'async_wrap', +]); + // Set up process.binding() and process._linkedBinding(). { const bindingObj = ObjectCreate(null); @@ -114,6 +118,13 @@ const internalBindingAllowlist = new SafeSet([ // Deprecated specific process.binding() modules, but not all, allow // selective fallback to internalBinding for the deprecated ones. if (internalBindingAllowlist.has(module)) { + if (runtimeDeprecatedList.has(module)) { + runtimeDeprecatedList.delete(module); + process.emitWarning( + `Access to process.binding('${module}') is deprecated.`, + 'DeprecationWarning', + 'DEP0111'); + } return internalBinding(module); } // eslint-disable-next-line no-restricted-syntax