diff --git a/www/js/lib/libzim-wasm.js b/www/js/lib/libzim-wasm.js index f8580d50..e2e3c0c0 100644 --- a/www/js/lib/libzim-wasm.js +++ b/www/js/lib/libzim-wasm.js @@ -1,4 +1,4 @@ - + // The Module object: Our interface to the outside world. We import // and export values on it. There are various ways Module can be used: @@ -131,10 +131,6 @@ var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function'; var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string'; var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; -if (Module['ENVIRONMENT']) { - throw new Error('Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)'); -} - // `/` should be present at the end if `scriptDirectory` is not empty var scriptDirectory = ''; function locateFile(path) { @@ -160,9 +156,6 @@ var read_, function logExceptionOnExit(e) { if (e instanceof ExitStatus) return; let toLog = e; - if (e && typeof e == 'object' && e.stack) { - toLog = [e, e.stack]; - } err('exiting due to exception: ' + toLog); } @@ -171,7 +164,6 @@ var nodePath; var requireNodeFS; if (ENVIRONMENT_IS_NODE) { - if (!(typeof process == 'object' && typeof require == 'function')) throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)'); if (ENVIRONMENT_IS_WORKER) { scriptDirectory = require('path').dirname(scriptDirectory) + '/'; } else { @@ -202,7 +194,6 @@ readBinary = (filename) => { if (!ret.buffer) { ret = new Uint8Array(ret); } - assert(ret.buffer); return ret; }; @@ -251,51 +242,6 @@ readAsync = (filename, onload, onerror) => { Module['inspect'] = function () { return '[Emscripten Module object]'; }; -} else -if (ENVIRONMENT_IS_SHELL) { - - if ((typeof process == 'object' && typeof require === 'function') || typeof window == 'object' || typeof importScripts == 'function') throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)'); - - if (typeof read != 'undefined') { - read_ = function shell_read(f) { - return read(f); - }; - } - - readBinary = function readBinary(f) { - let data; - if (typeof readbuffer == 'function') { - return new Uint8Array(readbuffer(f)); - } - data = read(f, 'binary'); - assert(typeof data == 'object'); - return data; - }; - - readAsync = function readAsync(f, onload, onerror) { - setTimeout(() => onload(readBinary(f)), 0); - }; - - if (typeof scriptArgs != 'undefined') { - arguments_ = scriptArgs; - } else if (typeof arguments != 'undefined') { - arguments_ = arguments; - } - - if (typeof quit == 'function') { - quit_ = (status, toThrow) => { - logExceptionOnExit(toThrow); - quit(status); - }; - } - - if (typeof print != 'undefined') { - // Prefer to use print/printErr where they exist, as they usually work better. - if (typeof console == 'undefined') console = /** @type{!Console} */({}); - console.log = /** @type{!function(this:Console, ...*): undefined} */ (print); - console.warn = console.error = /** @type{!function(this:Console, ...*): undefined} */ (typeof printErr != 'undefined' ? printErr : print); - } - } else // Note that this includes Node.js workers when relevant (pthreads is enabled). @@ -319,8 +265,6 @@ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { scriptDirectory = ''; } - if (!(typeof window == 'object' || typeof importScripts == 'function')) throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)'); - // Differentiate the Web Worker from the Node Worker case, as reading must // be done differently. { @@ -365,7 +309,6 @@ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { setWindowTitle = (title) => document.title = title; } else { - throw new Error('environment detection error'); } var out = Module['print'] || console.log.bind(console); @@ -376,41 +319,19 @@ Object.assign(Module, moduleOverrides); // Free the object hierarchy contained in the overrides, this lets the GC // reclaim data used e.g. in memoryInitializerRequest, which is a large typed array. moduleOverrides = null; -checkIncomingModuleAPI(); // Emit code to handle expected values on the Module object. This applies Module.x // to the proper local x. This has two benefits: first, we only emit it if it is // expected to arrive, and second, by using a local everywhere else that can be // minified. -if (Module['arguments']) arguments_ = Module['arguments'];legacyModuleProp('arguments', 'arguments_'); +if (Module['arguments']) arguments_ = Module['arguments']; -if (Module['thisProgram']) thisProgram = Module['thisProgram'];legacyModuleProp('thisProgram', 'thisProgram'); +if (Module['thisProgram']) thisProgram = Module['thisProgram']; -if (Module['quit']) quit_ = Module['quit'];legacyModuleProp('quit', 'quit_'); +if (Module['quit']) quit_ = Module['quit']; // perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message -// Assertions on removed incoming Module JS APIs. -assert(typeof Module['memoryInitializerPrefixURL'] == 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead'); -assert(typeof Module['pthreadMainPrefixURL'] == 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead'); -assert(typeof Module['cdInitializerPrefixURL'] == 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead'); -assert(typeof Module['filePackagePrefixURL'] == 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead'); -assert(typeof Module['read'] == 'undefined', 'Module.read option was removed (modify read_ in JS)'); -assert(typeof Module['readAsync'] == 'undefined', 'Module.readAsync option was removed (modify readAsync in JS)'); -assert(typeof Module['readBinary'] == 'undefined', 'Module.readBinary option was removed (modify readBinary in JS)'); -assert(typeof Module['setWindowTitle'] == 'undefined', 'Module.setWindowTitle option was removed (modify setWindowTitle in JS)'); -assert(typeof Module['TOTAL_MEMORY'] == 'undefined', 'Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY'); -legacyModuleProp('read', 'read_'); -legacyModuleProp('readAsync', 'readAsync'); -legacyModuleProp('readBinary', 'readBinary'); -legacyModuleProp('setWindowTitle', 'setWindowTitle'); -var IDBFS = 'IDBFS is no longer included by default; build with -lidbfs.js'; -var PROXYFS = 'PROXYFS is no longer included by default; build with -lproxyfs.js'; - -var NODEFS = 'NODEFS is no longer included by default; build with -lnodefs.js'; - - -assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable."); @@ -454,7 +375,6 @@ function warnOnce(text) { // This gives correct answers for everything less than 2^{14} = 16384 // I hope nobody is contemplating functions with 16384 arguments... function uleb128Encode(n) { - assert(n < 16384); if (n < 128) { return [n]; } @@ -481,7 +401,6 @@ function convertJsFunctionToWasm(func, sig) { results: sig[0] == 'v' ? [] : [typeNames[sig[0]]] }; for (var i = 1; i < sig.length; ++i) { - assert(sig[i] in typeNames, 'invalid signature char: ' + sig[i]); type.parameters.push(typeNames[sig[i]]); } return new WebAssembly.Function(type, func); @@ -506,7 +425,6 @@ function convertJsFunctionToWasm(func, sig) { // Parameters, length + signatures typeSection = typeSection.concat(uleb128Encode(sigParam.length)); for (var i = 0; i < sigParam.length; ++i) { - assert(sigParam[i] in typeCodes, 'invalid signature char: ' + sigParam[i]); typeSection.push(typeCodes[sigParam[i]]); } @@ -588,7 +506,6 @@ function updateTableMap(offset, count) { * @param {string=} sig */ function addFunction(func, sig) { - assert(typeof func != 'undefined'); // Check if the function is already in the table, to ensure each function // gets a unique index. First, create the map if this is the first use. @@ -612,7 +529,6 @@ function addFunction(func, sig) { if (!(err instanceof TypeError)) { throw err; } - assert(typeof sig != 'undefined', 'Missing signature argument to addFunction: ' + func); var wrapped = convertJsFunctionToWasm(func, sig); setWasmTableEntry(ret, wrapped); } @@ -631,48 +547,6 @@ function removeFunction(index) { // include: runtime_debug.js -function legacyModuleProp(prop, newName) { - if (!Object.getOwnPropertyDescriptor(Module, prop)) { - Object.defineProperty(Module, prop, { - configurable: true, - get: function() { - abort('Module.' + prop + ' has been replaced with plain ' + newName + ' (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)'); - } - }); - } -} - -function ignoredModuleProp(prop) { - if (Object.getOwnPropertyDescriptor(Module, prop)) { - abort('`Module.' + prop + '` was supplied but `' + prop + '` not included in INCOMING_MODULE_JS_API'); - } -} - -function unexportedMessage(sym, isFSSybol) { - var msg = "'" + sym + "' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)"; - if (isFSSybol) { - msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you'; - } - return msg; -} - -function unexportedRuntimeSymbol(sym, isFSSybol) { - if (!Object.getOwnPropertyDescriptor(Module, sym)) { - Object.defineProperty(Module, sym, { - configurable: true, - get: function() { - abort(unexportedMessage(sym, isFSSybol)); - } - }); - } -} - -function unexportedRuntimeFunction(sym, isFSSybol) { - if (!Object.getOwnPropertyDescriptor(Module, sym)) { - Module[sym] = () => abort(unexportedMessage(sym, isFSSybol)); - } -} - // end include: runtime_debug.js var tempRet0 = 0; var setTempRet0 = (value) => { tempRet0 = value; }; @@ -691,8 +565,8 @@ var getTempRet0 = () => tempRet0; // is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html var wasmBinary; -if (Module['wasmBinary']) wasmBinary = Module['wasmBinary'];legacyModuleProp('wasmBinary', 'wasmBinary'); -var noExitRuntime = Module['noExitRuntime'] || true;legacyModuleProp('noExitRuntime', 'noExitRuntime'); +if (Module['wasmBinary']) wasmBinary = Module['wasmBinary']; +var noExitRuntime = Module['noExitRuntime'] || true; if (typeof WebAssembly != 'object') { abort('no native wasm support detected'); @@ -718,14 +592,16 @@ var EXITSTATUS; /** @type {function(*, string=)} */ function assert(condition, text) { if (!condition) { - abort('Assertion failed' + (text ? ': ' + text : '')); + // This build was created without ASSERTIONS defined. `assert()` should not + // ever be called in this configuration but in case there are callers in + // the wild leave this simple abort() implemenation here for now. + abort(text); } } // Returns the C function with a specified identifier (for C++, you need to do manual name mangling) function getCFunc(ident) { var func = Module['_' + ident]; // closure exported function - assert(func, 'Cannot call unknown function ' + ident + ', make sure it is exported'); return func; } @@ -766,7 +642,6 @@ function ccall(ident, returnType, argTypes, args, opts) { var func = getCFunc(ident); var cArgs = []; var stack = 0; - assert(returnType !== 'array', 'Return type should not be "array".'); if (args) { for (var i = 0; i < args.length; i++) { var converter = toC[argTypes[i]]; @@ -792,14 +667,19 @@ function ccall(ident, returnType, argTypes, args, opts) { @param {Array=} argTypes @param {Object=} opts */ function cwrap(ident, returnType, argTypes, opts) { + argTypes = argTypes || []; + // When the function takes numbers and returns a number, we can just return + // the original function + var numericArgs = argTypes.every(function(type){ return type === 'number'}); + var numericRet = returnType !== 'string'; + if (numericRet && numericArgs && !opts) { + return getCFunc(ident); + } return function() { return ccall(ident, returnType, argTypes, arguments, opts); } } -// We used to include malloc/free by default in the past. Show a helpful error in -// builds with assertions. - // include: runtime_legacy.js @@ -817,8 +697,6 @@ var ALLOC_STACK = 1; // Lives for the duration of the current function call */ function allocate(slab, allocator) { var ret; - assert(typeof allocator == 'number', 'allocate no longer takes a type argument') - assert(typeof slab != 'number', 'allocate no longer takes a number as arg0') if (allocator == ALLOC_STACK) { ret = stackAlloc(slab.length); @@ -875,7 +753,6 @@ function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) { if ((u0 & 0xF0) == 0xE0) { u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; } else { - if ((u0 & 0xF8) != 0xF0) warnOnce('Invalid UTF-8 leading byte 0x' + u0.toString(16) + ' encountered when deserializing a UTF-8 string in wasm memory to a JS string!'); u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63); } @@ -951,7 +828,6 @@ function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { heap[outIdx++] = 0x80 | (u & 63); } else { if (outIdx + 3 >= endIdx) break; - if (u > 0x10FFFF) warnOnce('Invalid Unicode code point 0x' + u.toString(16) + ' encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).'); heap[outIdx++] = 0xF0 | (u >> 18); heap[outIdx++] = 0x80 | ((u >> 12) & 63); heap[outIdx++] = 0x80 | ((u >> 6) & 63); @@ -969,7 +845,6 @@ function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { // Returns the number of bytes written, EXCLUDING the null terminator. function stringToUTF8(str, outPtr, maxBytesToWrite) { - assert(typeof maxBytesToWrite == 'number', 'stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!'); return stringToUTF8Array(str, HEAPU8,outPtr, maxBytesToWrite); } @@ -1020,7 +895,6 @@ function stringToAscii(str, outPtr) { var UTF16Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder('utf-16le') : undefined; function UTF16ToString(ptr, maxBytesToRead) { - assert(ptr % 2 == 0, 'Pointer passed to UTF16ToString must be aligned to two bytes!'); var endPtr = ptr; // TextDecoder needs to know the byte length in advance, it doesn't stop on null terminator by itself. // Also, use the length info to avoid running tiny strings through TextDecoder, since .subarray() allocates garbage. @@ -1061,8 +935,6 @@ function UTF16ToString(ptr, maxBytesToRead) { // Returns the number of bytes written, EXCLUDING the null terminator. function stringToUTF16(str, outPtr, maxBytesToWrite) { - assert(outPtr % 2 == 0, 'Pointer passed to stringToUTF16 must be aligned to two bytes!'); - assert(typeof maxBytesToWrite == 'number', 'stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!'); // Backwards compatibility: if max bytes is not specified, assume unsafe unbounded write is allowed. if (maxBytesToWrite === undefined) { maxBytesToWrite = 0x7FFFFFFF; @@ -1089,7 +961,6 @@ function lengthBytesUTF16(str) { } function UTF32ToString(ptr, maxBytesToRead) { - assert(ptr % 4 == 0, 'Pointer passed to UTF32ToString must be aligned to four bytes!'); var i = 0; var str = ''; @@ -1123,8 +994,6 @@ function UTF32ToString(ptr, maxBytesToRead) { // Returns the number of bytes written, EXCLUDING the null terminator. function stringToUTF32(str, outPtr, maxBytesToWrite) { - assert(outPtr % 4 == 0, 'Pointer passed to stringToUTF32 must be aligned to four bytes!'); - assert(typeof maxBytesToWrite == 'number', 'stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!'); // Backwards compatibility: if max bytes is not specified, assume unsafe unbounded write is allowed. if (maxBytesToWrite === undefined) { maxBytesToWrite = 0x7FFFFFFF; @@ -1203,14 +1072,12 @@ function writeStringToMemory(string, buffer, dontAddNull) { } function writeArrayToMemory(array, buffer) { - assert(array.length >= 0, 'writeArrayToMemory array must have a length (should be an array or typed array)') HEAP8.set(array, buffer); } /** @param {boolean=} dontAddNull */ function writeAsciiToMemory(str, buffer, dontAddNull) { for (var i = 0; i < str.length; ++i) { - assert(str.charCodeAt(i) === (str.charCodeAt(i) & 0xff)); HEAP8[((buffer++)>>0)] = str.charCodeAt(i); } // Null-terminate the pointer to the HEAP. @@ -1253,19 +1120,8 @@ function updateGlobalBufferAndViews(buf) { } var TOTAL_STACK = 5242880; -if (Module['TOTAL_STACK']) assert(TOTAL_STACK === Module['TOTAL_STACK'], 'the stack size can no longer be determined at runtime') -var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 83886080;legacyModuleProp('INITIAL_MEMORY', 'INITIAL_MEMORY'); - -assert(INITIAL_MEMORY >= TOTAL_STACK, 'INITIAL_MEMORY should be larger than TOTAL_STACK, was ' + INITIAL_MEMORY + '! (TOTAL_STACK=' + TOTAL_STACK + ')'); - -// check for full engine support (use string 'subarray' to avoid closure compiler confusion) -assert(typeof Int32Array != 'undefined' && typeof Float64Array !== 'undefined' && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, - 'JS engine does not provide full typed array support'); - -// If memory is defined in wasm, the user can't provide it. -assert(!Module['wasmMemory'], 'Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally'); -assert(INITIAL_MEMORY == 83886080, 'Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically'); +var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 83886080; // include: runtime_init_table.js // In regular non-RELOCATABLE mode the table is exported @@ -1277,43 +1133,10 @@ var wasmTable; // include: runtime_stack_check.js -// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode. -function writeStackCookie() { - var max = _emscripten_stack_get_end(); - assert((max & 3) == 0); - // The stack grow downwards towards _emscripten_stack_get_end. - // We write cookies to the final two words in the stack and detect if they are - // ever overwritten. - HEAP32[((max)>>2)] = 0x2135467; - HEAP32[(((max)+(4))>>2)] = 0x89BACDFE; - // Also test the global address 0 for integrity. - HEAPU32[0] = 0x63736d65; /* 'emsc' */ -} - -function checkStackCookie() { - if (ABORT) return; - var max = _emscripten_stack_get_end(); - var cookie1 = HEAPU32[((max)>>2)]; - var cookie2 = HEAPU32[(((max)+(4))>>2)]; - if (cookie1 != 0x2135467 || cookie2 != 0x89BACDFE) { - abort('Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x' + cookie2.toString(16) + ' 0x' + cookie1.toString(16)); - } - // Also test the global address 0 for integrity. - if (HEAPU32[0] !== 0x63736d65 /* 'emsc' */) abort('Runtime error: The application has corrupted its heap memory area (address zero)!'); -} - // end include: runtime_stack_check.js // include: runtime_assertions.js -// Endianness check -(function() { - var h16 = new Int16Array(1); - var h8 = new Int8Array(h16.buffer); - h16[0] = 0x6373; - if (h8[0] !== 0x73 || h8[1] !== 0x63) throw 'Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)'; -})(); - // end include: runtime_assertions.js var __ATPRERUN__ = []; // functions called before the runtime is initialized var __ATINIT__ = []; // functions called during startup @@ -1340,8 +1163,6 @@ function preRun() { } function initRuntime() { - checkStackCookie(); - assert(!runtimeInitialized); runtimeInitialized = true; @@ -1354,13 +1175,11 @@ TTY.init(); } function preMain() { - checkStackCookie(); callRuntimeCallbacks(__ATMAIN__); } function postRun() { - checkStackCookie(); if (Module['postRun']) { if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']]; @@ -1402,11 +1221,6 @@ function addOnPostRun(cb) { // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc -assert(Math.imul, 'This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill'); -assert(Math.fround, 'This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill'); -assert(Math.clz32, 'This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill'); -assert(Math.trunc, 'This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill'); - // end include: runtime_math.js // A counter of dependencies for calling run(). If we need to // do asynchronous work before running, increment this and @@ -1418,14 +1232,9 @@ assert(Math.trunc, 'This browser does not support Math.trunc(), build with LEGAC var runDependencies = 0; var runDependencyWatcher = null; var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled -var runDependencyTracking = {}; function getUniqueRunDependency(id) { - var orig = id; - while (1) { - if (!runDependencyTracking[id]) return id; - id = orig + Math.random(); - } + return id; } function addRunDependency(id) { @@ -1435,33 +1244,6 @@ function addRunDependency(id) { Module['monitorRunDependencies'](runDependencies); } - if (id) { - assert(!runDependencyTracking[id]); - runDependencyTracking[id] = 1; - if (runDependencyWatcher === null && typeof setInterval != 'undefined') { - // Check for missing dependencies every few seconds - runDependencyWatcher = setInterval(function() { - if (ABORT) { - clearInterval(runDependencyWatcher); - runDependencyWatcher = null; - return; - } - var shown = false; - for (var dep in runDependencyTracking) { - if (!shown) { - shown = true; - err('still waiting on run dependencies:'); - } - err('dependency: ' + dep); - } - if (shown) { - err('(end of list)'); - } - }, 10000); - } - } else { - err('warning: run dependency added without ID'); - } } function removeRunDependency(id) { @@ -1471,12 +1253,6 @@ function removeRunDependency(id) { Module['monitorRunDependencies'](runDependencies); } - if (id) { - assert(runDependencyTracking[id]); - delete runDependencyTracking[id]; - } else { - err('warning: run dependency removed without ID'); - } if (runDependencies == 0) { if (runDependencyWatcher !== null) { clearInterval(runDependencyWatcher); @@ -1506,6 +1282,8 @@ function abort(what) { ABORT = true; EXITSTATUS = 1; + what += '. Build with -sASSERTIONS for more info.'; + // Use a wasm runtime error, because a JS error might be seen as a foreign // exception, which means we'd run destructors on it. We need the error to // simply make the program stop. @@ -1552,22 +1330,6 @@ function isFileURI(filename) { } // end include: URIUtils.js -/** @param {boolean=} fixedasm */ -function createExportWrapper(name, fixedasm) { - return function() { - var displayName = name; - var asm = fixedasm; - if (!fixedasm) { - asm = Module['asm']; - } - assert(runtimeInitialized, 'native function `' + displayName + '` called before runtime initialization'); - if (!asm[name]) { - assert(asm[name], 'exported native function `' + displayName + '` not found'); - } - return asm[name].apply(null, arguments); - }; -} - var wasmBinaryFile; wasmBinaryFile = 'libzim-wasm.wasm'; if (!isDataURI(wasmBinaryFile)) { @@ -1641,15 +1403,9 @@ function createWasm() { Module['asm'] = exports; wasmMemory = Module['asm']['memory']; - assert(wasmMemory, "memory not found in wasm exports"); - // This assertion doesn't hold when emscripten is run in --post-link - // mode. - // TODO(sbc): Read INITIAL_MEMORY out of the wasm file in post-link mode. - //assert(wasmMemory.buffer.byteLength === 83886080); updateGlobalBufferAndViews(wasmMemory.buffer); wasmTable = Module['asm']['__indirect_function_table']; - assert(wasmTable, "table not found in wasm exports"); addOnInit(Module['asm']['__wasm_call_ctors']); @@ -1660,15 +1416,9 @@ function createWasm() { addRunDependency('wasm-instantiate'); // Prefer streaming instantiation if available. - // Async compilation can be confusing when an error on the page overwrites Module - // (for example, if the order of elements is wrong, and the one defining Module is - // later), so we save Module and check it later. - var trueModule = Module; function receiveInstantiationResult(result) { // 'result' is a ResultObject object which has both the module and instance. // receiveInstance() will swap in the exports (to Module.asm) so they can be called - assert(Module === trueModule, 'the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?'); - trueModule = null; // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line. // When the regression is fixed, can restore the above USE_PTHREADS-enabled path. receiveInstance(result['instance']); @@ -1682,10 +1432,6 @@ function createWasm() { }).then(receiver, function(reason) { err('failed to asynchronously prepare wasm: ' + reason); - // Warn on some common problems. - if (isFileURI(wasmBinaryFile)) { - err('warning: Loading from a file URI (' + wasmBinaryFile + ') is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing'); - } abort(reason); }); } @@ -1852,7 +1598,6 @@ var ASM_CONSTS = { if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1; wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr); } - assert(wasmTable.get(funcPtr) == func, "JavaScript-side Wasm function table mirror is out of date!"); return func; } @@ -2013,7 +1758,6 @@ var ASM_CONSTS = { this.release_ref = function() { var prev = HEAP32[((this.ptr)>>2)]; HEAP32[((this.ptr)>>2)] = prev - 1; - assert(prev > 0); return prev === 1; }; @@ -2042,11 +1786,7 @@ var ASM_CONSTS = { }; } function ___cxa_free_exception(ptr) { - try { return _free(new ExceptionInfo(ptr).ptr); - } catch(e) { - err('exception during __cxa_free_exception: ' + e); - } } function exception_decRef(info) { // A rethrown exception can reach refcount 0; it must not be discarded @@ -2070,7 +1810,6 @@ var ASM_CONSTS = { function ___cxa_end_catch() { // Clear state flag. _setThrew(0); - assert(exceptionCaught.length > 0); // Call destructor if one is registered then clear it. var info = exceptionCaught.pop(); @@ -2323,7 +2062,7 @@ var ASM_CONSTS = { } } // we couldn't find a proper implementation, as Math.random() is not suitable for /dev/random, see emscripten-core/emscripten/pull/7096 - return function() { abort("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };"); }; + return function() { abort("randomDevice"); }; } var PATH_FS = {resolve:function() { @@ -2524,7 +2263,6 @@ var ASM_CONSTS = { } function alignMemory(size, alignment) { - assert(alignment, "alignment argument is required"); return Math.ceil(size / alignment) * alignment; } function mmapAlloc(size) { @@ -2740,7 +2478,6 @@ var ASM_CONSTS = { var contents = stream.node.contents; if (position >= stream.node.usedBytes) return 0; var size = Math.min(stream.node.usedBytes - position, length); - assert(size >= 0); if (size > 8 && contents.subarray) { // non-trivial, and typed array buffer.set(contents.subarray(position, position + size), offset); } else { @@ -2748,8 +2485,6 @@ var ASM_CONSTS = { } return size; },write:function(stream, buffer, offset, length, position, canOwn) { - // The data buffer should be a typed array view - assert(!(buffer instanceof ArrayBuffer)); // If the buffer is located in main memory (HEAP), and if // memory can grow, we can't hold on to references of the // memory buffer, as they may get invalidated. That means we @@ -2764,7 +2499,6 @@ var ASM_CONSTS = { if (buffer.subarray && (!node.contents || node.contents.subarray)) { // This write is from a typed array to a typed array? if (canOwn) { - assert(position === 0, 'canOwn must imply no weird position inside the file'); node.contents = buffer.subarray(offset, offset + length); node.usedBytes = length; return length; @@ -2996,10 +2730,6 @@ var ASM_CONSTS = { } return position; }}}; - - var ERRNO_MESSAGES = {0:"Success",1:"Arg list too long",2:"Permission denied",3:"Address already in use",4:"Address not available",5:"Address family not supported by protocol family",6:"No more processes",7:"Socket already connected",8:"Bad file number",9:"Trying to read unreadable message",10:"Mount device busy",11:"Operation canceled",12:"No children",13:"Connection aborted",14:"Connection refused",15:"Connection reset by peer",16:"File locking deadlock error",17:"Destination address required",18:"Math arg out of domain of func",19:"Quota exceeded",20:"File exists",21:"Bad address",22:"File too large",23:"Host is unreachable",24:"Identifier removed",25:"Illegal byte sequence",26:"Connection already in progress",27:"Interrupted system call",28:"Invalid argument",29:"I/O error",30:"Socket is already connected",31:"Is a directory",32:"Too many symbolic links",33:"Too many open files",34:"Too many links",35:"Message too long",36:"Multihop attempted",37:"File or path name too long",38:"Network interface is not configured",39:"Connection reset by network",40:"Network is unreachable",41:"Too many open files in system",42:"No buffer space available",43:"No such device",44:"No such file or directory",45:"Exec format error",46:"No record locks available",47:"The link has been severed",48:"Not enough core",49:"No message of desired type",50:"Protocol not available",51:"No space left on device",52:"Function not implemented",53:"Socket is not connected",54:"Not a directory",55:"Directory not empty",56:"State not recoverable",57:"Socket operation on non-socket",59:"Not a typewriter",60:"No such device or address",61:"Value too large for defined data type",62:"Previous owner died",63:"Not super-user",64:"Broken pipe",65:"Protocol error",66:"Unknown protocol",67:"Protocol wrong type for socket",68:"Math result not representable",69:"Read only file system",70:"Illegal seek",71:"No such process",72:"Stale file handle",73:"Connection timed out",74:"Text file busy",75:"Cross-device link",100:"Device not a stream",101:"Bad font file fmt",102:"Invalid slot",103:"Invalid request code",104:"No anode",105:"Block device required",106:"Channel number out of range",107:"Level 3 halted",108:"Level 3 reset",109:"Link number out of range",110:"Protocol driver not attached",111:"No CSI structure available",112:"Level 2 halted",113:"Invalid exchange",114:"Invalid request descriptor",115:"Exchange full",116:"No data (for no delay io)",117:"Timer expired",118:"Out of streams resources",119:"Machine is not on the network",120:"Package not installed",121:"The object is remote",122:"Advertise error",123:"Srmount error",124:"Communication error on send",125:"Cross mount point (not really error)",126:"Given log. name not unique",127:"f.d. invalid for this operation",128:"Remote address changed",129:"Can access a needed shared lib",130:"Accessing a corrupted shared lib",131:".lib section in a.out corrupted",132:"Attempting to link in too many libs",133:"Attempting to exec a shared library",135:"Streams pipe error",136:"Too many users",137:"Socket type not supported",138:"Not supported",139:"Protocol family not supported",140:"Can't send after socket shutdown",141:"Too many references",142:"Host is down",148:"No medium (in tape drive)",156:"Level 2 not synchronized"}; - - var ERRNO_CODES = {}; var FS = {root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path, opts = {}) => { path = PATH_FS.resolve(FS.cwd(), path); @@ -3109,7 +2839,6 @@ var ASM_CONSTS = { // if we failed to find it in the cache, call into the VFS return FS.lookup(parent, name); },createNode:(parent, name, mode, rdev) => { - assert(typeof parent == 'object') var node = new FS.FSNode(parent, name, mode, rdev); FS.hashAddNode(node); @@ -3294,7 +3023,6 @@ var ASM_CONSTS = { var completed = 0; function doCallback(errCode) { - assert(FS.syncFSRequests > 0); FS.syncFSRequests--; return callback(errCode); } @@ -3320,11 +3048,6 @@ var ASM_CONSTS = { mount.type.syncfs(mount, populate, done); }); },mount:(type, opts, mountpoint) => { - if (typeof type == 'string') { - // The filesystem was not included, and instead we have an error - // message stored in the variable. - throw type; - } var root = mountpoint === '/'; var pseudo = !mountpoint; var node; @@ -3402,7 +3125,6 @@ var ASM_CONSTS = { // remove this mount from the child mounts var idx = node.mount.mounts.indexOf(mount); - assert(idx !== -1); node.mount.mounts.splice(idx, 1); },lookup:(parent, name) => { return parent.node_ops.lookup(parent, name); @@ -4054,32 +3776,16 @@ var ASM_CONSTS = { var stdin = FS.open('/dev/stdin', 0); var stdout = FS.open('/dev/stdout', 1); var stderr = FS.open('/dev/stderr', 1); - assert(stdin.fd === 0, 'invalid handle for stdin (' + stdin.fd + ')'); - assert(stdout.fd === 1, 'invalid handle for stdout (' + stdout.fd + ')'); - assert(stderr.fd === 2, 'invalid handle for stderr (' + stderr.fd + ')'); },ensureErrnoError:() => { if (FS.ErrnoError) return; FS.ErrnoError = /** @this{Object} */ function ErrnoError(errno, node) { this.node = node; this.setErrno = /** @this{Object} */ function(errno) { this.errno = errno; - for (var key in ERRNO_CODES) { - if (ERRNO_CODES[key] === errno) { - this.code = key; - break; - } - } }; this.setErrno(errno); - this.message = ERRNO_MESSAGES[errno]; + this.message = 'FS error'; - // Try to get a maximally helpful stack trace. On Node.js, getting Error.stack - // now ensures it shows what we want. - if (this.stack) { - // Define the stack property for Node.js 4, which otherwise errors on the next line. - Object.defineProperty(this, "stack", { value: (new Error).stack, writable: true }); - this.stack = demangleAll(this.stack); - } }; FS.ErrnoError.prototype = new Error(); FS.ErrnoError.prototype.constructor = FS.ErrnoError; @@ -4104,7 +3810,6 @@ var ASM_CONSTS = { 'WORKERFS': WORKERFS, }; },init:(input, output, error) => { - assert(!FS.init.initialized, 'FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)'); FS.init.initialized = true; FS.ensureErrnoError(); @@ -4118,7 +3823,6 @@ var ASM_CONSTS = { },quit:() => { FS.init.initialized = false; // force-flush all streams, so we get musl std streams printed out - _fflush(0); // close all of our streams for (var i = 0; i < FS.streams.length; i++) { var stream = FS.streams[i]; @@ -4418,7 +4122,6 @@ var ASM_CONSTS = { if (position >= contents.length) return 0; var size = Math.min(contents.length - position, length); - assert(size >= 0); if (contents.slice) { // normal array for (var i = 0; i < size; i++) { buffer[offset + i] = contents[position + i]; @@ -4532,18 +4235,6 @@ var ASM_CONSTS = { transaction.onerror = onerror; }; openRequest.onerror = onerror; - },absolutePath:() => { - abort('FS.absolutePath has been removed; use PATH_FS.resolve instead'); - },createFolder:() => { - abort('FS.createFolder has been removed; use FS.mkdir instead'); - },createLink:() => { - abort('FS.createLink has been removed; use FS.symlink instead'); - },joinPath:() => { - abort('FS.joinPath has been removed; use PATH.join instead'); - },mmapAlloc:() => { - abort('FS.mmapAlloc has been replaced by the top level function mmapAlloc'); - },standardizePath:() => { - abort('FS.standardizePath has been removed; use PATH.normalize instead'); }}; var SYSCALLS = {DEFAULT_POLLMASK:5,calculateAt:function(dirfd, path, allowEmpty) { if (PATH.isAbs(path)) { @@ -4599,7 +4290,6 @@ var ASM_CONSTS = { var buffer = HEAPU8.slice(addr, addr + len); FS.msync(stream, buffer, offset, len, flags); },varargs:undefined,get:function() { - assert(SYSCALLS.varargs != undefined); SYSCALLS.varargs += 4; var ret = HEAP32[(((SYSCALLS.varargs)-(4))>>2)]; return ret; @@ -4706,7 +4396,6 @@ var ASM_CONSTS = { var nofollow = flags & 256; var allowEmpty = flags & 4096; flags = flags & (~4352); - assert(!flags, flags); path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); } catch (e) { @@ -5186,7 +4875,6 @@ var ASM_CONSTS = { // for class handles. We check for the presence of FinalizationRegistry // at run-time, not build-time. finalizationRegistry = new FinalizationRegistry((info) => { - console.warn(info.leakWarning.stack.replace(/^Error: /, '')); releaseClassHandle(info.$$); }); attachFinalizer = (handle) => { @@ -5195,18 +4883,6 @@ var ASM_CONSTS = { if (hasSmartPtr) { // We should not call the destructor on raw pointers in case other code expects the pointee to live var info = { $$: $$ }; - // Create a warning as an Error instance in advance so that we can store - // the current stacktrace and point to it when / if a leak is detected. - // This is more useful than the empty stacktrace of `FinalizationRegistry` - // callback. - var cls = $$.ptrType.registeredClass; - info.leakWarning = new Error("Embind found a leaked C++ instance " + cls.name + " <0x" + $$.ptr.toString(16) + ">.\n" + - "We'll free it automatically in this case, but this functionality is not reliable across various environments.\n" + - "Make sure to invoke .delete() manually once you're done with the instance instead.\n" + - "Originally allocated"); // `.stack` will add "at ..." after this sentence - if ('captureStackTrace' in Error) { - Error.captureStackTrace(info.leakWarning, RegisteredPointer_fromWireType); - } finalizationRegistry.register(handle, info, handle); } return handle; @@ -5568,13 +5244,6 @@ var ASM_CONSTS = { } function dynCallLegacy(sig, ptr, args) { - assert(('dynCall_' + sig) in Module, 'bad function pointer type - no table for sig \'' + sig + '\''); - if (args && args.length) { - // j (64-bit integer) must be passed in as two numbers [low 32, high 32]. - assert(args.length === sig.substring(1).replace(/j/g, '--').length); - } else { - assert(sig.length == 1); - } var f = Module["dynCall_" + sig]; return args && args.length ? f.apply(null, [ptr].concat(args)) : f.call(null, ptr); } @@ -5586,11 +5255,9 @@ var ASM_CONSTS = { if (sig.includes('j')) { return dynCallLegacy(sig, ptr, args); } - assert(getWasmTableEntry(ptr), 'missing table entry in dynCall: ' + ptr); return getWasmTableEntry(ptr).apply(null, args) } function getDynCaller(sig, ptr) { - assert(sig.includes('j'), 'getDynCaller should only be called with i64 sigs') var argCache = []; return function() { argCache.length = 0; @@ -6090,9 +5757,6 @@ var ASM_CONSTS = { return value; }, 'toWireType': function(destructors, value) { - if (typeof value != "number" && typeof value != "boolean") { - throw new TypeError('Cannot convert "' + _embind_repr(value) + '" to ' + this.name); - } // The VM will perform JS to Wasm value conversion, according to the spec: // https://www.w3.org/TR/wasm-js-api-1/#towebassemblyvalue return value; @@ -6153,12 +5817,6 @@ var ASM_CONSTS = { var isUnsignedType = (name.includes('unsigned')); var checkAssertions = (value, toTypeName) => { - if (typeof value != "number" && typeof value != "boolean") { - throw new TypeError('Cannot convert "' + _embind_repr(value) + '" to ' + toTypeName); - } - if (value < minRange || value > maxRange) { - throw new TypeError('Passing a number "' + _embind_repr(value) + '" from JS side to C/C++ side to an argument of type "' + name + '", which is outside the valid range [' + minRange + ', ' + maxRange + ']!'); - } } var toWireType; if (isUnsignedType) { @@ -6445,12 +6103,7 @@ var ASM_CONSTS = { } function _abort() { - abort('native code called abort()'); - } - - function _emscripten_console_error(str) { - assert(typeof str == 'number'); - console.error(UTF8ToString(str)); + abort(''); } function _emscripten_memcpy_big(dest, src, num) { @@ -6472,7 +6125,6 @@ var ASM_CONSTS = { updateGlobalBufferAndViews(wasmMemory.buffer); return 1 /*success*/; } catch(e) { - err('emscripten_realloc_buffer: Attempted to grow heap from ' + buffer.byteLength + ' bytes to ' + size + ' bytes, but got error: ' + e); } // implicit 0 return to save code size (caller will cast "undefined" into 0 // anyhow) @@ -6482,7 +6134,6 @@ var ASM_CONSTS = { requestedSize = requestedSize >>> 0; // With multithreaded builds, races can happen (another thread might increase the size // in between), so return a failure, and let the caller retry. - assert(requestedSize > oldSize); // Memory resize rules: // 1. Always increase heap size to at least the requested size, rounded up @@ -6505,7 +6156,6 @@ var ASM_CONSTS = { // (the wasm binary specifies it, so if we tried, we'd fail anyhow). var maxHeapSize = getHeapMax(); if (requestedSize > maxHeapSize) { - err('Cannot enlarge memory, asked to go up to ' + requestedSize + ' bytes, but the limit is ' + maxHeapSize + ' bytes!'); return false; } @@ -6527,7 +6177,6 @@ var ASM_CONSTS = { return true; } } - err('Failed to grow the heap from ' + oldSize + ' bytes to ' + newSize + ' bytes, not enough memory!'); return false; } @@ -6616,8 +6265,6 @@ var ASM_CONSTS = { } function convertI32PairToI53Checked(lo, hi) { - assert(lo == (lo >>> 0) || lo == (lo|0)); // lo should either be a i32 or a u32 - assert(hi === (hi|0)); // hi should be a i32 return ((hi + 0x200000) >>> 0 < 0x400001 - !!lo) ? (lo >>> 0) + hi * 4294967296 : NaN; } function _fd_pread(fd, iov, iovcnt, offset_low, offset_high, pnum) { @@ -7093,129 +6740,6 @@ var ASM_CONSTS = { }); FS.FSNode = FSNode; FS.staticInit();; -ERRNO_CODES = { - 'EPERM': 63, - 'ENOENT': 44, - 'ESRCH': 71, - 'EINTR': 27, - 'EIO': 29, - 'ENXIO': 60, - 'E2BIG': 1, - 'ENOEXEC': 45, - 'EBADF': 8, - 'ECHILD': 12, - 'EAGAIN': 6, - 'EWOULDBLOCK': 6, - 'ENOMEM': 48, - 'EACCES': 2, - 'EFAULT': 21, - 'ENOTBLK': 105, - 'EBUSY': 10, - 'EEXIST': 20, - 'EXDEV': 75, - 'ENODEV': 43, - 'ENOTDIR': 54, - 'EISDIR': 31, - 'EINVAL': 28, - 'ENFILE': 41, - 'EMFILE': 33, - 'ENOTTY': 59, - 'ETXTBSY': 74, - 'EFBIG': 22, - 'ENOSPC': 51, - 'ESPIPE': 70, - 'EROFS': 69, - 'EMLINK': 34, - 'EPIPE': 64, - 'EDOM': 18, - 'ERANGE': 68, - 'ENOMSG': 49, - 'EIDRM': 24, - 'ECHRNG': 106, - 'EL2NSYNC': 156, - 'EL3HLT': 107, - 'EL3RST': 108, - 'ELNRNG': 109, - 'EUNATCH': 110, - 'ENOCSI': 111, - 'EL2HLT': 112, - 'EDEADLK': 16, - 'ENOLCK': 46, - 'EBADE': 113, - 'EBADR': 114, - 'EXFULL': 115, - 'ENOANO': 104, - 'EBADRQC': 103, - 'EBADSLT': 102, - 'EDEADLOCK': 16, - 'EBFONT': 101, - 'ENOSTR': 100, - 'ENODATA': 116, - 'ETIME': 117, - 'ENOSR': 118, - 'ENONET': 119, - 'ENOPKG': 120, - 'EREMOTE': 121, - 'ENOLINK': 47, - 'EADV': 122, - 'ESRMNT': 123, - 'ECOMM': 124, - 'EPROTO': 65, - 'EMULTIHOP': 36, - 'EDOTDOT': 125, - 'EBADMSG': 9, - 'ENOTUNIQ': 126, - 'EBADFD': 127, - 'EREMCHG': 128, - 'ELIBACC': 129, - 'ELIBBAD': 130, - 'ELIBSCN': 131, - 'ELIBMAX': 132, - 'ELIBEXEC': 133, - 'ENOSYS': 52, - 'ENOTEMPTY': 55, - 'ENAMETOOLONG': 37, - 'ELOOP': 32, - 'EOPNOTSUPP': 138, - 'EPFNOSUPPORT': 139, - 'ECONNRESET': 15, - 'ENOBUFS': 42, - 'EAFNOSUPPORT': 5, - 'EPROTOTYPE': 67, - 'ENOTSOCK': 57, - 'ENOPROTOOPT': 50, - 'ESHUTDOWN': 140, - 'ECONNREFUSED': 14, - 'EADDRINUSE': 3, - 'ECONNABORTED': 13, - 'ENETUNREACH': 40, - 'ENETDOWN': 38, - 'ETIMEDOUT': 73, - 'EHOSTDOWN': 142, - 'EHOSTUNREACH': 23, - 'EINPROGRESS': 26, - 'EALREADY': 7, - 'EDESTADDRREQ': 17, - 'EMSGSIZE': 35, - 'EPROTONOSUPPORT': 66, - 'ESOCKTNOSUPPORT': 137, - 'EADDRNOTAVAIL': 4, - 'ENETRESET': 39, - 'EISCONN': 30, - 'ENOTCONN': 53, - 'ETOOMANYREFS': 141, - 'EUSERS': 136, - 'EDQUOT': 19, - 'ESTALE': 72, - 'ENOTSUP': 138, - 'ENOMEDIUM': 148, - 'EILSEQ': 25, - 'EOVERFLOW': 61, - 'ECANCELED': 11, - 'ENOTRECOVERABLE': 56, - 'EOWNERDEAD': 62, - 'ESTRPIPE': 135, - };; embind_init_charCodes(); BindingError = Module['BindingError'] = extendError(Error, 'BindingError');; InternalError = Module['InternalError'] = extendError(Error, 'InternalError');; @@ -7224,7 +6748,7 @@ init_embind();; init_RegisteredPointer(); UnboundTypeError = Module['UnboundTypeError'] = extendError(Error, 'UnboundTypeError');; init_emval();; -var ASSERTIONS = true; +var ASSERTIONS = false; @@ -7253,9 +6777,6 @@ function intArrayToString(array) { } -function checkIncomingModuleAPI() { - ignoredModuleProp('fetchSettings'); -} var asmLibraryArg = { "__assert_fail": ___assert_fail, "__call_sighandler": ___call_sighandler, @@ -7300,7 +6821,6 @@ var asmLibraryArg = { "_mmap_js": __mmap_js, "_munmap_js": __munmap_js, "abort": _abort, - "emscripten_console_error": _emscripten_console_error, "emscripten_memcpy_big": _emscripten_memcpy_big, "emscripten_resize_heap": _emscripten_resize_heap, "environ_get": _environ_get, @@ -7341,120 +6861,159 @@ var asmLibraryArg = { }; var asm = createWasm(); /** @type {function(...*):?} */ -var ___wasm_call_ctors = Module["___wasm_call_ctors"] = createExportWrapper("__wasm_call_ctors"); - -/** @type {function(...*):?} */ -var _main = Module["_main"] = createExportWrapper("main"); - -/** @type {function(...*):?} */ -var _malloc = Module["_malloc"] = createExportWrapper("malloc"); - -/** @type {function(...*):?} */ -var ___errno_location = Module["___errno_location"] = createExportWrapper("__errno_location"); - -/** @type {function(...*):?} */ -var _free = Module["_free"] = createExportWrapper("free"); - -/** @type {function(...*):?} */ -var ___getTypeName = Module["___getTypeName"] = createExportWrapper("__getTypeName"); - -/** @type {function(...*):?} */ -var ___embind_register_native_and_builtin_types = Module["___embind_register_native_and_builtin_types"] = createExportWrapper("__embind_register_native_and_builtin_types"); - -/** @type {function(...*):?} */ -var ___dl_seterr = Module["___dl_seterr"] = createExportWrapper("__dl_seterr"); - -/** @type {function(...*):?} */ -var _fflush = Module["_fflush"] = createExportWrapper("fflush"); - -/** @type {function(...*):?} */ -var _emscripten_builtin_memalign = Module["_emscripten_builtin_memalign"] = createExportWrapper("emscripten_builtin_memalign"); - -/** @type {function(...*):?} */ -var _setThrew = Module["_setThrew"] = createExportWrapper("setThrew"); - -/** @type {function(...*):?} */ -var _emscripten_stack_init = Module["_emscripten_stack_init"] = function() { - return (_emscripten_stack_init = Module["_emscripten_stack_init"] = Module["asm"]["emscripten_stack_init"]).apply(null, arguments); +var ___wasm_call_ctors = Module["___wasm_call_ctors"] = function() { + return (___wasm_call_ctors = Module["___wasm_call_ctors"] = Module["asm"]["__wasm_call_ctors"]).apply(null, arguments); }; /** @type {function(...*):?} */ -var _emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = function() { - return (_emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = Module["asm"]["emscripten_stack_get_free"]).apply(null, arguments); +var _main = Module["_main"] = function() { + return (_main = Module["_main"] = Module["asm"]["main"]).apply(null, arguments); }; /** @type {function(...*):?} */ -var _emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = function() { - return (_emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = Module["asm"]["emscripten_stack_get_base"]).apply(null, arguments); +var _malloc = Module["_malloc"] = function() { + return (_malloc = Module["_malloc"] = Module["asm"]["malloc"]).apply(null, arguments); }; /** @type {function(...*):?} */ -var _emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = function() { - return (_emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = Module["asm"]["emscripten_stack_get_end"]).apply(null, arguments); +var ___errno_location = Module["___errno_location"] = function() { + return (___errno_location = Module["___errno_location"] = Module["asm"]["__errno_location"]).apply(null, arguments); }; /** @type {function(...*):?} */ -var stackSave = Module["stackSave"] = createExportWrapper("stackSave"); +var _free = Module["_free"] = function() { + return (_free = Module["_free"] = Module["asm"]["free"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var stackRestore = Module["stackRestore"] = createExportWrapper("stackRestore"); +var ___getTypeName = Module["___getTypeName"] = function() { + return (___getTypeName = Module["___getTypeName"] = Module["asm"]["__getTypeName"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var stackAlloc = Module["stackAlloc"] = createExportWrapper("stackAlloc"); +var ___embind_register_native_and_builtin_types = Module["___embind_register_native_and_builtin_types"] = function() { + return (___embind_register_native_and_builtin_types = Module["___embind_register_native_and_builtin_types"] = Module["asm"]["__embind_register_native_and_builtin_types"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var ___cxa_demangle = Module["___cxa_demangle"] = createExportWrapper("__cxa_demangle"); +var ___dl_seterr = Module["___dl_seterr"] = function() { + return (___dl_seterr = Module["___dl_seterr"] = Module["asm"]["__dl_seterr"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var ___cxa_can_catch = Module["___cxa_can_catch"] = createExportWrapper("__cxa_can_catch"); +var _emscripten_builtin_memalign = Module["_emscripten_builtin_memalign"] = function() { + return (_emscripten_builtin_memalign = Module["_emscripten_builtin_memalign"] = Module["asm"]["emscripten_builtin_memalign"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var ___cxa_is_pointer_type = Module["___cxa_is_pointer_type"] = createExportWrapper("__cxa_is_pointer_type"); +var _setThrew = Module["_setThrew"] = function() { + return (_setThrew = Module["_setThrew"] = Module["asm"]["setThrew"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_ji = Module["dynCall_ji"] = createExportWrapper("dynCall_ji"); +var stackSave = Module["stackSave"] = function() { + return (stackSave = Module["stackSave"] = Module["asm"]["stackSave"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_viijj = Module["dynCall_viijj"] = createExportWrapper("dynCall_viijj"); +var stackRestore = Module["stackRestore"] = function() { + return (stackRestore = Module["stackRestore"] = Module["asm"]["stackRestore"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_iij = Module["dynCall_iij"] = createExportWrapper("dynCall_iij"); +var stackAlloc = Module["stackAlloc"] = function() { + return (stackAlloc = Module["stackAlloc"] = Module["asm"]["stackAlloc"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_iijj = Module["dynCall_iijj"] = createExportWrapper("dynCall_iijj"); +var ___cxa_demangle = Module["___cxa_demangle"] = function() { + return (___cxa_demangle = Module["___cxa_demangle"] = Module["asm"]["__cxa_demangle"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_viij = Module["dynCall_viij"] = createExportWrapper("dynCall_viij"); +var ___cxa_can_catch = Module["___cxa_can_catch"] = function() { + return (___cxa_can_catch = Module["___cxa_can_catch"] = Module["asm"]["__cxa_can_catch"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_ij = Module["dynCall_ij"] = createExportWrapper("dynCall_ij"); +var ___cxa_is_pointer_type = Module["___cxa_is_pointer_type"] = function() { + return (___cxa_is_pointer_type = Module["___cxa_is_pointer_type"] = Module["asm"]["__cxa_is_pointer_type"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_iiiji = Module["dynCall_iiiji"] = createExportWrapper("dynCall_iiiji"); +var dynCall_ji = Module["dynCall_ji"] = function() { + return (dynCall_ji = Module["dynCall_ji"] = Module["asm"]["dynCall_ji"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_iiiij = Module["dynCall_iiiij"] = createExportWrapper("dynCall_iiiij"); +var dynCall_viijj = Module["dynCall_viijj"] = function() { + return (dynCall_viijj = Module["dynCall_viijj"] = Module["asm"]["dynCall_viijj"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_vij = Module["dynCall_vij"] = createExportWrapper("dynCall_vij"); +var dynCall_iij = Module["dynCall_iij"] = function() { + return (dynCall_iij = Module["dynCall_iij"] = Module["asm"]["dynCall_iij"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_jiji = Module["dynCall_jiji"] = createExportWrapper("dynCall_jiji"); +var dynCall_iijj = Module["dynCall_iijj"] = function() { + return (dynCall_iijj = Module["dynCall_iijj"] = Module["asm"]["dynCall_iijj"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_iiiiij = Module["dynCall_iiiiij"] = createExportWrapper("dynCall_iiiiij"); +var dynCall_viij = Module["dynCall_viij"] = function() { + return (dynCall_viij = Module["dynCall_viij"] = Module["asm"]["dynCall_viij"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_viijii = Module["dynCall_viijii"] = createExportWrapper("dynCall_viijii"); +var dynCall_ij = Module["dynCall_ij"] = function() { + return (dynCall_ij = Module["dynCall_ij"] = Module["asm"]["dynCall_ij"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_jiiii = Module["dynCall_jiiii"] = createExportWrapper("dynCall_jiiii"); +var dynCall_iiiji = Module["dynCall_iiiji"] = function() { + return (dynCall_iiiji = Module["dynCall_iiiji"] = Module["asm"]["dynCall_iiiji"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_iiiiijj = Module["dynCall_iiiiijj"] = createExportWrapper("dynCall_iiiiijj"); +var dynCall_iiiij = Module["dynCall_iiiij"] = function() { + return (dynCall_iiiij = Module["dynCall_iiiij"] = Module["asm"]["dynCall_iiiij"]).apply(null, arguments); +}; /** @type {function(...*):?} */ -var dynCall_iiiiiijj = Module["dynCall_iiiiiijj"] = createExportWrapper("dynCall_iiiiiijj"); +var dynCall_vij = Module["dynCall_vij"] = function() { + return (dynCall_vij = Module["dynCall_vij"] = Module["asm"]["dynCall_vij"]).apply(null, arguments); +}; + +/** @type {function(...*):?} */ +var dynCall_jiji = Module["dynCall_jiji"] = function() { + return (dynCall_jiji = Module["dynCall_jiji"] = Module["asm"]["dynCall_jiji"]).apply(null, arguments); +}; + +/** @type {function(...*):?} */ +var dynCall_iiiiij = Module["dynCall_iiiiij"] = function() { + return (dynCall_iiiiij = Module["dynCall_iiiiij"] = Module["asm"]["dynCall_iiiiij"]).apply(null, arguments); +}; + +/** @type {function(...*):?} */ +var dynCall_viijii = Module["dynCall_viijii"] = function() { + return (dynCall_viijii = Module["dynCall_viijii"] = Module["asm"]["dynCall_viijii"]).apply(null, arguments); +}; + +/** @type {function(...*):?} */ +var dynCall_jiiii = Module["dynCall_jiiii"] = function() { + return (dynCall_jiiii = Module["dynCall_jiiii"] = Module["asm"]["dynCall_jiiii"]).apply(null, arguments); +}; + +/** @type {function(...*):?} */ +var dynCall_iiiiijj = Module["dynCall_iiiiijj"] = function() { + return (dynCall_iiiiijj = Module["dynCall_iiiiijj"] = Module["asm"]["dynCall_iiiiijj"]).apply(null, arguments); +}; + +/** @type {function(...*):?} */ +var dynCall_iiiiiijj = Module["dynCall_iiiiiijj"] = function() { + return (dynCall_iiiiiijj = Module["dynCall_iiiiiijj"] = Module["asm"]["dynCall_iiiiiijj"]).apply(null, arguments); +}; function invoke_iii(index,a1,a2) { @@ -7468,17 +7027,6 @@ function invoke_iii(index,a1,a2) { } } -function invoke_viii(index,a1,a2,a3) { - var sp = stackSave(); - try { - getWasmTableEntry(index)(a1,a2,a3); - } catch(e) { - stackRestore(sp); - if (e !== e+0) throw e; - _setThrew(1, 0); - } -} - function invoke_ii(index,a1) { var sp = stackSave(); try { @@ -7490,10 +7038,10 @@ function invoke_ii(index,a1) { } } -function invoke_v(index) { +function invoke_viii(index,a1,a2,a3) { var sp = stackSave(); try { - getWasmTableEntry(index)(); + getWasmTableEntry(index)(a1,a2,a3); } catch(e) { stackRestore(sp); if (e !== e+0) throw e; @@ -7512,6 +7060,17 @@ function invoke_iiii(index,a1,a2,a3) { } } +function invoke_v(index) { + var sp = stackSave(); + try { + getWasmTableEntry(index)(); + } catch(e) { + stackRestore(sp); + if (e !== e+0) throw e; + _setThrew(1, 0); + } +} + function invoke_viiii(index,a1,a2,a3,a4) { var sp = stackSave(); try { @@ -7715,327 +7274,8 @@ function invoke_jiiii(index,a1,a2,a3,a4) { // === Auto-generated postamble setup entry stuff === -unexportedRuntimeFunction('ccall', false); -unexportedRuntimeFunction('cwrap', false); -unexportedRuntimeFunction('allocate', false); -unexportedRuntimeFunction('UTF8ArrayToString', false); -unexportedRuntimeFunction('UTF8ToString', false); -unexportedRuntimeFunction('stringToUTF8Array', false); -unexportedRuntimeFunction('stringToUTF8', false); -unexportedRuntimeFunction('lengthBytesUTF8', false); -unexportedRuntimeFunction('addOnPreRun', false); -unexportedRuntimeFunction('addOnInit', false); -unexportedRuntimeFunction('addOnPreMain', false); -unexportedRuntimeFunction('addOnExit', false); -unexportedRuntimeFunction('addOnPostRun', false); -unexportedRuntimeFunction('addRunDependency', true); -unexportedRuntimeFunction('removeRunDependency', true); -unexportedRuntimeFunction('FS_createFolder', false); -unexportedRuntimeFunction('FS_createPath', true); -unexportedRuntimeFunction('FS_createDataFile', true); -unexportedRuntimeFunction('FS_createPreloadedFile', true); -unexportedRuntimeFunction('FS_createLazyFile', true); -unexportedRuntimeFunction('FS_createLink', false); -unexportedRuntimeFunction('FS_createDevice', true); -unexportedRuntimeFunction('FS_unlink', true); -unexportedRuntimeFunction('getLEB', false); -unexportedRuntimeFunction('getFunctionTables', false); -unexportedRuntimeFunction('alignFunctionTables', false); -unexportedRuntimeFunction('registerFunctions', false); -unexportedRuntimeFunction('addFunction', false); -unexportedRuntimeFunction('removeFunction', false); -unexportedRuntimeFunction('prettyPrint', false); -unexportedRuntimeFunction('getCompilerSetting', false); Module["print"] = out; Module["printErr"] = err; -unexportedRuntimeFunction('getTempRet0', false); -unexportedRuntimeFunction('setTempRet0', false); -unexportedRuntimeFunction('callMain', false); -unexportedRuntimeFunction('abort', false); -unexportedRuntimeFunction('keepRuntimeAlive', false); -unexportedRuntimeFunction('wasmMemory', false); -unexportedRuntimeFunction('warnOnce', false); -unexportedRuntimeFunction('stackSave', false); -unexportedRuntimeFunction('stackRestore', false); -unexportedRuntimeFunction('stackAlloc', false); -unexportedRuntimeFunction('AsciiToString', false); -unexportedRuntimeFunction('stringToAscii', false); -unexportedRuntimeFunction('UTF16ToString', false); -unexportedRuntimeFunction('stringToUTF16', false); -unexportedRuntimeFunction('lengthBytesUTF16', false); -unexportedRuntimeFunction('UTF32ToString', false); -unexportedRuntimeFunction('stringToUTF32', false); -unexportedRuntimeFunction('lengthBytesUTF32', false); -unexportedRuntimeFunction('allocateUTF8', false); -unexportedRuntimeFunction('allocateUTF8OnStack', false); -unexportedRuntimeFunction('ExitStatus', false); -unexportedRuntimeFunction('intArrayFromString', false); -unexportedRuntimeFunction('intArrayToString', false); -unexportedRuntimeFunction('writeStringToMemory', false); -unexportedRuntimeFunction('writeArrayToMemory', false); -unexportedRuntimeFunction('writeAsciiToMemory', false); -Module["writeStackCookie"] = writeStackCookie; -Module["checkStackCookie"] = checkStackCookie; -unexportedRuntimeFunction('ptrToString', false); -unexportedRuntimeFunction('zeroMemory', false); -unexportedRuntimeFunction('stringToNewUTF8', false); -unexportedRuntimeFunction('getHeapMax', false); -unexportedRuntimeFunction('emscripten_realloc_buffer', false); -unexportedRuntimeFunction('ENV', false); -unexportedRuntimeFunction('ERRNO_CODES', false); -unexportedRuntimeFunction('ERRNO_MESSAGES', false); -unexportedRuntimeFunction('setErrNo', false); -unexportedRuntimeFunction('inetPton4', false); -unexportedRuntimeFunction('inetNtop4', false); -unexportedRuntimeFunction('inetPton6', false); -unexportedRuntimeFunction('inetNtop6', false); -unexportedRuntimeFunction('readSockaddr', false); -unexportedRuntimeFunction('writeSockaddr', false); -unexportedRuntimeFunction('DNS', false); -unexportedRuntimeFunction('getHostByName', false); -unexportedRuntimeFunction('Protocols', false); -unexportedRuntimeFunction('Sockets', false); -unexportedRuntimeFunction('getRandomDevice', false); -unexportedRuntimeFunction('traverseStack', false); -unexportedRuntimeFunction('UNWIND_CACHE', false); -unexportedRuntimeFunction('convertPCtoSourceLocation', false); -unexportedRuntimeFunction('readAsmConstArgsArray', false); -unexportedRuntimeFunction('readAsmConstArgs', false); -unexportedRuntimeFunction('mainThreadEM_ASM', false); -unexportedRuntimeFunction('jstoi_q', false); -unexportedRuntimeFunction('jstoi_s', false); -unexportedRuntimeFunction('getExecutableName', false); -unexportedRuntimeFunction('listenOnce', false); -unexportedRuntimeFunction('autoResumeAudioContext', false); -unexportedRuntimeFunction('dynCallLegacy', false); -unexportedRuntimeFunction('getDynCaller', false); -unexportedRuntimeFunction('dynCall', false); -unexportedRuntimeFunction('handleException', false); -unexportedRuntimeFunction('runtimeKeepalivePush', false); -unexportedRuntimeFunction('runtimeKeepalivePop', false); -unexportedRuntimeFunction('callUserCallback', false); -unexportedRuntimeFunction('maybeExit', false); -unexportedRuntimeFunction('safeSetTimeout', false); -unexportedRuntimeFunction('asmjsMangle', false); -unexportedRuntimeFunction('asyncLoad', false); -unexportedRuntimeFunction('alignMemory', false); -unexportedRuntimeFunction('mmapAlloc', false); -unexportedRuntimeFunction('writeI53ToI64', false); -unexportedRuntimeFunction('writeI53ToI64Clamped', false); -unexportedRuntimeFunction('writeI53ToI64Signaling', false); -unexportedRuntimeFunction('writeI53ToU64Clamped', false); -unexportedRuntimeFunction('writeI53ToU64Signaling', false); -unexportedRuntimeFunction('readI53FromI64', false); -unexportedRuntimeFunction('readI53FromU64', false); -unexportedRuntimeFunction('convertI32PairToI53', false); -unexportedRuntimeFunction('convertI32PairToI53Checked', false); -unexportedRuntimeFunction('convertU32PairToI53', false); -unexportedRuntimeFunction('reallyNegative', false); -unexportedRuntimeFunction('unSign', false); -unexportedRuntimeFunction('strLen', false); -unexportedRuntimeFunction('reSign', false); -unexportedRuntimeFunction('formatString', false); -unexportedRuntimeFunction('setValue', false); -unexportedRuntimeFunction('getValue', false); -unexportedRuntimeFunction('PATH', false); -unexportedRuntimeFunction('PATH_FS', false); -unexportedRuntimeFunction('SYSCALLS', false); -unexportedRuntimeFunction('getSocketFromFD', false); -unexportedRuntimeFunction('getSocketAddress', false); -unexportedRuntimeFunction('JSEvents', false); -unexportedRuntimeFunction('registerKeyEventCallback', false); -unexportedRuntimeFunction('specialHTMLTargets', false); -unexportedRuntimeFunction('maybeCStringToJsString', false); -unexportedRuntimeFunction('findEventTarget', false); -unexportedRuntimeFunction('findCanvasEventTarget', false); -unexportedRuntimeFunction('getBoundingClientRect', false); -unexportedRuntimeFunction('fillMouseEventData', false); -unexportedRuntimeFunction('registerMouseEventCallback', false); -unexportedRuntimeFunction('registerWheelEventCallback', false); -unexportedRuntimeFunction('registerUiEventCallback', false); -unexportedRuntimeFunction('registerFocusEventCallback', false); -unexportedRuntimeFunction('fillDeviceOrientationEventData', false); -unexportedRuntimeFunction('registerDeviceOrientationEventCallback', false); -unexportedRuntimeFunction('fillDeviceMotionEventData', false); -unexportedRuntimeFunction('registerDeviceMotionEventCallback', false); -unexportedRuntimeFunction('screenOrientation', false); -unexportedRuntimeFunction('fillOrientationChangeEventData', false); -unexportedRuntimeFunction('registerOrientationChangeEventCallback', false); -unexportedRuntimeFunction('fillFullscreenChangeEventData', false); -unexportedRuntimeFunction('registerFullscreenChangeEventCallback', false); -unexportedRuntimeFunction('JSEvents_requestFullscreen', false); -unexportedRuntimeFunction('JSEvents_resizeCanvasForFullscreen', false); -unexportedRuntimeFunction('registerRestoreOldStyle', false); -unexportedRuntimeFunction('hideEverythingExceptGivenElement', false); -unexportedRuntimeFunction('restoreHiddenElements', false); -unexportedRuntimeFunction('setLetterbox', false); -unexportedRuntimeFunction('currentFullscreenStrategy', false); -unexportedRuntimeFunction('restoreOldWindowedStyle', false); -unexportedRuntimeFunction('softFullscreenResizeWebGLRenderTarget', false); -unexportedRuntimeFunction('doRequestFullscreen', false); -unexportedRuntimeFunction('fillPointerlockChangeEventData', false); -unexportedRuntimeFunction('registerPointerlockChangeEventCallback', false); -unexportedRuntimeFunction('registerPointerlockErrorEventCallback', false); -unexportedRuntimeFunction('requestPointerLock', false); -unexportedRuntimeFunction('fillVisibilityChangeEventData', false); -unexportedRuntimeFunction('registerVisibilityChangeEventCallback', false); -unexportedRuntimeFunction('registerTouchEventCallback', false); -unexportedRuntimeFunction('fillGamepadEventData', false); -unexportedRuntimeFunction('registerGamepadEventCallback', false); -unexportedRuntimeFunction('registerBeforeUnloadEventCallback', false); -unexportedRuntimeFunction('fillBatteryEventData', false); -unexportedRuntimeFunction('battery', false); -unexportedRuntimeFunction('registerBatteryEventCallback', false); -unexportedRuntimeFunction('setCanvasElementSize', false); -unexportedRuntimeFunction('getCanvasElementSize', false); -unexportedRuntimeFunction('demangle', false); -unexportedRuntimeFunction('demangleAll', false); -unexportedRuntimeFunction('jsStackTrace', false); -unexportedRuntimeFunction('stackTrace', false); -unexportedRuntimeFunction('getEnvStrings', false); -unexportedRuntimeFunction('checkWasiClock', false); -unexportedRuntimeFunction('doReadv', false); -unexportedRuntimeFunction('doWritev', false); -unexportedRuntimeFunction('dlopenMissingError', false); -unexportedRuntimeFunction('setImmediateWrapped', false); -unexportedRuntimeFunction('clearImmediateWrapped', false); -unexportedRuntimeFunction('polyfillSetImmediate', false); -unexportedRuntimeFunction('uncaughtExceptionCount', false); -unexportedRuntimeFunction('exceptionLast', false); -unexportedRuntimeFunction('exceptionCaught', false); -unexportedRuntimeFunction('ExceptionInfo', false); -unexportedRuntimeFunction('exception_addRef', false); -unexportedRuntimeFunction('exception_decRef', false); -unexportedRuntimeFunction('getExceptionMessage', false); -unexportedRuntimeFunction('Browser', false); -unexportedRuntimeFunction('setMainLoop', false); -unexportedRuntimeFunction('wget', false); -unexportedRuntimeFunction('FS', false); -unexportedRuntimeFunction('MEMFS', false); -unexportedRuntimeFunction('TTY', false); -unexportedRuntimeFunction('PIPEFS', false); -unexportedRuntimeFunction('SOCKFS', false); -unexportedRuntimeFunction('_setNetworkCallback', false); -unexportedRuntimeFunction('tempFixedLengthArray', false); -unexportedRuntimeFunction('miniTempWebGLFloatBuffers', false); -unexportedRuntimeFunction('heapObjectForWebGLType', false); -unexportedRuntimeFunction('heapAccessShiftForWebGLHeap', false); -unexportedRuntimeFunction('GL', false); -unexportedRuntimeFunction('emscriptenWebGLGet', false); -unexportedRuntimeFunction('computeUnpackAlignedImageSize', false); -unexportedRuntimeFunction('emscriptenWebGLGetTexPixelData', false); -unexportedRuntimeFunction('emscriptenWebGLGetUniform', false); -unexportedRuntimeFunction('webglGetUniformLocation', false); -unexportedRuntimeFunction('webglPrepareUniformLocationsBeforeFirstUse', false); -unexportedRuntimeFunction('webglGetLeftBracePos', false); -unexportedRuntimeFunction('emscriptenWebGLGetVertexAttrib', false); -unexportedRuntimeFunction('writeGLArray', false); -unexportedRuntimeFunction('AL', false); -unexportedRuntimeFunction('SDL_unicode', false); -unexportedRuntimeFunction('SDL_ttfContext', false); -unexportedRuntimeFunction('SDL_audio', false); -unexportedRuntimeFunction('SDL', false); -unexportedRuntimeFunction('SDL_gfx', false); -unexportedRuntimeFunction('GLUT', false); -unexportedRuntimeFunction('EGL', false); -unexportedRuntimeFunction('GLFW_Window', false); -unexportedRuntimeFunction('GLFW', false); -unexportedRuntimeFunction('GLEW', false); -unexportedRuntimeFunction('IDBStore', false); -unexportedRuntimeFunction('runAndAbortIfError', false); -unexportedRuntimeFunction('InternalError', false); -unexportedRuntimeFunction('BindingError', false); -unexportedRuntimeFunction('UnboundTypeError', false); -unexportedRuntimeFunction('PureVirtualError', false); -unexportedRuntimeFunction('init_embind', false); -unexportedRuntimeFunction('throwInternalError', false); -unexportedRuntimeFunction('throwBindingError', false); -unexportedRuntimeFunction('throwUnboundTypeError', false); -unexportedRuntimeFunction('ensureOverloadTable', false); -unexportedRuntimeFunction('exposePublicSymbol', false); -unexportedRuntimeFunction('replacePublicSymbol', false); -unexportedRuntimeFunction('extendError', false); -unexportedRuntimeFunction('createNamedFunction', false); -unexportedRuntimeFunction('registeredInstances', false); -unexportedRuntimeFunction('getBasestPointer', false); -unexportedRuntimeFunction('registerInheritedInstance', false); -unexportedRuntimeFunction('unregisterInheritedInstance', false); -unexportedRuntimeFunction('getInheritedInstance', false); -unexportedRuntimeFunction('getInheritedInstanceCount', false); -unexportedRuntimeFunction('getLiveInheritedInstances', false); -unexportedRuntimeFunction('registeredTypes', false); -unexportedRuntimeFunction('awaitingDependencies', false); -unexportedRuntimeFunction('typeDependencies', false); -unexportedRuntimeFunction('registeredPointers', false); -unexportedRuntimeFunction('registerType', false); -unexportedRuntimeFunction('whenDependentTypesAreResolved', false); -unexportedRuntimeFunction('embind_charCodes', false); -unexportedRuntimeFunction('embind_init_charCodes', false); -unexportedRuntimeFunction('readLatin1String', false); -unexportedRuntimeFunction('getTypeName', false); -unexportedRuntimeFunction('heap32VectorToArray', false); -unexportedRuntimeFunction('requireRegisteredType', false); -unexportedRuntimeFunction('getShiftFromSize', false); -unexportedRuntimeFunction('integerReadValueFromPointer', false); -unexportedRuntimeFunction('enumReadValueFromPointer', false); -unexportedRuntimeFunction('floatReadValueFromPointer', false); -unexportedRuntimeFunction('simpleReadValueFromPointer', false); -unexportedRuntimeFunction('runDestructors', false); -unexportedRuntimeFunction('new_', false); -unexportedRuntimeFunction('craftInvokerFunction', false); -unexportedRuntimeFunction('embind__requireFunction', false); -unexportedRuntimeFunction('tupleRegistrations', false); -unexportedRuntimeFunction('structRegistrations', false); -unexportedRuntimeFunction('genericPointerToWireType', false); -unexportedRuntimeFunction('constNoSmartPtrRawPointerToWireType', false); -unexportedRuntimeFunction('nonConstNoSmartPtrRawPointerToWireType', false); -unexportedRuntimeFunction('init_RegisteredPointer', false); -unexportedRuntimeFunction('RegisteredPointer', false); -unexportedRuntimeFunction('RegisteredPointer_getPointee', false); -unexportedRuntimeFunction('RegisteredPointer_destructor', false); -unexportedRuntimeFunction('RegisteredPointer_deleteObject', false); -unexportedRuntimeFunction('RegisteredPointer_fromWireType', false); -unexportedRuntimeFunction('runDestructor', false); -unexportedRuntimeFunction('releaseClassHandle', false); -unexportedRuntimeFunction('finalizationRegistry', false); -unexportedRuntimeFunction('detachFinalizer_deps', false); -unexportedRuntimeFunction('detachFinalizer', false); -unexportedRuntimeFunction('attachFinalizer', false); -unexportedRuntimeFunction('makeClassHandle', false); -unexportedRuntimeFunction('init_ClassHandle', false); -unexportedRuntimeFunction('ClassHandle', false); -unexportedRuntimeFunction('ClassHandle_isAliasOf', false); -unexportedRuntimeFunction('throwInstanceAlreadyDeleted', false); -unexportedRuntimeFunction('ClassHandle_clone', false); -unexportedRuntimeFunction('ClassHandle_delete', false); -unexportedRuntimeFunction('deletionQueue', false); -unexportedRuntimeFunction('ClassHandle_isDeleted', false); -unexportedRuntimeFunction('ClassHandle_deleteLater', false); -unexportedRuntimeFunction('flushPendingDeletes', false); -unexportedRuntimeFunction('delayFunction', false); -unexportedRuntimeFunction('setDelayFunction', false); -unexportedRuntimeFunction('RegisteredClass', false); -unexportedRuntimeFunction('shallowCopyInternalPointer', false); -unexportedRuntimeFunction('downcastPointer', false); -unexportedRuntimeFunction('upcastPointer', false); -unexportedRuntimeFunction('validateThis', false); -unexportedRuntimeFunction('char_0', false); -unexportedRuntimeFunction('char_9', false); -unexportedRuntimeFunction('makeLegalFunctionName', false); -unexportedRuntimeFunction('emval_handle_array', false); -unexportedRuntimeFunction('emval_free_list', false); -unexportedRuntimeFunction('emval_symbols', false); -unexportedRuntimeFunction('init_emval', false); -unexportedRuntimeFunction('count_emval_handles', false); -unexportedRuntimeFunction('get_first_emval', false); -unexportedRuntimeFunction('getStringOrSymbol', false); -unexportedRuntimeFunction('Emval', false); -unexportedRuntimeFunction('emval_newers', false); -unexportedRuntimeFunction('craftEmvalAllocator', false); -unexportedRuntimeFunction('emval_get_global', false); -unexportedRuntimeFunction('emval_methodCallers', false); -unexportedRuntimeFunction('emval_registeredMethods', false); -unexportedRuntimeFunction('WORKERFS', false); Module["ALLOC_NORMAL"] = ALLOC_NORMAL; Module["ALLOC_STACK"] = ALLOC_STACK; @@ -8060,8 +7300,6 @@ dependenciesFulfilled = function runCaller() { }; function callMain(args) { - assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); - assert(__ATPRERUN__.length == 0, 'cannot call main when preRun functions remain to be called'); var entryFunction = Module['_main']; @@ -8094,15 +7332,6 @@ function callMain(args) { } } -function stackCheckInit() { - // This is normally called automatically during __wasm_call_ctors but need to - // get these values before even running any of the ctors so we call it redundantly - // here. - // TODO(sbc): Move writeStackCookie to native to to avoid this. - _emscripten_stack_init(); - writeStackCookie(); -} - /** @type {function(Array=)} */ function run(args) { args = args || arguments_; @@ -8111,8 +7340,6 @@ function run(args) { return; } - stackCheckInit(); - preRun(); // a preRun added a dependency, run will be called later @@ -8152,61 +7379,13 @@ function run(args) { { doRun(); } - checkStackCookie(); } Module['run'] = run; -function checkUnflushedContent() { - // Compiler settings do not allow exiting the runtime, so flushing - // the streams is not possible. but in ASSERTIONS mode we check - // if there was something to flush, and if so tell the user they - // should request that the runtime be exitable. - // Normally we would not even include flush() at all, but in ASSERTIONS - // builds we do so just for this check, and here we see if there is any - // content to flush, that is, we check if there would have been - // something a non-ASSERTIONS build would have not seen. - // How we flush the streams depends on whether we are in SYSCALLS_REQUIRE_FILESYSTEM=0 - // mode (which has its own special function for this; otherwise, all - // the code is inside libc) - var oldOut = out; - var oldErr = err; - var has = false; - out = err = (x) => { - has = true; - } - try { // it doesn't matter if it fails - _fflush(0); - // also flush in the JS FS layer - ['stdout', 'stderr'].forEach(function(name) { - var info = FS.analyzePath('/dev/' + name); - if (!info) return; - var stream = info.object; - var rdev = stream.rdev; - var tty = TTY.ttys[rdev]; - if (tty && tty.output && tty.output.length) { - has = true; - } - }); - } catch(e) {} - out = oldOut; - err = oldErr; - if (has) { - warnOnce('stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc.'); - } -} - /** @param {boolean|number=} implicit */ function exit(status, implicit) { EXITSTATUS = status; - checkUnflushedContent(); - - // if exit() was called explicitly, warn the user if the runtime isn't actually being shut down - if (keepRuntimeAlive() && !implicit) { - var msg = 'program exited (with status: ' + status + '), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)'; - err(msg); - } - procExit(status); } diff --git a/www/js/lib/libzim-wasm.wasm.REMOVED.git-id b/www/js/lib/libzim-wasm.wasm.REMOVED.git-id index a675f15a..bf61f0b7 100644 --- a/www/js/lib/libzim-wasm.wasm.REMOVED.git-id +++ b/www/js/lib/libzim-wasm.wasm.REMOVED.git-id @@ -1 +1 @@ -f453d75e8c46f154c3b1f0a659db2249069688bd \ No newline at end of file +7c7199a5aab0bb04587d98e1f0abe5c03ec2c004 \ No newline at end of file