Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
inspector: fixing lambda call frames
Browse files Browse the repository at this point in the history
PR-URL: #230
Reviewed-By: Sandeep Agarwal <saagarwa@microsoft.com>
Reviewed-By: Hitesh Kanwathirtha <hiteshk@microsoft.com>

Call frames for a lambda function may not include a "this" object. In
those cases we were omitting the "this" member, but that causes a
validation failure and returns an empty call stack.
  • Loading branch information
kfarnung committed May 2, 2017
1 parent a043cb8 commit 97002d0
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions deps/chakrashim/src/jsrtinspectorhelpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -480,26 +480,31 @@ namespace jsrt {
"thisObject",
&hasProperty));

if (hasProperty)
{
JsValueRef thisObj = nullptr;

if (hasProperty) {
JsValueRef thisObject = nullptr;
CHAKRA_VERIFY_NOERROR(InspectorHelpers::GetProperty(stackProperties,
"thisObject",
&thisObject));

JsValueRef thisObj = nullptr;
WrapObject(thisObject, &thisObj);
CHAKRA_VERIFY_NOERROR(InspectorHelpers::SetProperty(wrappedObj,
"this",
thisObj));
} else {
// The protocol requires a "this" member, so create an undefined object
// to return.
CHAKRA_VERIFY_NOERROR(JsCreateObject(&thisObj));
CHAKRA_VERIFY_NOERROR(InspectorHelpers::SetStringProperty(
thisObj, "type", "undefined"));
}

CHAKRA_VERIFY_NOERROR(InspectorHelpers::SetProperty(wrappedObj,
"this",
thisObj));

CHAKRA_VERIFY_NOERROR(InspectorHelpers::HasProperty(stackProperties,
"returnValue",
&hasProperty));

if (hasProperty)
{
if (hasProperty) {
JsValueRef returnObj = nullptr;
CHAKRA_VERIFY_NOERROR(InspectorHelpers::GetProperty(stackProperties,
"returnValue",
Expand Down

0 comments on commit 97002d0

Please sign in to comment.