File tree Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -59,9 +59,16 @@ namespace Js
59
59
// the proxies could be deep nested and cause SO when processed recursively.
60
60
static const JavascriptProxy* UnwrapNestedProxies (const JavascriptProxy* proxy)
61
61
{
62
- while (proxy->handler != nullptr && JavascriptProxy::Is (proxy->target ))
62
+ // continue while we have a proxy that is not revoked
63
+ while (proxy->handler != nullptr )
63
64
{
64
- proxy = JavascriptProxy::FromVar (proxy->target );
65
+ JavascriptProxy* nestedProxy = JavascriptOperators::TryFromVar<JavascriptProxy>(proxy->target );
66
+ if (nestedProxy == nullptr )
67
+ {
68
+ break ;
69
+ }
70
+
71
+ proxy = nestedProxy;
65
72
}
66
73
67
74
return proxy;
Original file line number Diff line number Diff line change @@ -225,17 +225,17 @@ function test7() {
225
225
function test8 ( ) {
226
226
print ( "*** deeply nested proxy and typeof" ) ;
227
227
228
- var __v_8697 = Proxy . revocable ( [ ] , { } ) . proxy ;
229
- for ( var __v_8698 = 0 ; __v_8698 < 1e5 ; __v_8698 ++ ) {
230
- __v_8697 = new Proxy ( __v_8697 , { } ) ;
228
+ var nestedProxy = Proxy . revocable ( [ ] , { } ) . proxy ;
229
+ for ( let i = 0 ; i < 1e5 ; i ++ ) {
230
+ nestedProxy = new Proxy ( nestedProxy , { } ) ;
231
231
}
232
- var __v_8702 = new Proxy ( { } , {
233
- } ) ;
234
- ( function ( ) {
235
- if ( __v_8697 != null && typeof __v_8697 == "object" ) try {
232
+
233
+ ( function ( ) {
234
+ if ( nestedProxy != null && typeof nestedProxy == "object" )
235
+ {
236
236
console . log ( "pass" ) ;
237
- } catch ( e ) { }
238
- } ) ( ) ;
237
+ }
238
+ } ) ( ) ;
239
239
}
240
240
241
241
test1 ( ) ;
You can’t perform that action at this time.
0 commit comments