electron: Flash SWF content not correctly loaded in Electron 7

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    • 7.0.0
  • Operating System:
    • Windows 10 (1803)
  • Last Known Working Electron version:
    • 6.1.2

Expected Behavior

Loading flash content through an swf file results in the correct visualization of said content

Actual Behavior

An error “GET http://interactive-mirror3.nfb.ca/FrameLoader.swf net::ERR_INVALID_ARGUMENT” appears:

Annotazione 2019-10-25 170420

To Reproduce

Try embedding this flash website in an electron project (http://bear71.nfb.ca/#/bear71) following this tutorial: https://electronjs.org/docs/tutorial/using-pepper-flash-plugin

Screenshots

Annotazione 2019-10-25 170420

Additional Information

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 14
  • Comments: 33 (8 by maintainers)

Commits related to this issue

Most upvoted comments

The problem has nothing to do with the sandboxing problem suggested in #20309. It is actually caused by a bad header 😃

Chromium added more complex CORS handling that required consumers (like Electron) to register list of ‘safe’ headers that are exempt from the CORS process. One such header is X-Requested-With which is injected by the Flash plugin.

Since that change is missing in Electron, the CORS handler is rejecting the request (because it has an unrecognized header) and you get the net::ERR_INVALID_ARGUMENT error.

The fix is to amend SystemNetworkContextManager::CreateDefaultNetworkContextParams() in electron\shell\browser\net\system_network_context_manager.cc to reflect the chrome\browser\net version by adding (with the corresponding includes):

  content::UpdateCorsExemptHeader(network_context_params.get());
  variations::UpdateCorsExemptHeaderForVariations(network_context_params.get());

For more info - check out the relevant Chromium ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=940331

Can this be prioritized for a fix?

We’re reverting to Electron 6 as our app still requires flash for some (old) functionality which we can’t yet deprecate.

I’ve managed to build this locally and can confirm the fix is working. If anyone needs to fix this manually before it gets released you can check out the pull request (https://github.com/electron/electron/pull/22072) for the required changes.

7.0.0-beta.3 and earlier will work with pretty much any flash version, including 32.0.0.303.

You’re right there was a mistake in my code.

If someone here is looking for the last version known to work with flash, it will be 6.1.2

Can this be prioritized for a fix?

We’re reverting to Electron 6 as our app still requires flash for some (old) functionality which we can’t yet deprecate.

Indeed

This does work in Electron 6.1.7 (32bit at least).

Why a tutorial on how to apply a fix rather than a fix being committed? I’d really rather not build a custom version of Electron to use in production code where we are dealing with taking people’s money

Updates?

Anyone here know which version of electron supports flash in MacOS ?