From ae5abc65e73c85add5523794e985114aa9a1af09 Mon Sep 17 00:00:00 2001 From: Vladimir Sadov Date: Wed, 1 Aug 2018 10:42:50 -0700 Subject: [PATCH] Fixing build of internal projects. --- lib/Runtime/Library/JavascriptProxy.cpp | 19 +++++++++++++++++++ lib/Runtime/Library/JavascriptProxy.h | 17 +---------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/lib/Runtime/Library/JavascriptProxy.cpp b/lib/Runtime/Library/JavascriptProxy.cpp index b61610672f9..9ce9792cd65 100644 --- a/lib/Runtime/Library/JavascriptProxy.cpp +++ b/lib/Runtime/Library/JavascriptProxy.cpp @@ -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(proxy->target); + if (nestedProxy == nullptr) + { + break; + } + + proxy = nestedProxy; + } + + return proxy; + } + BOOL JavascriptProxy::GetDiagTypeString(StringBuilder* stringBuilder, ScriptContext* requestContext) { const JavascriptProxy* proxy = UnwrapNestedProxies(this); diff --git a/lib/Runtime/Library/JavascriptProxy.h b/lib/Runtime/Library/JavascriptProxy.h index 0e8a903fa8a..b88d5b75010 100644 --- a/lib/Runtime/Library/JavascriptProxy.h +++ b/lib/Runtime/Library/JavascriptProxy.h @@ -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(proxy->target); - if (nestedProxy == nullptr) - { - break; - } - - proxy = nestedProxy; - } - - return proxy; - } + static const JavascriptProxy* UnwrapNestedProxies(const JavascriptProxy* proxy); #ifndef IsJsDiag RecyclableObject* GetTarget();