diff --git a/src/postamble_minimal.js b/src/postamble_minimal.js index 40661ce31220b..8b4248b6cb054 100644 --- a/src/postamble_minimal.js +++ b/src/postamble_minimal.js @@ -111,10 +111,7 @@ var imports = { #if MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION // https://caniuse.com/#feat=wasm and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming -// Firefox 52 added Wasm support, but only Firefox 58 added instantiateStreaming. -// Chrome 57 added Wasm support, but only Chrome 61 added instantiateStreaming. -// Node.js and Safari do not support instantiateStreaming. -#if MIN_FIREFOX_VERSION < 58 || MIN_CHROME_VERSION < 61 || ENVIRONMENT_MAY_BE_NODE || MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED +#if MIN_FIREFOX_VERSION < 58 || MIN_CHROME_VERSION < 61 || MIN_NODE_VERSION < 180100 || MIN_SAFARI_VERSION < 150000 #if ASSERTIONS && !WASM2JS // Module['wasm'] should contain a typed array of the Wasm object data, or a // precompiled WebAssembly Module. @@ -154,12 +151,7 @@ WebAssembly.instantiate(Module['wasm'], imports).then((output) => { // Depending on the build mode, Module['wasm'] can mean a different thing. #if MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION || MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION || PTHREADS // https://caniuse.com/#feat=wasm and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming - // Firefox 52 added Wasm support, but only Firefox 58 added compileStreaming & - // instantiateStreaming. - // Chrome 57 added Wasm support, but only Chrome 61 added compileStreaming & - // instantiateStreaming. - // Node.js and Safari do not support compileStreaming or instantiateStreaming. -#if MIN_FIREFOX_VERSION < 58 || MIN_CHROME_VERSION < 61 || ENVIRONMENT_MAY_BE_NODE || MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED || PTHREADS +#if MIN_FIREFOX_VERSION < 58 || MIN_CHROME_VERSION < 61 || MIN_NODE_VERSION < 180100 || MIN_SAFARI_VERSION < 150000 || PTHREADS // In pthreads, Module['wasm'] is an already compiled WebAssembly.Module. In // that case, 'output' is a WebAssembly.Instance. // In main thread, Module['wasm'] is either a typed array or a fetch stream. diff --git a/tools/minimal_runtime_shell.py b/tools/minimal_runtime_shell.py index 1c1a29fe24ae5..712a4ff94295f 100644 --- a/tools/minimal_runtime_shell.py +++ b/tools/minimal_runtime_shell.py @@ -10,7 +10,6 @@ from . import building from . import shared from . import utils -from . import feature_matrix from .settings import settings logger = logging.getLogger('minimal_runtime_shell') @@ -29,11 +28,8 @@ def generate_minimal_runtime_load_statement(target_basename): # Expand {{{ DOWNLOAD_WASM }}} block from here (if we added #define support, this could be done in # the template directly) if settings.MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION: - if settings.MIN_SAFARI_VERSION != feature_matrix.UNSUPPORTED or settings.ENVIRONMENT_MAY_BE_NODE or settings.MIN_FIREFOX_VERSION < 58 or settings.MIN_CHROME_VERSION < 61: - # Firefox 52 added Wasm support, but only Firefox 58 added compileStreaming. - # Chrome 57 added Wasm support, but only Chrome 61 added compileStreaming. + if settings.MIN_SAFARI_VERSION < 150000 or settings.MIN_NODE_VERSION < 180100 or settings.MIN_FIREFOX_VERSION < 58 or settings.MIN_CHROME_VERSION < 61: # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/compileStreaming - # In Safari and Node.js, WebAssembly.compileStreaming() is not supported, in which case fall back to regular download. download_wasm = f"WebAssembly.compileStreaming ? WebAssembly.compileStreaming(fetch('{target_basename}.wasm')) : binary('{target_basename}.wasm')" else: # WebAssembly.compileStreaming() is unconditionally supported: @@ -41,7 +37,7 @@ def generate_minimal_runtime_load_statement(target_basename): elif settings.MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION: # Same compatibility story as above for # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming - if settings.MIN_SAFARI_VERSION != feature_matrix.UNSUPPORTED or settings.ENVIRONMENT_MAY_BE_NODE or settings.MIN_FIREFOX_VERSION < 58 or settings.MIN_CHROME_VERSION < 61: + if settings.MIN_SAFARI_VERSION < 150000 or settings.MIN_NODE_VERSION < 180100 or settings.MIN_FIREFOX_VERSION < 58 or settings.MIN_CHROME_VERSION < 61: download_wasm = f"!WebAssembly.instantiateStreaming && binary('{target_basename}.wasm')" else: # WebAssembly.instantiateStreaming() is unconditionally supported, so we do not download wasm