From 42ad2cdbe5baa32dd1b0aea143a4e45f81e8b9b5 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sun, 28 Aug 2016 09:02:18 -0700 Subject: import memory #684 --- src/js/wasm.js-post.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/js') diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js index 05c648ed0..dcffb1ee8 100644 --- a/src/js/wasm.js-post.js +++ b/src/js/wasm.js-post.js @@ -183,7 +183,7 @@ function integrateWasmJS(Module) { return false; } exports = instance.exports; - mergeMemory(exports.memory); + if (exports.memory) mergeMemory(exports.memory); Module["usingWasm"] = true; @@ -274,6 +274,11 @@ function integrateWasmJS(Module) { global = fixImports(global); env = fixImports(env); + // import memory + if (!env['memory']) { + env['memory'] = providedBuffer; + } + // try the methods. each should return the exports if it succeeded var exports; -- cgit v1.2.3