summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2019-08-30 14:20:48 -0700
committerAlon Zakai <azakai@google.com>2019-08-30 14:20:47 -0700
commitc134c574e9e755a85806d42481c1b6d490d0d445 (patch)
tree67f50fb8957d177b8d84e01ab7e3eb4b290b0213 /src
parenteace464174f1abefead072dc580244483e499af6 (diff)
downloadbinaryen-c134c574e9e755a85806d42481c1b6d490d0d445.tar.gz
binaryen-c134c574e9e755a85806d42481c1b6d490d0d445.tar.bz2
binaryen-c134c574e9e755a85806d42481c1b6d490d0d445.zip
Followup to workaround for minification of wasm2js mem init (#2318)
Emscripten's minifier mis-minifies a couple bits in the memory init function that's used with wasm2js when not using an external memory init file: https://github.com/emscripten-core/emscripten/issues/8886 Previous fix worked around the bug in one place but failed to account for another. Have now confirmed that it works with this change in place. Updated test cases to match.
Diffstat (limited to 'src')
-rw-r--r--src/wasm2js.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wasm2js.h b/src/wasm2js.h
index 54a06578f..1526dbb89 100644
--- a/src/wasm2js.h
+++ b/src/wasm2js.h
@@ -2231,14 +2231,14 @@ void Wasm2JSGlue::emitMemory(
function(mem) {
var _mem = new Uint8Array(mem);
return function(offset, s) {
- var bytes;
+ var bytes, i;
if (typeof Buffer === 'undefined') {
bytes = atob(s);
- for (var i = 0; i < bytes.length; i++)
+ for (i = 0; i < bytes.length; i++)
_mem[offset + i] = bytes.charCodeAt(i);
} else {
bytes = Buffer.from(s, 'base64');
- for (var i = 0; i < bytes.length; i++)
+ for (i = 0; i < bytes.length; i++)
_mem[offset + i] = bytes[i];
}
}