Skip to content

Commit

Permalink
web: Add a specific error message for Safari <15 (no bulk-memory supp…
Browse files Browse the repository at this point in the history
…ort)
  • Loading branch information
torokati44 committed Nov 14, 2021
1 parent 085405b commit e9f7363
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions web/packages/core/src/ruffle-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const enum PanicError {
Unknown,
CSPConflict,
FileProtocol,
NoWasmBulkMemory,
InvalidWasm,
JavascriptConfiguration,
JavascriptConflict,
Expand Down Expand Up @@ -398,6 +399,13 @@ export class RufflePlayer extends HTMLElement {
e.ruffleIndexError = PanicError.WasmCors;
} else if (message.includes("disallowed by embedder")) {
e.ruffleIndexError = PanicError.CSPConflict;
} else if (
message.includes("doesn't parse") &&
message.includes("references are not enabled")
) {
// The "reference-types" extension is now based on the "bulk-memory" one,
// hence the misleading error message from Safari.
e.ruffleIndexError = PanicError.NoWasmBulkMemory;
} else if (e.name === "CompileError") {
e.ruffleIndexError = PanicError.InvalidWasm;
} else if (
Expand Down Expand Up @@ -1155,6 +1163,18 @@ export class RufflePlayer extends HTMLElement {
<li><a href="#" id="panic-view-details">View Error Details</a></li>
`;
break;
case PanicError.NoWasmBulkMemory:
// The browser does not support WebAssembly bulk memory, most likely Safari <15
errorBody = `
<p>It seems like your browser has no support for the "Bulk Memory Operations" WebAssembly extension.</p>
<p>This is required for Ruffle to work efficiently, so please update your browser.</p>
<p>See the Ruffle wiki for the list of supported browsers and their minimum versions.</p>
`;
errorFooter = `
<li><a target="_top" href="https://github.com/ruffle-rs/ruffle/wiki#web">View Ruffle Wiki</a></li>
<li><a href="#" id="panic-view-details">View Error Details</a></li>
`;
break;
case PanicError.InvalidWasm:
// Self hosted: Cannot load `.wasm` file - incorrect configuration or missing files
errorBody = `
Expand Down
2 changes: 1 addition & 1 deletion web/packages/extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It automatically negotiates with websites that do have Ruffle installed, to ensu

## Using ruffle-extension

The browser extension works in Chrome, Firefox, and Safari 14+.
The browser extension works in Chrome, Firefox, and Safari 15+.

Before you can install the extension, you must either download the [latest release](https://github.com/ruffle-rs/ruffle/releases) or [build it yourself](../../README.md).

Expand Down

0 comments on commit e9f7363

Please sign in to comment.