From 73687a0044c3e851f8bce2c1c732fe5a2175c9ff Mon Sep 17 00:00:00 2001 From: Ryan Lester Date: Thu, 30 Aug 2018 16:54:15 -0400 Subject: [PATCH 1/2] style consistency fix --- dist-build/emscripten.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dist-build/emscripten.sh b/dist-build/emscripten.sh index 1aabaa13..739048bd 100755 --- a/dist-build/emscripten.sh +++ b/dist-build/emscripten.sh @@ -95,10 +95,10 @@ if [ "$DIST" = yes ]; then Module['TOTAL_MEMORY'] = root['sodium']['totalMemory']; } var _Module = Module; - Module.ready = new Promise(function (resolve, reject) { + Module.ready = new Promise(function(resolve, reject) { var Module = _Module; Module.onAbort = reject; - Module.onRuntimeInitialized = function () { + Module.onRuntimeInitialized = function() { try { /* Test arbitrary wasm function */ Module._crypto_secretbox_keybytes(); @@ -107,7 +107,7 @@ if [ "$DIST" = yes ]; then reject(err); } }; - Module.useBackupModule = function () { + Module.useBackupModule = function() { var Module = _Module; Module.onAbort = undefined; Module.onRuntimeInitialized = undefined; @@ -115,7 +115,7 @@ if [ "$DIST" = yes ]; then $(cat "${PREFIX}/lib/libsodium.asm.tmp.js" | sed 's|use asm||g') }; $(cat "${PREFIX}/lib/libsodium.wasm.tmp.js") - }).catch(function () { + }).catch(function() { _Module.useBackupModule(); }); EOM From f642149364c2fb96fba3558f26e42bd2716ac9a7 Mon Sep 17 00:00:00 2001 From: Ryan Lester Date: Thu, 30 Aug 2018 16:54:29 -0400 Subject: [PATCH 2/2] asm.js fallback fix --- dist-build/emscripten.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist-build/emscripten.sh b/dist-build/emscripten.sh index 739048bd..8a7c950f 100755 --- a/dist-build/emscripten.sh +++ b/dist-build/emscripten.sh @@ -109,9 +109,9 @@ if [ "$DIST" = yes ]; then }; Module.useBackupModule = function() { var Module = _Module; - Module.onAbort = undefined; - Module.onRuntimeInitialized = undefined; - Module.useBackupModule = undefined; + Object.keys(Module).forEach(function(k) { + delete Module[k]; + }); $(cat "${PREFIX}/lib/libsodium.asm.tmp.js" | sed 's|use asm||g') }; $(cat "${PREFIX}/lib/libsodium.wasm.tmp.js")