Skip to content

Commit

Permalink
[MERGE #5563 @VSadov] Fixing build of internal projects.
Browse files Browse the repository at this point in the history
Merge pull request #5563 from VSadov:hpp
  • Loading branch information
VSadov committed Aug 1, 2018
2 parents f270e03 + ae5abc6 commit e1e73e7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
19 changes: 19 additions & 0 deletions lib/Runtime/Library/JavascriptProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,25 @@ namespace Js
return JavascriptObject::ToStringHelper(target, scriptContext);
}

// before recursively calling something on 'target' use this helper in case there is nesting of proxies.
// the proxies could be deep nested and cause SO when processed recursively.
const JavascriptProxy* JavascriptProxy::UnwrapNestedProxies(const JavascriptProxy* proxy)
{
// continue while we have a proxy that is not revoked
while (proxy->handler != nullptr)
{
JavascriptProxy* nestedProxy = JavascriptOperators::TryFromVar<JavascriptProxy>(proxy->target);
if (nestedProxy == nullptr)
{
break;
}

proxy = nestedProxy;
}

return proxy;
}

BOOL JavascriptProxy::GetDiagTypeString(StringBuilder<ArenaAllocator>* stringBuilder, ScriptContext* requestContext)
{
const JavascriptProxy* proxy = UnwrapNestedProxies(this);
Expand Down
17 changes: 1 addition & 16 deletions lib/Runtime/Library/JavascriptProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,7 @@ namespace Js

// before recursively calling something on 'target' use this helper in case there is nesting of proxies.
// the proxies could be deep nested and cause SO when processed recursively.
static const JavascriptProxy* UnwrapNestedProxies(const JavascriptProxy* proxy)
{
// continue while we have a proxy that is not revoked
while (proxy->handler != nullptr)
{
JavascriptProxy* nestedProxy = JavascriptOperators::TryFromVar<JavascriptProxy>(proxy->target);
if (nestedProxy == nullptr)
{
break;
}

proxy = nestedProxy;
}

return proxy;
}
static const JavascriptProxy* UnwrapNestedProxies(const JavascriptProxy* proxy);

#ifndef IsJsDiag
RecyclableObject* GetTarget();
Expand Down

0 comments on commit e1e73e7

Please sign in to comment.