-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
web: Throw an error when reference types are unsupported #18838
base: master
Are you sure you want to change the base?
web: Throw an error when reference types are unsupported #18838
Conversation
c5b9550
to
fec7b36
Compare
fec7b36
to
fede393
Compare
// We may theoretically need to check everything listed on https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/wasm32-unknown-unknown.md#enabled-webassembly-features | ||
// but this is the only extension I know completely breaks our WASM module if unsupported | ||
const necessaryExtensionsSupported: boolean = await referenceTypes(); | ||
if (!necessaryExtensionsSupported) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Right here, it would be possible by exporting isFlashEnabledBrowser
from the polyfills file and importing it here to add this code:
if ("url" in options && isFlashEnabledBrowser()) {
const flashEmbed = Object.assign(document.createElement('embed'), {
src: new URL(options.url, document.baseURI).href,
width: "100%",
height: "100%",
});
this.container.textContent = "";
this.container.appendChild(flashEmbed);
return;
}
That would create a Flash embed on Flash-enabled browsers which do not have reference-types support when using the Ruffle API with a URL (rather than a data buffer). It ignores any configuration options in favor of simplicity, though we can be less simple by doing this: https://github.com/ruffle-rs/ruffle/pull/16523/files#diff-467a580c71d4e3b96032b54a2a292d485f3b83f87ba2478daf693bac6d532965R1019-R1041
That said, it may not be desired as noted in #16523
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would create Flash embeds if reference-types is unsupported but Flash is supported. I mainly just wrote it for fun, as it was interesting to try to let DataLoadOptions work too.
This is somewhat the antithesis of #18528. That PR keeps Ruffle running on browsers without reference types support. This instead forces an error on those browsers.
Merging #18399 will break Ruffle on Safari versions below 15 and Pale Moon. We can keep Ruffle working on those browsers, or we can officially designate them to be unsupported.