Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avm1: Partially implement FileReference #7596

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

CUB3D
Copy link
Contributor

@CUB3D CUB3D commented Aug 8, 2022

This partially implements flash.net.FileReference (#307), based of @hatal175's initial work on implementing browse from around 2021.

Implements:

  • browse
    • The file picker is provided via the AsyncFileDialog crate on all platforms.
  • download
    • Does not support authentication, which is apparently supported in the Flash Player browser Plugin.
    • Does not report intermediate progress to listeners, a single onProgress callback is ran after the download has completed
  • upload
    • Does not support authentication.
    • Does not report intermediate progress.

Does not implement:

  • cancel
    • Neither downloads, nor uploads can be canceled whilst they are in progress

In addition to adding the above, the test harnesses have been updated to allow simulating successful / failed requests, via a new TestNavigatorBackend and dialog interactions can be simulated via the TestUiBackend allowing regression tests for the new functionality.

On web platforms, the ability to upload is dependent on cors configuration for the destination which may still prevent some content from working.

Whilst implementing this, care has been taken to match the ordering for the callbacks that Flash Player invokes in erroneous conditions, however there may still be some differences in some scenarios. To facilitate this, NavigatorBackend::fetch has been updated to return a FetchError containing error details.

Remaining:

  • Appease clippy
  • Clean up some todos
  • Testing harness changes
  • Download tests
  • Upload tests
  • Browse tests
  • dates should actually be Dates
  • Correct confusing callbacks
  • Update web UI backend
  • Test on other platforms
  • rebase
  • Support saving on web
  • Update to rfd 0.12.1 (see Fix file-handle-inner on wasm PolyMeilex/rfd#153)

@CUB3D CUB3D force-pushed the as2_filereference branch 2 times, most recently from 3aa44bd to 7857128 Compare August 10, 2022 01:08
@CUB3D CUB3D marked this pull request as ready for review August 10, 2022 02:15
core/src/backend/ui.rs Outdated Show resolved Hide resolved
desktop/src/ui.rs Outdated Show resolved Hide resolved
web/src/ui.rs Outdated Show resolved Hide resolved
core/src/avm1/globals.rs Outdated Show resolved Hide resolved
core/src/avm1/globals.rs Outdated Show resolved Hide resolved
core/src/avm1/globals/file_reference.rs Outdated Show resolved Hide resolved
core/src/avm1/globals/file_reference.rs Outdated Show resolved Hide resolved
@Herschel
Copy link
Member

Herschel commented Sep 7, 2022

Thanks for the patience here, this one's a little chunky but I'll take some time to review it this week

@CUB3D CUB3D force-pushed the as2_filereference branch 2 times, most recently from ea3bd5d to 9adbeb8 Compare January 5, 2023 12:36
@ousia
Copy link
Contributor

ousia commented Sep 13, 2023

Since save_file on WASM is now supported with PolyMeilex/rfd#134 and included in its latest release, it would be great to have download for other than desktop.

Many thanks for your help, @CUB3D.

@BarbourSmith
Copy link

Howdy y'all!

I have a flash project that I would like to revive and it works ALMOST perfectly in Ruffle...but it relies on the file dialog 😞 ...We're so close, but so far.

Would anyone be interested in reviving this pull request and seeing it across the finish line? I would be happy to spend some money to make it worth your time.

If it impacts your decision the flash project we are trying to revive is an open source project and it is going to be used by the community of another open source project .

The SWF file that we are hoping to run again is here:

partkam.swf.zip

It's browser based so downloading with WASM would be important.

Thanks for all the awesome work! Let me know if I can make it worth someone's while to get this PR wrapped up and merged in.

❤️ ❤️

core/src/loader.rs Outdated Show resolved Hide resolved
core/src/loader.rs Outdated Show resolved Hide resolved
core/src/loader.rs Outdated Show resolved Hide resolved
core/src/loader.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Dinnerbone Dinnerbone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one minor fixup

core/src/loader.rs Outdated Show resolved Hide resolved
@Lord-McSweeney
Copy link
Collaborator

context.avm_trace is used several times in loader.rs- should those be tracing::info! instead? Or is there a reason they're avm_trace?

@Dinnerbone Dinnerbone enabled auto-merge (rebase) November 3, 2023 17:13
@Dinnerbone Dinnerbone merged commit b0d8864 into ruffle-rs:master Nov 3, 2023
13 checks passed
@BarbourSmith
Copy link

Thank you so much for doing this! Is adding support for ActionScript3 on the road map at all? Is there anything that I could do to help get it on the road map?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants