diff --git a/public/assets/salam/salam-wa.js b/public/assets/salam/salam-wa.js index 87694ee..86b04dd 100644 --- a/public/assets/salam/salam-wa.js +++ b/public/assets/salam/salam-wa.js @@ -19,7 +19,7 @@ var Module = typeof Module != 'undefined' ? Module : {}; // Attempt to auto-detect the environment var ENVIRONMENT_IS_WEB = typeof window == 'object'; -var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function'; +var ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope != 'undefined'; // N.b. Electron.js environment is simultaneously a NODE-environment, but // also a web environment. var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string' && process.type != 'renderer'; @@ -119,7 +119,7 @@ readAsync = (filename, binary = true) => { } 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 process == 'object' && typeof require === 'function') || typeof window == 'object' || typeof WorkerGlobalScope != 'undefined') 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?)'); } else @@ -144,7 +144,7 @@ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, '').lastIndexOf('/')+1); } - 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?)'); + if (!(typeof window == 'object' || typeof WorkerGlobalScope != 'undefined')) 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?)'); { // include: web_or_worker_shell_read.js @@ -384,10 +384,11 @@ var __ATPOSTRUN__ = []; // functions called after the main() is called var runtimeInitialized = false; function preRun() { - var preRuns = Module['preRun']; - if (preRuns) { - if (typeof preRuns == 'function') preRuns = [preRuns]; - preRuns.forEach(addOnPreRun); + if (Module['preRun']) { + if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']]; + while (Module['preRun'].length) { + addOnPreRun(Module['preRun'].shift()); + } } callRuntimeCallbacks(__ATPRERUN__); } @@ -416,10 +417,11 @@ function preMain() { function postRun() { checkStackCookie(); - var postRuns = Module['postRun']; - if (postRuns) { - if (typeof postRuns == 'function') postRuns = [postRuns]; - postRuns.forEach(addOnPostRun); + if (Module['postRun']) { + if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']]; + while (Module['postRun'].length) { + addOnPostRun(Module['postRun'].shift()); + } } callRuntimeCallbacks(__ATPOSTRUN__); @@ -881,16 +883,19 @@ function dbg(...args) { // end include: preamble.js - /** @constructor */ - function ExitStatus(status) { - this.name = 'ExitStatus'; - this.message = `Program terminated with exit(${status})`; - this.status = status; + class ExitStatus { + name = 'ExitStatus'; + constructor(status) { + this.message = `Program terminated with exit(${status})`; + this.status = status; + } } var callRuntimeCallbacks = (callbacks) => { - // Pass the module as the first argument. - callbacks.forEach((f) => f(Module)); + while (callbacks.length > 0) { + // Pass the module as the first argument. + callbacks.shift()(Module); + } }; @@ -957,13 +962,13 @@ function dbg(...args) { }; /** @suppress {duplicate } */ - function syscallGetVarargI() { + var syscallGetVarargI = () => { assert(SYSCALLS.varargs != undefined); // the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number. var ret = HEAP32[((+SYSCALLS.varargs)>>2)]; SYSCALLS.varargs += 4; return ret; - } + }; var syscallGetVarargP = syscallGetVarargI; @@ -2048,6 +2053,7 @@ function dbg(...args) { initialized:false, ignorePermissions:true, ErrnoError:class extends Error { + name = 'ErrnoError'; // We set the `name` property to be able to identify `FS.ErrnoError` // - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway. // - when using PROXYFS, an error can come from an underlying FS @@ -2056,9 +2062,6 @@ function dbg(...args) { // we'll use the reliable test `err.name == "ErrnoError"` instead constructor(errno) { super(runtimeInitialized ? strError(errno) : ''); - // TODO(sbc): Use the inline member declaration syntax once we - // support it in acorn and closure. - this.name = 'ErrnoError'; this.errno = errno; for (var key in ERRNO_CODES) { if (ERRNO_CODES[key] === errno) { @@ -2075,11 +2078,7 @@ function dbg(...args) { readFiles:{ }, FSStream:class { - constructor() { - // TODO(https://github.com/emscripten-core/emscripten/issues/21414): - // Use inline field declarations. - this.shared = {}; - } + shared = {}; get object() { return this.node; } @@ -2109,21 +2108,21 @@ function dbg(...args) { } }, FSNode:class { + node_ops = {}; + stream_ops = {}; + readMode = 292 | 73; + writeMode = 146; + mounted = null; constructor(parent, name, mode, rdev) { if (!parent) { parent = this; // root node sets parent to itself } this.parent = parent; this.mount = parent.mount; - this.mounted = null; this.id = FS.nextInode++; this.name = name; this.mode = mode; - this.node_ops = {}; - this.stream_ops = {}; this.rdev = rdev; - this.readMode = 292 | 73; - this.writeMode = 146; } get read() { return (this.mode & this.readMode) === this.readMode; @@ -3461,10 +3460,8 @@ function dbg(...args) { // Lazy chunked Uint8Array (implements get and length from Uint8Array). // Actual getting is abstracted away for eventual reuse. class LazyUint8Array { - constructor() { - this.lengthKnown = false; - this.chunks = []; // Loaded chunks. Index is the chunk number - } + lengthKnown = false; + chunks = []; // Loaded chunks. Index is the chunk number get(idx) { if (idx > this.length-1 || idx < 0) { return undefined; @@ -4018,6 +4015,7 @@ function dbg(...args) { quit_(code, new ExitStatus(code)); }; + /** @suppress {duplicate } */ /** @param {boolean|number=} implicit */ var exitJS = (status, implicit) => { @@ -4425,8 +4423,6 @@ var unexportedSymbols = [ 'DNS', 'Protocols', 'Sockets', - 'initRandomFill', - 'randomFill', 'timers', 'warnOnce', 'readEmAsmArgsArray', @@ -4465,6 +4461,8 @@ var unexportedSymbols = [ 'getEnvStrings', 'doReadv', 'doWritev', + 'initRandomFill', + 'randomFill', 'promiseMap', 'uncaughtExceptionCount', 'exceptionLast', @@ -4514,7 +4512,6 @@ unexportedSymbols.forEach(unexportedRuntimeSymbol); var calledRun; -var calledPrerun; dependenciesFulfilled = function runCaller() { // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false) @@ -4524,7 +4521,7 @@ dependenciesFulfilled = function runCaller() { function callMain(args = []) { assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); - assert(calledPrerun, 'cannot call main without calling preRun first'); + assert(__ATPRERUN__.length == 0, 'cannot call main when preRun functions remain to be called'); var entryFunction = _main; @@ -4569,22 +4566,19 @@ function run(args = arguments_) { stackCheckInit(); - if (!calledPrerun) { - calledPrerun = 1; - preRun(); + preRun(); - // a preRun added a dependency, run will be called later - if (runDependencies > 0) { - return; - } + // a preRun added a dependency, run will be called later + if (runDependencies > 0) { + return; } function doRun() { // run may have just been called through dependencies being fulfilled just in this very frame, // or while the async setStatus time below was happening if (calledRun) return; - calledRun = 1; - Module['calledRun'] = 1; + calledRun = true; + Module['calledRun'] = true; if (ABORT) return; diff --git a/public/assets/salam/salam-wa.wasm b/public/assets/salam/salam-wa.wasm index eac232d..a4c190c 100644 Binary files a/public/assets/salam/salam-wa.wasm and b/public/assets/salam/salam-wa.wasm differ