From a2262c11d750c922e6cdea1cac5ff80f603d67e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=91=9E=E4=B8=B0?= Date: Mon, 26 Sep 2022 22:55:58 +0800 Subject: fix(ext/console): fix error when logging a proxied Date (#16018) --- ext/console/02_console.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'ext/console') diff --git a/ext/console/02_console.js b/ext/console/02_console.js index 5b65774d9..efb7aeb50 100644 --- a/ext/console/02_console.js +++ b/ext/console/02_console.js @@ -701,7 +701,11 @@ return handleCircular(value, cyan); } - return inspectObject(value, inspectOptions, proxyDetails); + return inspectObject( + value, + inspectOptions, + proxyDetails, + ); default: // Not implemented is red return red("[Not Implemented]"); @@ -1283,11 +1287,7 @@ return [baseString, refIndex]; } - function inspectObject( - value, - inspectOptions, - proxyDetails, - ) { + function inspectObject(value, inspectOptions, proxyDetails) { if ( ReflectHas(value, customInspect) && typeof value[customInspect] === "function" @@ -1330,7 +1330,10 @@ } else if (ObjectPrototypeIsPrototypeOf(RegExpPrototype, value)) { return inspectRegExp(value, inspectOptions); } else if (ObjectPrototypeIsPrototypeOf(DatePrototype, value)) { - return inspectDate(value, inspectOptions); + return inspectDate( + proxyDetails ? proxyDetails[0] : value, + inspectOptions, + ); } else if (ObjectPrototypeIsPrototypeOf(SetPrototype, value)) { return inspectSet( proxyDetails ? proxyDetails[0] : value, -- cgit v1.2.3