Skip to content

Commit 370f815

Browse files
committed
web: Check error message on browsers without reference types support
1 parent fede393 commit 370f815

File tree

2 files changed

+13
-24
lines changed

2 files changed

+13
-24
lines changed

web/packages/core/src/internal/player/inner.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { showPanicScreen } from "../ui/panic";
2626
import { createRuffleBuilder } from "../../load-ruffle";
2727
import { lookupElement } from "../register-element";
2828
import { configureBuilder } from "../builder";
29-
import { referenceTypes } from "wasm-feature-detect";
3029

3130
const DIMENSION_REGEX = /^\s*(\d+(\.\d+)?(%)?)/;
3231

@@ -856,16 +855,6 @@ export class InnerPlayer {
856855
this.loadedConfig.backgroundColor;
857856
}
858857

859-
// 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
860-
// but this is the only extension I know completely breaks our WASM module if unsupported
861-
const necessaryExtensionsSupported: boolean = await referenceTypes();
862-
if (!necessaryExtensionsSupported) {
863-
const baseError = new Error("Necessary WebAssembly extensions unsupported");
864-
const loadError = new LoadRuffleWasmError(baseError);
865-
this.panic(loadError);
866-
return;
867-
}
868-
869858
await this.ensureFreshInstance();
870859

871860
if ("url" in options) {

web/packages/core/src/internal/ui/panic.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,19 @@ function createPanicError(error: Error | null): {
246246
};
247247
}
248248

249+
if (error.cause.name === "CompileError" && message.includes("bad type")) {
250+
// Self hosted: User has a browser without support for necessary WebAssembly extensions
251+
return {
252+
body: textAsParagraphs("error-wasm-unsupported-browser"),
253+
actions: [
254+
CommonActions.openWiki(
255+
"#web",
256+
),
257+
CommonActions.ShowDetails,
258+
],
259+
};
260+
}
261+
249262
if (error.cause.name === "CompileError") {
250263
// Self hosted: Cannot load `.wasm` file - incorrect configuration or missing files
251264
return {
@@ -308,19 +321,6 @@ function createPanicError(error: Error | null): {
308321
};
309322
}
310323

311-
if (message === "necessary webassembly extensions unsupported") {
312-
// Self hosted: User has a browser without support for necessary WebAssembly extensions
313-
return {
314-
body: textAsParagraphs("error-wasm-unsupported-browser"),
315-
actions: [
316-
CommonActions.openWiki(
317-
"#web",
318-
),
319-
CommonActions.ShowDetails,
320-
],
321-
};
322-
}
323-
324324
// Self hosted: Cannot load `.wasm` file - file not found
325325
return {
326326
body: textAsParagraphs("error-wasm-not-found"),

0 commit comments

Comments
 (0)