@@ -1837,7 +1837,7 @@ function includesProxiesOrGetters(expr, exprStr, evalFn, ctx, callback) {
18371837 if ( astProp . type === 'Literal' ) {
18381838 // We have something like `obj['foo'].x` where `x` is the literal
18391839
1840- if ( isProxy ( obj [ astProp . value ] ) ) {
1840+ if ( safeIsProxyAccess ( obj , astProp . value ) ) {
18411841 return cb ( true ) ;
18421842 }
18431843
@@ -1855,7 +1855,7 @@ function includesProxiesOrGetters(expr, exprStr, evalFn, ctx, callback) {
18551855 ) {
18561856 // We have something like `obj.foo.x` where `foo` is the identifier
18571857
1858- if ( isProxy ( obj [ astProp . name ] ) ) {
1858+ if ( safeIsProxyAccess ( obj , astProp . name ) ) {
18591859 return cb ( true ) ;
18601860 }
18611861
@@ -1882,7 +1882,7 @@ function includesProxiesOrGetters(expr, exprStr, evalFn, ctx, callback) {
18821882 }
18831883
18841884 if ( typeof evaledProp === 'string' ) {
1885- if ( isProxy ( obj [ evaledProp ] ) ) {
1885+ if ( safeIsProxyAccess ( obj , evaledProp ) ) {
18861886 return cb ( true ) ;
18871887 }
18881888
@@ -1899,6 +1899,15 @@ function includesProxiesOrGetters(expr, exprStr, evalFn, ctx, callback) {
18991899 ) ;
19001900 }
19011901
1902+ function safeIsProxyAccess ( obj , prop ) {
1903+ // Accessing `prop` may trigger a getter that throws, so we use try-catch to guard against it
1904+ try {
1905+ return isProxy ( obj [ prop ] ) ;
1906+ } catch {
1907+ return false ;
1908+ }
1909+ }
1910+
19021911 return callback ( false ) ;
19031912}
19041913
0 commit comments