From d1d9a5832ab0bfd345777052816d6acdfaa5d5f6 Mon Sep 17 00:00:00 2001 From: Tony Giorgio Date: Sat, 17 Jun 2023 21:26:17 -0500 Subject: [PATCH] Fix wasm check --- src/logic/browserCompatibility.ts | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/logic/browserCompatibility.ts b/src/logic/browserCompatibility.ts index dd1966d..fa1c55a 100644 --- a/src/logic/browserCompatibility.ts +++ b/src/logic/browserCompatibility.ts @@ -11,22 +11,7 @@ export async function checkBrowserCompatibility(): Promise { // 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."); }