Properly test for WebAssembly presence before use

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/900
This commit is contained in:
Raymond Hill 2020-02-21 15:21:25 -05:00
parent d2b65d0cef
commit 5da3aaaabf
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -679,6 +679,7 @@ const roundToPageSize = v => (v + PAGE_SIZE-1) & ~(PAGE_SIZE-1);
} }
async enableWASM() { async enableWASM() {
if ( typeof WebAssembly !== 'object' ) { return false; }
if ( this.wasmMemory instanceof WebAssembly.Memory ) { return true; } if ( this.wasmMemory instanceof WebAssembly.Memory ) { return true; }
const module = await getWasmModule(); const module = await getWasmModule();
if ( module instanceof WebAssembly.Module === false ) { if ( module instanceof WebAssembly.Module === false ) {