@@ -1837,7 +1837,7 @@ function includesProxiesOrGetters(expr, exprStr, evalFn, ctx, callback) {
|
1837 | 1837 | if (astProp.type === 'Literal') { |
1838 | 1838 | // We have something like `obj['foo'].x` where `x` is the literal |
1839 | 1839 | |
1840 | | -if (isProxy(obj[astProp.value])) { |
| 1840 | +if (safeIsProxyAccess(obj, astProp.value)) { |
1841 | 1841 | return cb(true); |
1842 | 1842 | } |
1843 | 1843 | |
@@ -1855,7 +1855,7 @@ function includesProxiesOrGetters(expr, exprStr, evalFn, ctx, callback) {
|
1855 | 1855 | ) { |
1856 | 1856 | // We have something like `obj.foo.x` where `foo` is the identifier |
1857 | 1857 | |
1858 | | -if (isProxy(obj[astProp.name])) { |
| 1858 | +if (safeIsProxyAccess(obj, astProp.name)) { |
1859 | 1859 | return cb(true); |
1860 | 1860 | } |
1861 | 1861 | |
@@ -1882,7 +1882,7 @@ function includesProxiesOrGetters(expr, exprStr, evalFn, ctx, callback) {
|
1882 | 1882 | } |
1883 | 1883 | |
1884 | 1884 | if (typeof evaledProp === 'string') { |
1885 | | -if (isProxy(obj[evaledProp])) { |
| 1885 | +if (safeIsProxyAccess(obj, evaledProp)) { |
1886 | 1886 | return cb(true); |
1887 | 1887 | } |
1888 | 1888 | |
@@ -1899,6 +1899,15 @@ function includesProxiesOrGetters(expr, exprStr, evalFn, ctx, callback) {
|
1899 | 1899 | ); |
1900 | 1900 | } |
1901 | 1901 | |
| 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 | + |
1902 | 1911 | return callback(false); |
1903 | 1912 | } |
1904 | 1913 | |
|