detect broken wasm on kiwi browser (fixes #6490)

pull/6572/head
Niklas Fiekas 2020-05-07 17:53:59 +02:00
parent 42823b7370
commit b8b3ce4ea5
2 changed files with 5 additions and 1 deletions

View File

@ -16,6 +16,9 @@ function wasmInfo() {
if (info.WebAssembly !== 'object') return info;
info.validate = typeof WebAssembly.validate;
if (info.validate !== 'function') return info;
var source = Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00);
info.mvp = WebAssembly.validate(source);
if (!info.mvp) return info;

View File

@ -66,7 +66,8 @@ export default function(opts: CevalOpts): CevalCtrl {
// select wasmx with growable shared mem > wasmx > wasm > asmjs
let technology: CevalTechnology = 'asmjs';
let growableSharedMem = false;
if (typeof WebAssembly === 'object' && WebAssembly.validate(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00))) {
const source = Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00);
if (typeof WebAssembly === 'object' && typeof WebAssembly.validate === 'function' && WebAssembly.validate(source)) {
technology = 'wasm'; // WebAssembly 1.0
if (officialStockfish(opts.variant.key)) {
const sharedMem = sharedWasmMemory(8, 16);