avm1: Allow SharedObject creation even if URL is unknown (fix #2150)
Allow SharedObjects to be created even in the case that the movie URL is None (for example, loading an SWF from bytes). Use a dummy "localhost" URL.
This commit is contained in:
parent
ff5ecf9754
commit
802aa9b7a7
|
@ -176,11 +176,16 @@ pub fn get_local<'gc>(
|
|||
return Ok(Value::Null);
|
||||
};
|
||||
|
||||
let mut movie_url = if let Some(url) = movie.url().and_then(|url| url::Url::parse(url).ok()) {
|
||||
let mut movie_url = if let Some(url) = movie.url() {
|
||||
if let Ok(url) = url::Url::parse(url) {
|
||||
url
|
||||
} else {
|
||||
log::error!("SharedObject::get_local: Unable to parse movie URL");
|
||||
return Ok(Value::Null);
|
||||
}
|
||||
} else {
|
||||
// No URL (loading local data). Use a dummy URL to allow SharedObjects to work.
|
||||
url::Url::parse("file://localhost").unwrap()
|
||||
};
|
||||
movie_url.set_query(None);
|
||||
movie_url.set_fragment(None);
|
||||
|
|
Loading…
Reference in New Issue