Fix --no-modules passing in WebAssembly.Module

This fixes a mistake in allowing a `WebAssembly.Module` to be passed to
the initialization function in `--no-modules` mode by ensuring that it
resolves to a map of an instance/module instead of just resolving to an
instance.
This commit is contained in:
Alex Crichton 2018-11-09 12:15:36 -08:00
parent 4c4f8f16bd
commit 37889d9fcd

View File

@ -509,7 +509,10 @@ impl<'a> Context<'a> {
let instantiation;
const imports = {{ './{module}': __exports }};
if (path_or_module instanceof WebAssembly.Module) {{
instantiation = WebAssembly.instantiate(path_or_module, imports);
instantiation = WebAssembly.instantiate(path_or_module, imports)
.then(instance => {{
return {{ instance, module: module_or_path }}
}});
}} else {{
const data = fetch(path_or_module);
if (typeof WebAssembly.instantiateStreaming === 'function') {{