summaryrefslogtreecommitdiff
path: root/src/js/wasm.js-post.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/wasm.js-post.js')
-rw-r--r--src/js/wasm.js-post.js20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js
index e81a4f7b8..e3ab2bb4f 100644
--- a/src/js/wasm.js-post.js
+++ b/src/js/wasm.js-post.js
@@ -140,11 +140,19 @@ function integrateWasmJS(Module) {
function doJustAsm() {
eval(Module['read'](asmjsCodeFile));
- return typeof Module['asm'] === 'function'; // evalling the asm.js file should set this
+ if (typeof Module['asm'] !== 'function') {
+ // evalling the asm.js file should have set this
+ Module['printErr']('asm evalling did not set the module properly');
+ return false;
+ }
+ return true;
}
function doNativeWasm() {
- if (typeof Wasm !== 'object') return false;
+ if (typeof Wasm !== 'object') {
+ Module['printErr']('no native wasm support detected');
+ return false;
+ }
// Provide an "asm.js function" for the application, called to "link" the asm.js module. We instantiate
// the wasm module at that time, and it receives imports and provides exports and so forth, the app
@@ -182,7 +190,10 @@ function integrateWasmJS(Module) {
}
function doWasmPolyfill(method) {
- if (typeof WasmJS !== 'function') return false; // not built with wasm.js polyfill?
+ if (typeof WasmJS !== 'function') {
+ Module['printErr']('WasmJS not detected - polyfill not bundled?');
+ return false;
+ }
// Use wasm.js to polyfill and execute code in a wasm interpreter.
var wasmJS = WasmJS({});
@@ -247,7 +258,7 @@ function integrateWasmJS(Module) {
var methods = method.split(',');
for (var i = 0; i < methods.length; i++) {
var curr = methods[i];
- //console.log('using wasm/js method: ' + curr);
+ //Module['printErr']('using wasm/js method: ' + curr);
if (curr === 'native-wasm') {
if (doNativeWasm()) return;
} else if (curr === 'just-asm') {
@@ -258,5 +269,6 @@ function integrateWasmJS(Module) {
throw 'bad method: ' + curr;
}
}
+ throw 'no wasm method succeeded';
}