diff options
author | Daeyeon Jeong <daeyeon.dev@gmail.com> | 2022-05-22 13:41:55 +0300 |
---|---|---|
committer | Bryan English <bryan@bryanenglish.com> | 2022-05-30 19:33:54 +0300 |
commit | 285ef308777e040ffab54566dbd4ebc545a32ac8 (patch) | |
tree | 98a8c901759408fcfba23f9c68b1caddbcd3eeac /lib | |
parent | 2b8b224077283906f70edf3d31178c77b9c4b22b (diff) |
console: fix console.dir crash on a revoked proxy
Fixes: https://github.com/nodejs/node/issues/43095
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
PR-URL: https://github.com/nodejs/node/pull/43100
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/util/inspect.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index d78a4e97d21..7285014e803 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -759,6 +759,9 @@ function formatValue(ctx, value, recurseTimes, typedArray) { // any proxy handlers. const proxy = getProxyDetails(value, !!ctx.showProxy); if (proxy !== undefined) { + if (proxy === null || proxy[0] === null) { + return ctx.stylize('<Revoked Proxy>', 'special'); + } if (ctx.showProxy) { return formatProxy(ctx, proxy, recurseTimes); } @@ -1967,6 +1970,9 @@ function hasBuiltInToString(value) { const getFullProxy = false; const proxyTarget = getProxyDetails(value, getFullProxy); if (proxyTarget !== undefined) { + if (proxyTarget === null) { + return true; + } value = proxyTarget; } |