fix: try catch `strict_equals` to avoid error accessing `STATE_SYMBOL` (#13216)

Can error if trying to access something while in a secure context, like iframe, sandboxes, etc. Fixes #13214
pull/13217/head
Paolo Ricciuti 4 months ago committed by GitHub
parent e9dc118eb7
commit 0b25e2be0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: try catch `strict_equals` to avoid error accessing `STATE_SYMBOL`

@ -78,9 +78,13 @@ export function init_array_prototype_warnings() {
* @returns {boolean}
*/
export function strict_equals(a, b, equal = true) {
// try-catch needed because this tries to read properties of `a` and `b`,
// which could be disallowed for example in a secure context
try {
if ((a === b) !== (get_proxied_value(a) === get_proxied_value(b))) {
w.state_proxy_equality_mismatch(equal ? '===' : '!==');
}
} catch {}
return (a === b) === equal;
}

Loading…
Cancel
Save