web: Add specific error message for disabled WASM on Microsoft Edge (#6423)

* web: Add specific error message for disabled WASM on Microsoft Edge

Related to #6395

* web: Update Microsoft Edge WASM error message conditional

Co-Authored-By: Daniel Jacobs <danielhunterjacobs@gmail.com>

* web: Update "More Information" link for Microsoft Edge WASM error

Co-authored-by: Daniel Jacobs <danielhunterjacobs@gmail.com>
This commit is contained in:
elliot 2022-03-09 15:12:21 -06:00 committed by GitHub
parent 697ad92db5
commit 355bd35935
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 0 deletions

View File

@ -38,6 +38,7 @@ const enum PanicError {
WasmDownload,
WasmMimeType,
WasmNotFound,
WasmDisabledMicrosoftEdge,
SwfFetchError,
}
@ -417,6 +418,12 @@ export class RufflePlayer extends HTMLElement {
e.ruffleIndexError = PanicError.WasmDownload;
} else if (e.name === "TypeError") {
e.ruffleIndexError = PanicError.JavascriptConflict;
} else if (
navigator.userAgent.includes("Edg") &&
message.includes("webassembly is not defined")
) {
// Microsoft Edge detection.
e.ruffleIndexError = PanicError.WasmDisabledMicrosoftEdge;
}
}
this.panic(e);
@ -1244,6 +1251,20 @@ export class RufflePlayer extends HTMLElement {
<li><a href="#" id="panic-view-details">View Error Details</a></li>
`;
break;
case PanicError.WasmDisabledMicrosoftEdge:
// Self hosted: User has disabled WebAssembly in Microsoft Edge through the
// "Enhance your Security on the web" setting.
errorBody = `
<p>Ruffle failed to load the required ".wasm" file component.</p>
<p>To fix this, try opening your browser's settings, clicking "Privacy, search, and services", scrolling down, and turning off "Enhance your security on the web".</p>
<p>This will allow your browser to load the required ".wasm" files.</p>
<p>If the issue persists, you might have to use a different browser.</p>
`;
errorFooter = `
<li><a target="_top" href="https://github.com/ruffle-rs/ruffle/wiki/Frequently-Asked-Questions-For-Users#edge-webassembly-error">More Information</a></li>
<li><a href="#" id="panic-view-details">View Error Details</a></li>
`;
break;
case PanicError.JavascriptConflict:
// Self hosted: Cannot load `.wasm` file - a native object / function is overriden
errorBody = `