ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.47k stars 800 forks source link

new Loader().contentLoaderInfo.loaderURL returns file:// instead of whole path #14217

Open evilpie opened 9 months ago

evilpie commented 9 months ago

In Flash new Loader().contentLoaderInfo.loaderURL returns the whole path of the SWF, in Ruffle it's just file:///.

The value probably comes from either SwfMovie::empty or SwfMovie::empty_fake_compressed_len.

danielhjacobs commented 9 months ago

https://github.com/ruffle-rs/ruffle/blob/master/core/src/avm2/globals/flash/display/loader.rs#L41: Seems the comment here was not a good idea: "Some LoaderInfo properties (such as 'bytesLoaded' and 'bytesTotal') are always accessible, even before the 'init' event has fired. Using an empty movie gives us the correct value (0) for them."

evilpie commented 9 months ago

This happens for http://www.freeaddictinggames.com/loader/ima-vast-preroll.swf?v=2 from https://github.com/ruffle-rs/ruffle/issues/8619#issuecomment-1830429920.

danielhjacobs commented 9 months ago

https://github.com/ruffle-rs/ruffle/blob/master/core/src/avm2/globals/flash/display/loader.rs#L41

This was added by @Aaron1011 in #7636.

evilpie commented 9 months ago

See also #13965, because even with the fixed URL the RegExp still fails anyway.