summaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-12-06 10:27:31 -0800
committerGitHub <noreply@github.com>2019-12-06 10:27:31 -0800
commit6f55457c3edbeed202f27647a2cf0482160af098 (patch)
treebe826c6dd946c17fd77d72be793be7220968068d /src/js
parent65c334d514347af34c16ba95fa416896654d6484 (diff)
downloadbinaryen-6f55457c3edbeed202f27647a2cf0482160af098.tar.gz
binaryen-6f55457c3edbeed202f27647a2cf0482160af098.tar.bz2
binaryen-6f55457c3edbeed202f27647a2cf0482160af098.zip
Avoid errors in binaryen.js assertions builds, and enable ASSERTIONS in debug builds. (#2507)
Diffstat (limited to 'src/js')
-rw-r--r--src/js/binaryen.js-post.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index d5943176e..3d732c1fc 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -2768,6 +2768,12 @@ Module['emitText'] = function(expr) {
};
// Parses a binary to a module
+
+// If building with Emscripten ASSERTIONS, there is a property added to
+// Module to guard against users mistakening using the removed readBinary()
+// API. We must defuse that carefully.
+Object.defineProperty(Module, 'readBinary', { writable: true });
+
Module['readBinary'] = function(data) {
var buffer = allocate(data, 'i8', ALLOC_NORMAL);
var ptr = Module['_BinaryenModuleRead'](buffer, data.length);