From 148c4636852d934aa00975f30174cd799f3d05ea Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 3 Mar 2021 07:55:08 -0800 Subject: [PATCH 1/2] lib: runtime deprecate access to process.binding('async_wrap') Signed-off-by: James M Snell --- 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 8f1e2996416814..6d467486135afe 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 From dfcd37bec0c121e606be60ee3e381739ba92b2af Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 3 Mar 2021 08:01:10 -0800 Subject: [PATCH 2/2] fixup! lib: runtime deprecate access to process.binding('async_wrap') --- lib/internal/bootstrap/loaders.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index 6d467486135afe..dbf58a866bf876 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -123,7 +123,7 @@ const runtimeDeprecatedList = new SafeSet([ process.emitWarning( `Access to process.binding('${module}') is deprecated.`, 'DeprecationWarning', - 'DEP0111'); + 'DEP0111'); } return internalBinding(module); }