Fix wasm check

This commit is contained in:
Tony Giorgio
2023-06-17 21:26:17 -05:00
committed by Paul Miller
parent 81d45874fd
commit d1d9a5832a

View File

@@ -11,22 +11,7 @@ export async function checkBrowserCompatibility(): Promise<boolean> {
// Check if the browser supports WebAssembly
console.debug("Checking WebAssembly");
try {
if (
typeof WebAssembly === "object" &&
typeof WebAssembly.instantiate === "function"
) {
const module = new WebAssembly.Module(
Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00)
);
if (module instanceof WebAssembly.Module) {
// continue
} else {
throw new Error("WebAssembly is not supported.");
}
}
} catch (e) {
console.error(e);
if (typeof WebAssembly !== 'object' || !WebAssembly.validate(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00))) {
throw new Error("WebAssembly is not supported.");
}