From d8ef944437c4a8c91fe055eb0be01480b042b92a Mon Sep 17 00:00:00 2001 From: Kyle Farnung Date: Thu, 1 Jun 2017 11:58:12 -0700 Subject: [PATCH] chakrashim: fix undefined values in inspector When creating the wrapped objects we were copying the `undefined` properties which were then being translated to `null` during serialization. Fixes #280 PR-URL: https://github.com/nodejs/node-chakracore/pull/284 Reviewed-By: Hitesh Kanwathirtha --- deps/chakrashim/src/jsrtinspectorhelpers.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/deps/chakrashim/src/jsrtinspectorhelpers.cc b/deps/chakrashim/src/jsrtinspectorhelpers.cc index 1bf415f7880..e16832a0086 100644 --- a/deps/chakrashim/src/jsrtinspectorhelpers.cc +++ b/deps/chakrashim/src/jsrtinspectorhelpers.cc @@ -22,6 +22,7 @@ #include "v8chakra.h" #include "jsrtinspectorhelpers.h" +#include "jsrtutils.h" namespace jsrt { static const int JsrtDebugPropertyAttributeReadOnly = 4; @@ -59,6 +60,13 @@ namespace jsrt { JsValueRef sourceVal = nullptr; IfJsErrorRet(JsGetProperty(sourceObj, propId, &sourceVal)); + bool isUndefined; + IfJsErrorRet(jsrt::IsUndefined(sourceVal, &isUndefined)); + + if (isUndefined) { + return JsNoError; + } + JsValueRef destVal = nullptr; if (convertFunc != nullptr) { IfJsErrorRet(convertFunc(sourceVal, &destVal));