From 3c187c627802d457b6af312d4ea0ab8dbee7788f Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 29 Aug 2018 08:20:31 -0400 Subject: [PATCH] fix https://github.com/uBlockOrigin/uBlock-issues/issues/141#issuecomment-416792939 --- src/lib/lz4/lz4-block-codec-wasm.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib/lz4/lz4-block-codec-wasm.js b/src/lib/lz4/lz4-block-codec-wasm.js index 52e3a0948..5a8e06944 100644 --- a/src/lib/lz4/lz4-block-codec-wasm.js +++ b/src/lib/lz4/lz4-block-codec-wasm.js @@ -123,16 +123,17 @@ context.LZ4BlockWASM.prototype = { flavor: 'wasm', init: function() { - if ( this.lz4wasmInstance instanceof WebAssembly.Instance ) { - return Promise.resolve(this.lz4wasmInstance); - } if ( - this.lz4wasmInstance === null || - WebAssembly instanceof Object === false || + typeof WebAssembly !== 'object' || typeof WebAssembly.instantiateStreaming !== 'function' ) { this.lz4wasmInstance = null; - return Promise.resolve(null); + } + if ( this.lz4wasmInstance === null ) { + return Promise.reject(); + } + if ( this.lz4wasmInstance instanceof WebAssembly.Instance ) { + return Promise.resolve(this.lz4wasmInstance); } if ( this.lz4wasmInstance === undefined ) { this.lz4wasmInstance = WebAssembly.instantiateStreaming(