fix: allow get_proxied_value to return original value when error ()

* fix: allow get_proxied_value to return original value when error

closes 

* Update packages/svelte/src/internal/client/proxy.js

---------

Co-authored-by: Rich Harris <hello@rich-harris.dev>
pull/15580/head
Blade Barringer 2 weeks ago committed by GitHub
parent ef98ccae8b
commit d1bd32ec9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: prevent dev server from throwing errors when attempting to retrieve the proxied value of an iframe's contentWindow

@ -366,8 +366,18 @@ function update_version(signal, d = 1) {
* @param {any} value
*/
export function get_proxied_value(value) {
if (value !== null && typeof value === 'object' && STATE_SYMBOL in value) {
return value[STATE_SYMBOL];
try {
if (value !== null && typeof value === 'object' && STATE_SYMBOL in value) {
return value[STATE_SYMBOL];
}
} catch {
// the above if check can throw an error if the value in question
// is the contentWindow of an iframe on another domain, in which
// case we want to just return the value (because it's definitely
// not a proxied value) so we don't break any JavaScript interacting
// with that iframe (such as various payment companies client side
// JavaScript libraries interacting with their iframes on the same
// domain)
}
return value;

Loading…
Cancel
Save