diff --git a/src/Fetch.js b/src/Fetch.js index 29403dc3e0c19..e50db51512e17 100644 --- a/src/Fetch.js +++ b/src/Fetch.js @@ -71,7 +71,7 @@ var Fetch = { #endif // ~FETCH_SUPPORT_INDEXEDDB #if FETCH_SUPPORT_INDEXEDDB - if (typeof ENVIRONMENT_IS_FETCH_WORKER === 'undefined' || !ENVIRONMENT_IS_FETCH_WORKER) addRunDependency('library_fetch_init'); + if (typeof ENVIRONMENT_IS_FETCH_WORKER == 'undefined' || !ENVIRONMENT_IS_FETCH_WORKER) addRunDependency('library_fetch_init'); #endif } } diff --git a/src/IDBStore.js b/src/IDBStore.js index 10891c2463879..e720bd642ce33 100644 --- a/src/IDBStore.js +++ b/src/IDBStore.js @@ -6,9 +6,9 @@ { indexedDB: function() { - if (typeof indexedDB !== 'undefined') return indexedDB; + if (typeof indexedDB != 'undefined') return indexedDB; var ret = null; - if (typeof window === 'object') ret = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; + if (typeof window == 'object') ret = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; assert(ret, 'IDBStore used, but indexedDB not supported'); return ret; }, diff --git a/src/base64Decode.js b/src/base64Decode.js index 4512aeeeb00ef..46a15327d619e 100644 --- a/src/base64Decode.js +++ b/src/base64Decode.js @@ -37,7 +37,7 @@ base64ReverseLookup[47] = 63; // '/' /** @noinline */ function base64Decode(b64) { #if ENVIRONMENT_MAY_BE_NODE - if (typeof ENVIRONMENT_IS_NODE !== 'undefined' && ENVIRONMENT_IS_NODE) { + if (typeof ENVIRONMENT_IS_NODE != 'undefined' && ENVIRONMENT_IS_NODE) { var buf = Buffer.from(b64, 'base64'); return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength); } diff --git a/src/base64Utils.js b/src/base64Utils.js index b5105c3afc5d3..9fea5f8df1898 100644 --- a/src/base64Utils.js +++ b/src/base64Utils.js @@ -8,7 +8,7 @@ * Decodes a base64 string. * @param {string} input The string to decode. */ -var decodeBase64 = typeof atob === 'function' ? atob : function (input) { +var decodeBase64 = typeof atob == 'function' ? atob : function (input) { var keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; var output = ''; @@ -43,7 +43,7 @@ var decodeBase64 = typeof atob === 'function' ? atob : function (input) { // Throws error on invalid input. function intArrayFromBase64(s) { #if ENVIRONMENT_MAY_BE_NODE - if (typeof ENVIRONMENT_IS_NODE === 'boolean' && ENVIRONMENT_IS_NODE) { + if (typeof ENVIRONMENT_IS_NODE == 'boolean' && ENVIRONMENT_IS_NODE) { var buf = Buffer.from(s, 'base64'); return new Uint8Array(buf['buffer'], buf['byteOffset'], buf['byteLength']); } diff --git a/src/cpuprofiler.js b/src/cpuprofiler.js index cfc508562b4fe..ca2b896332ce8 100644 --- a/src/cpuprofiler.js +++ b/src/cpuprofiler.js @@ -533,7 +533,7 @@ var emscriptenCpuProfiler = { detectWebGLContext: function() { if (Module['canvas'] && Module['canvas'].GLctxObject && Module['canvas'].GLctxObject.GLctx) return Module['canvas'].GLctxObject.GLctx; - else if (typeof GLctx !== 'undefined') return GLctx; + else if (typeof GLctx != 'undefined') return GLctx; else if (Module.ctx) return Module.ctx; return null; }, @@ -570,7 +570,7 @@ var emscriptenCpuProfiler = { document.getElementById("toggle_webgl_profile").style.background = '#E1E1E1'; for (var f in glCtx) { - if (typeof glCtx[f] !== 'function' || f.startsWith('real_')) continue; + if (typeof glCtx[f] != 'function' || f.startsWith('real_')) continue; var realf = 'real_' + f; glCtx[f] = glCtx[realf]; delete glCtx[realf]; @@ -603,8 +603,8 @@ var emscriptenCpuProfiler = { hookWebGL: function(glCtx) { if (!glCtx) glCtx = this.detectWebGLContext(); if (!glCtx) return; - if (!((typeof WebGLRenderingContext !== 'undefined' && glCtx instanceof WebGLRenderingContext) - || (typeof WebGL2RenderingContext !== 'undefined' && glCtx instanceof WebGL2RenderingContext))) { + if (!((typeof WebGLRenderingContext != 'undefined' && glCtx instanceof WebGLRenderingContext) + || (typeof WebGL2RenderingContext != 'undefined' && glCtx instanceof WebGL2RenderingContext))) { document.getElementById("toggle_webgl_profile").disabled = true; return; } @@ -619,7 +619,7 @@ var emscriptenCpuProfiler = { this.createSection(0, 'Hot GL', this.colorHotGLFunction, /*traceable=*/true); this.createSection(1, 'Cold GL', this.colorColdGLFunction, /*traceable=*/true); for (var f in glCtx) { - if (typeof glCtx[f] !== 'function' || f.startsWith('real_')) continue; + if (typeof glCtx[f] != 'function' || f.startsWith('real_')) continue; this.hookWebGLFunction(f, glCtx); } // The above injection won't work for texImage2D and texSubImage2D, which have multiple overloads. @@ -671,4 +671,4 @@ setTimeout = (fn, delay) => { // Backwards compatibility with previously compiled code. Don't call this anymore! function cpuprofiler_add_hooks() { emscriptenCpuProfiler.initialize(); } -if (typeof Module !== 'undefined' && typeof document !== 'undefined') emscriptenCpuProfiler.initialize(); +if (typeof Module != 'undefined' && typeof document != 'undefined') emscriptenCpuProfiler.initialize(); diff --git a/src/deterministic.js b/src/deterministic.js index 4546cd10dbf4e..0b894b4ac540b 100644 --- a/src/deterministic.js +++ b/src/deterministic.js @@ -11,7 +11,7 @@ Math.random = () => { }; var TIME = 10000; Date.now = () => TIME++; -if (typeof performance === 'object') performance.now = Date.now; +if (typeof performance == 'object') performance.now = Date.now; if (ENVIRONMENT_IS_NODE) process['hrtime'] = Date.now; if (!Module) Module = {}; diff --git a/src/embind/embind.js b/src/embind/embind.js index f37da92c9931d..18b505add9955 100644 --- a/src/embind/embind.js +++ b/src/embind/embind.js @@ -568,7 +568,7 @@ var LibraryEmbind = { var isUnsignedType = (name.includes('unsigned')); var checkAssertions = (value, toTypeName) => { #if ASSERTIONS - if (typeof value !== "number" && typeof value !== "boolean") { + if (typeof value != "number" && typeof value != "boolean") { throw new TypeError('Cannot convert "' + _embind_repr(value) + '" to ' + toTypeName); } if (value < minRange || value > maxRange) { @@ -622,7 +622,7 @@ var LibraryEmbind = { return value; }, 'toWireType': function (destructors, value) { - if (typeof value !== "bigint") { + if (typeof value != "bigint") { throw new TypeError('Cannot convert "' + _embind_repr(value) + '" to ' + this.name); } if (value < minRange || value > maxRange) { @@ -653,7 +653,7 @@ var LibraryEmbind = { }, 'toWireType': function(destructors, value) { #if ASSERTIONS - if (typeof value !== "number" && typeof value !== "boolean") { + if (typeof value != "number" && typeof value != "boolean") { throw new TypeError('Cannot convert "' + _embind_repr(value) + '" to ' + this.name); } #endif @@ -726,7 +726,7 @@ var LibraryEmbind = { } var getLength; - var valueIsOfTypeString = (typeof value === 'string'); + var valueIsOfTypeString = (typeof value == 'string'); if (!(valueIsOfTypeString || value instanceof Uint8Array || value instanceof Uint8ClampedArray || value instanceof Int8Array)) { throwBindingError('Cannot pass non-string to std::string'); @@ -827,7 +827,7 @@ var LibraryEmbind = { return str; }, 'toWireType': function(destructors, value) { - if (!(typeof value === 'string')) { + if (!(typeof value == 'string')) { throwBindingError('Cannot pass non-string to C++ string type ' + name); } @@ -1175,7 +1175,7 @@ var LibraryEmbind = { } var fp = makeDynCaller(); - if (typeof fp !== "function") { + if (typeof fp != "function") { throwBindingError("unknown function pointer with signature " + signature + ": " + rawFunction); } return fp; diff --git a/src/embind/emval.js b/src/embind/emval.js index a9ded70b3fe5b..f286fac5dab6a 100644 --- a/src/embind/emval.js +++ b/src/embind/emval.js @@ -209,26 +209,26 @@ var LibraryEmVal = { #if DYNAMIC_EXECUTION == 0 $emval_get_global: function() { - if (typeof globalThis === 'object') { + if (typeof globalThis == 'object') { return globalThis; } function testGlobal(obj) { obj['$$$embind_global$$$'] = obj; - var success = typeof $$$embind_global$$$ === 'object' && obj['$$$embind_global$$$'] === obj; + var success = typeof $$$embind_global$$$ == 'object' && obj['$$$embind_global$$$'] == obj; if (!success) { delete obj['$$$embind_global$$$']; } return success; } - if (typeof $$$embind_global$$$ === 'object') { + if (typeof $$$embind_global$$$ == 'object') { return $$$embind_global$$$; } - if (typeof global === 'object' && testGlobal(global)) { + if (typeof global == 'object' && testGlobal(global)) { $$$embind_global$$$ = global; - } else if (typeof self === 'object' && testGlobal(self)) { + } else if (typeof self == 'object' && testGlobal(self)) { $$$embind_global$$$ = self; // This works for both "window" and "self" (Web Workers) global objects } - if (typeof $$$embind_global$$$ === 'object') { + if (typeof $$$embind_global$$$ == 'object') { return $$$embind_global$$$; } throw Error('unable to get global object.'); @@ -236,7 +236,7 @@ var LibraryEmVal = { #else // appease jshint (technically this code uses eval) $emval_get_global: function() { - if (typeof globalThis === 'object') { + if (typeof globalThis == 'object') { return globalThis; } return (function(){ @@ -491,13 +491,13 @@ var LibraryEmVal = { _emval_is_number__deps: ['$Emval'], _emval_is_number: function(handle) { handle = Emval.toValue(handle); - return typeof handle === 'number'; + return typeof handle == 'number'; }, _emval_is_string__deps: ['$Emval'], _emval_is_string: function(handle) { handle = Emval.toValue(handle); - return typeof handle === 'string'; + return typeof handle == 'string'; }, _emval_in__deps: ['$Emval'], diff --git a/src/emrun_postjs.js b/src/emrun_postjs.js index f7e6c059f8bf7..59e124631d868 100644 --- a/src/emrun_postjs.js +++ b/src/emrun_postjs.js @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -if (typeof window === "object" && (typeof ENVIRONMENT_IS_PTHREAD === 'undefined' || !ENVIRONMENT_IS_PTHREAD)) { +if (typeof window == "object" && (typeof ENVIRONMENT_IS_PTHREAD == 'undefined' || !ENVIRONMENT_IS_PTHREAD)) { var emrun_register_handlers = function() { // When C code exit()s, we may still have remaining stdout and stderr messages in flight. In that case, we can't close // the browser until all those XHRs have finished, so the following state variables track that all communication is done, @@ -66,5 +66,5 @@ if (typeof window === "object" && (typeof ENVIRONMENT_IS_PTHREAD === 'undefined' http.send(data); // XXX this does not work in workers, for some odd reason (issue #2681) }; - if (typeof Module !== 'undefined' && typeof document !== 'undefined') emrun_register_handlers(); + if (typeof Module != 'undefined' && typeof document != 'undefined') emrun_register_handlers(); } diff --git a/src/emrun_prejs.js b/src/emrun_prejs.js index c4b0aee4bbb41..3bb39fcfbd881 100644 --- a/src/emrun_prejs.js +++ b/src/emrun_prejs.js @@ -5,7 +5,7 @@ */ // Route URL GET parameters to argc+argv -if (typeof window === 'object') { +if (typeof window == 'object') { Module['arguments'] = window.location.search.substr(1).trim().split('&'); // If no args were passed arguments = [''], in which case kill the single empty string. if (!Module['arguments'][0]) { diff --git a/src/headless.js b/src/headless.js index 6e3c066bd898d..33f643937ec71 100644 --- a/src/headless.js +++ b/src/headless.js @@ -287,7 +287,7 @@ var screen = { // XXX these values may need to be adjusted availWidth: 2100, availHeight: 1283, }; -if (typeof console === "undefined") { +if (typeof console == "undefined") { console = { log: function(x) { print(x); diff --git a/src/jsifier.js b/src/jsifier.js index dca06f1f7b221..eaf1ffdab71e4 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -40,8 +40,8 @@ function escapeJSONKey(x) { } function stringifyWithFunctions(obj) { - if (typeof obj === 'function') return obj.toString(); - if (obj === null || typeof obj !== 'object') return JSON.stringify(obj); + if (typeof obj == 'function') return obj.toString(); + if (obj === null || typeof obj != 'object') return JSON.stringify(obj); if (Array.isArray(obj)) { return '[' + obj.map(stringifyWithFunctions).join(',') + ']'; } else { @@ -106,7 +106,7 @@ function ${name}(${args}) { var ret = (function() { if (runtimeDebug) err("[library call:${finalName}: " + Array.prototype.slice.call(arguments).map(prettyPrint) + "]"); ${body} }).apply(this, arguments); - if (runtimeDebug && typeof ret !== "undefined") err(" [ return:" + prettyPrint(ret)); + if (runtimeDebug && typeof ret != "undefined") err(" [ return:" + prettyPrint(ret)); return ret; }`); } @@ -203,7 +203,7 @@ function ${name}(${args}) { } const isUserSymbol = LibraryManager.library[ident + '__user']; deps.forEach((dep) => { - if (typeof snippet === 'string' && !(dep in LibraryManager.library)) { + if (typeof snippet == 'string' && !(dep in LibraryManager.library)) { warn(`missing library dependency ${dep}, make sure you are compiling with the right options (see #if in src/library*.js)`); } if (isUserSymbol && LibraryManager.library[dep + '__internal']) { @@ -212,7 +212,7 @@ function ${name}(${args}) { }); let isFunction = false; - if (typeof snippet === 'string') { + if (typeof snippet == 'string') { if (snippet[0] != '=') { const target = LibraryManager.library[snippet]; if (target) { @@ -228,9 +228,9 @@ function ${name}(${args}) { libraryFunctions.push(finalName); } } - } else if (typeof snippet === 'object') { + } else if (typeof snippet == 'object') { snippet = stringifyWithFunctions(snippet); - } else if (typeof snippet === 'function') { + } else if (typeof snippet == 'function') { isFunction = true; snippet = processLibraryFunction(snippet, ident, finalName); libraryFunctions.push(finalName); @@ -251,7 +251,7 @@ function ${name}(${args}) { if (postset) { // A postset is either code to run right now, or some text we should emit. // If it's code, it may return some text to emit as well. - if (typeof postset === 'function') { + if (typeof postset == 'function') { postset = postset(); } if (postset && !addedLibraryItems[postsetId]) { @@ -270,7 +270,7 @@ function ${name}(${args}) { } const identDependents = ident + "__deps: ['" + deps.join("','") + "']"; function addDependency(dep) { - if (typeof dep !== 'function') { + if (typeof dep != 'function') { dep = {identOrig: dep, identMangled: mangleCSymbolName(dep)}; } return addFromLibrary(dep, `${identDependents}, referenced by ${dependent}`); @@ -284,7 +284,7 @@ function ${name}(${args}) { throw new Error(`Invalid proxyingMode ${ident}__proxy: '${proxyingMode}' specified!`); } const sync = proxyingMode === 'sync'; - assert(typeof original === 'function'); + assert(typeof original == 'function'); contentText = modifyFunction(snippet, (name, args, body) => ` function ${name}(${args}) { if (ENVIRONMENT_IS_PTHREAD) @@ -303,7 +303,7 @@ function ${name}(${args}) { } else { contentText = snippet; // Regular JS function that will be executed in the context of the calling thread. } - } else if (typeof snippet === 'string' && snippet.startsWith(';')) { + } else if (typeof snippet == 'string' && snippet.startsWith(';')) { // In JS libraries // foo: ';[code here verbatim]' // emits @@ -315,7 +315,7 @@ function ${name}(${args}) { // foo: '=[value]' // emits // 'var foo = [value];' - if (typeof snippet === 'string' && snippet[0] == '=') snippet = snippet.substr(1); + if (typeof snippet == 'string' && snippet[0] == '=') snippet = snippet.substr(1); contentText = `var ${finalName} = ${snippet};`; } const sig = LibraryManager.library[ident + '__sig']; diff --git a/src/library.js b/src/library.js index 183d2d62d4f12..d6088f68c7c02 100644 --- a/src/library.js +++ b/src/library.js @@ -126,7 +126,7 @@ LibraryManager.library = { wasmMemory.grow((size - buffer.byteLength + 65535) >>> 16); // .grow() takes a delta compared to the previous size updateGlobalBufferAndViews(wasmMemory.buffer); #if MEMORYPROFILER - if (typeof emscriptenMemoryProfiler !== 'undefined') { + if (typeof emscriptenMemoryProfiler != 'undefined') { emscriptenMemoryProfiler.onMemoryResize(oldHeapSize, buffer.byteLength); } #endif @@ -729,7 +729,7 @@ LibraryManager.library = { var MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; function leadingSomething(value, digits, character) { - var str = typeof value === 'number' ? value.toString() : (value || ''); + var str = typeof value == 'number' ? value.toString() : (value || ''); while (str.length < digits) { str = character[0]+str; } @@ -1074,7 +1074,7 @@ LibraryManager.library = { function initDate() { function fixup(value, min, max) { - return (typeof value !== 'number' || isNaN(value)) ? min : (value>=min ? (value<=max ? value: max): min); + return (typeof value != 'number' || isNaN(value)) ? min : (value>=min ? (value<=max ? value: max): min); }; return { year: fixup({{{ makeGetValue('tm', C_STRUCTS.tm.tm_year, 'i32', 0, 0, 1) }}} + 1900 , 1970, 9999), @@ -1667,7 +1667,7 @@ LibraryManager.library = { offset = 0; z = 0; for (w=0; w < words.length; w++) { - if (typeof words[w] === 'string') { + if (typeof words[w] == 'string') { if (words[w] === 'Z') { // compressed zeros - write appropriate number of zero words for (z = 0; z < (8 - words.length+1); z++) { @@ -2306,7 +2306,7 @@ LibraryManager.library = { // TODO: consider allowing the API to get a parameter for the number of // bytes. $getRandomDevice: function() { - if (typeof crypto === 'object' && typeof crypto['getRandomValues'] === 'function') { + if (typeof crypto == 'object' && typeof crypto['getRandomValues'] == 'function') { // for modern web browsers var randomBuffer = new Uint8Array(1); return function() { crypto.getRandomValues(randomBuffer); return randomBuffer[0]; }; @@ -2415,12 +2415,12 @@ LibraryManager.library = { "} else " + #endif #if ENVIRONMENT_MAY_BE_SHELL - "if (typeof dateNow !== 'undefined') {\n" + + "if (typeof dateNow != 'undefined') {\n" + " _emscripten_get_now = dateNow;\n" + "} else " + #endif #if MIN_IE_VERSION <= 9 || MIN_FIREFOX_VERSION <= 14 || MIN_CHROME_VERSION <= 23 || MIN_SAFARI_VERSION <= 80400 // https://caniuse.com/#feat=high-resolution-time - "if (typeof performance !== 'undefined' && performance.now) {\n" + + "if (typeof performance != 'undefined' && performance.now) {\n" + " _emscripten_get_now = () => performance.now();\n" + "} else {\n" + " _emscripten_get_now = Date.now;\n" + @@ -2438,12 +2438,12 @@ LibraryManager.library = { } else #endif #if ENVIRONMENT_MAY_BE_SHELL - if (typeof dateNow !== 'undefined') { + if (typeof dateNow != 'undefined') { return 1000; // microseconds (1/1000 of a millisecond) } else #endif #if MIN_IE_VERSION <= 9 || MIN_FIREFOX_VERSION <= 14 || MIN_CHROME_VERSION <= 23 || MIN_SAFARI_VERSION <= 80400 // https://caniuse.com/#feat=high-resolution-time - if (typeof performance === 'object' && performance && typeof performance['now'] === 'function') { + if (typeof performance == 'object' && performance && typeof performance['now'] == 'function') { return 1000; // microseconds (1/1000 of a millisecond) } else { return 1000*1000; // milliseconds @@ -2458,12 +2458,12 @@ LibraryManager.library = { // implementation is not :( #if MIN_IE_VERSION <= 9 || MIN_FIREFOX_VERSION <= 14 || MIN_CHROME_VERSION <= 23 || MIN_SAFARI_VERSION <= 80400 // https://caniuse.com/#feat=high-resolution-time emscripten_get_now_is_monotonic: ` - ((typeof performance === 'object' && performance && typeof performance['now'] === 'function') + ((typeof performance == 'object' && performance && typeof performance['now'] == 'function') #if ENVIRONMENT_MAY_BE_NODE || ENVIRONMENT_IS_NODE #endif #if ENVIRONMENT_MAY_BE_SHELL - || (typeof dateNow !== 'undefined') + || (typeof dateNow != 'undefined') #endif );`, #else @@ -2497,7 +2497,7 @@ LibraryManager.library = { str += ", "; } first = false; - if (typeof a === 'number' || typeof a === 'string') { + if (typeof a == 'number' || typeof a == 'string') { str += a; } else { str += '(' + typeof a + ')'; @@ -2531,7 +2531,7 @@ LibraryManager.library = { } // If user requested to see the original source stack, but no source map information is available, just fall back to showing the JS stack. - if (flags & {{{ cDefine('EM_LOG_C_STACK') }}} && typeof emscripten_source_map === 'undefined') { + if (flags & {{{ cDefine('EM_LOG_C_STACK') }}} && typeof emscripten_source_map == 'undefined') { warnOnce('Source map information is not available, emscripten_log with EM_LOG_C_STACK will be ignored. Build with "--pre-js $EMSCRIPTEN/src/emscripten-source-map.min.js" linker flag to add source map loading to code.'); flags ^= {{{ cDefine('EM_LOG_C_STACK') }}}; flags |= {{{ cDefine('EM_LOG_JS_STACK') }}}; @@ -2669,7 +2669,7 @@ LibraryManager.library = { name = UTF8ToString(name); var ret = getCompilerSetting(name); - if (typeof ret === 'number') return ret; + if (typeof ret == 'number') return ret; if (!_emscripten_get_compiler_setting.cache) _emscripten_get_compiler_setting.cache = {}; var cache = _emscripten_get_compiler_setting.cache; @@ -2945,9 +2945,9 @@ LibraryManager.library = { ], $withBuiltinMalloc__docs: '/** @suppress{checkTypes} */', $withBuiltinMalloc: function (func) { - var prev_malloc = typeof _malloc !== 'undefined' ? _malloc : undefined; - var prev_memalign = typeof _memalign !== 'undefined' ? _memalign : undefined; - var prev_free = typeof _free !== 'undefined' ? _free : undefined; + var prev_malloc = typeof _malloc != 'undefined' ? _malloc : undefined; + var prev_memalign = typeof _memalign != 'undefined' ? _memalign : undefined; + var prev_free = typeof _free != 'undefined' ? _free : undefined; _malloc = _emscripten_builtin_malloc; _memalign = _emscripten_builtin_memalign; _free = _emscripten_builtin_free; @@ -3060,7 +3060,7 @@ LibraryManager.library = { $exportAsmFunctions__deps: ['$asmjsMangle'], $exportAsmFunctions: function(asm) { #if ENVIRONMENT_MAY_BE_NODE && ENVIRONMENT_MAY_BE_WEB - var global_object = (typeof process !== "undefined" ? global : this); + var global_object = (typeof process != "undefined" ? global : this); #elif ENVIRONMENT_MAY_BE_NODE var global_object = global; #else @@ -3213,7 +3213,7 @@ LibraryManager.library = { $dynCallLegacy: function(sig, ptr, args) { #if ASSERTIONS #if MINIMAL_RUNTIME - assert(typeof dynCalls !== 'undefined', 'Global dynCalls dictionary was not generated in the build! Pass -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=["$dynCall"] linker flag to include it!'); + assert(typeof dynCalls != 'undefined', 'Global dynCalls dictionary was not generated in the build! Pass -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=["$dynCall"] linker flag to include it!'); assert(sig in dynCalls, 'bad function pointer type - no table for sig \'' + sig + '\''); #else assert(('dynCall_' + sig) in Module, 'bad function pointer type - no table for sig \'' + sig + '\''); @@ -3280,7 +3280,7 @@ LibraryManager.library = { continue; } var func = callback.func; - if (typeof func === 'number') { + if (typeof func == 'number') { if (callback.arg === undefined) { {{{ makeDynCall('v', 'func') }}}(); } else { @@ -3365,7 +3365,7 @@ LibraryManager.library = { _emscripten_out__sig: 'vi', _emscripten_out: function(str) { #if ASSERTIONS - assert(typeof str === 'number'); + assert(typeof str == 'number'); #endif out(UTF8ToString(str)); }, @@ -3373,7 +3373,7 @@ LibraryManager.library = { _emscripten_err__sig: 'vi', _emscripten_err: function(str) { #if ASSERTIONS - assert(typeof str === 'number'); + assert(typeof str == 'number'); #endif err(UTF8ToString(str)); }, @@ -3384,8 +3384,8 @@ LibraryManager.library = { _emscripten_get_progname: function(str, len) { #if !MINIMAL_RUNTIME #if ASSERTIONS - assert(typeof str === 'number'); - assert(typeof len === 'number'); + assert(typeof str == 'number'); + assert(typeof len == 'number'); #endif stringToUTF8(thisProgram, str, len); #endif @@ -3394,7 +3394,7 @@ LibraryManager.library = { emscripten_console_log__sig: 'vi', emscripten_console_log: function(str) { #if ASSERTIONS - assert(typeof str === 'number'); + assert(typeof str == 'number'); #endif console.log(UTF8ToString(str)); }, @@ -3402,7 +3402,7 @@ LibraryManager.library = { emscripten_console_warn__sig: 'vi', emscripten_console_warn: function(str) { #if ASSERTIONS - assert(typeof str === 'number'); + assert(typeof str == 'number'); #endif console.warn(UTF8ToString(str)); }, @@ -3410,7 +3410,7 @@ LibraryManager.library = { emscripten_console_error__sig: 'vi', emscripten_console_error: function(str) { #if ASSERTIONS - assert(typeof str === 'number'); + assert(typeof str == 'number'); #endif console.error(UTF8ToString(str)); }, @@ -3421,7 +3421,7 @@ LibraryManager.library = { emscripten_throw_string: function(str) { #if ASSERTIONS - assert(typeof str === 'number'); + assert(typeof str == 'number'); #endif throw UTF8ToString(str); }, diff --git a/src/library_async.js b/src/library_async.js index 35be0371107c5..da09a1ae2d80f 100644 --- a/src/library_async.js +++ b/src/library_async.js @@ -66,7 +66,7 @@ mergeInto(LibraryManager.library, { for (var x in imports) { (function(x) { var original = imports[x]; - if (typeof original === 'function') { + if (typeof original == 'function') { imports[x] = function() { var originalAsyncifyState = Asyncify.state; try { @@ -111,7 +111,7 @@ mergeInto(LibraryManager.library, { for (var x in exports) { (function(x) { var original = exports[x]; - if (typeof original === 'function') { + if (typeof original == 'function') { ret[x] = function() { #if ASYNCIFY_DEBUG >= 2 err('ASYNCIFY: ' + ' '.repeat(Asyncify.exportCallStack.length) + ' try ' + x); @@ -153,7 +153,7 @@ mergeInto(LibraryManager.library, { Asyncify.state = Asyncify.State.Normal; // Keep the runtime alive so that a re-wind can be done later. runAndAbortIfError(Module['_asyncify_stop_unwind']); - if (typeof Fibers !== 'undefined') { + if (typeof Fibers != 'undefined') { Fibers.trampoline(); } } @@ -236,7 +236,7 @@ mergeInto(LibraryManager.library, { var reachedAfterCallback = false; startAsync((handleSleepReturnValue) => { #if ASSERTIONS - assert(!handleSleepReturnValue || typeof handleSleepReturnValue === 'number' || typeof handleSleepReturnValue === 'boolean'); // old emterpretify API supported other stuff + assert(!handleSleepReturnValue || typeof handleSleepReturnValue == 'number' || typeof handleSleepReturnValue == 'boolean'); // old emterpretify API supported other stuff #endif if (ABORT) return; Asyncify.handleSleepReturnValue = handleSleepReturnValue || 0; @@ -258,7 +258,7 @@ mergeInto(LibraryManager.library, { #endif Asyncify.state = Asyncify.State.Rewinding; runAndAbortIfError(() => Module['_asyncify_start_rewind'](Asyncify.currData)); - if (typeof Browser !== 'undefined' && Browser.mainLoop.func) { + if (typeof Browser != 'undefined' && Browser.mainLoop.func) { Browser.mainLoop.resume(); } var asyncWasmReturnValue, isError = false; @@ -307,7 +307,7 @@ mergeInto(LibraryManager.library, { err('ASYNCIFY: start unwind ' + Asyncify.currData); #endif runAndAbortIfError(() => Module['_asyncify_start_unwind'](Asyncify.currData)); - if (typeof Browser !== 'undefined' && Browser.mainLoop.func) { + if (typeof Browser != 'undefined' && Browser.mainLoop.func) { Browser.mainLoop.pause(); } } diff --git a/src/library_browser.js b/src/library_browser.js index 88926c0f175d7..a9a410d8571f6 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -110,7 +110,7 @@ var LibraryBrowser = { } Browser.BlobBuilder = typeof MozBlobBuilder != "undefined" ? MozBlobBuilder : (typeof WebKitBlobBuilder != "undefined" ? WebKitBlobBuilder : (!Browser.hasBlobConstructor ? out("warning: no BlobBuilder") : null)); Browser.URLObject = typeof window != "undefined" ? (window.URL ? window.URL : window.webkitURL) : undefined; - if (!Module.noImageDecoding && typeof Browser.URLObject === 'undefined') { + if (!Module.noImageDecoding && typeof Browser.URLObject == 'undefined') { out("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available."); Module.noImageDecoding = true; } @@ -340,7 +340,7 @@ var LibraryBrowser = { #if MIN_WEBGL_VERSION >= 2 majorVersion: 2, #elif MAX_WEBGL_VERSION >= 2 // library_browser.js defaults: use the WebGL version chosen at compile time (unless overridden below) - majorVersion: (typeof WebGL2RenderingContext !== 'undefined') ? 2 : 1, + majorVersion: (typeof WebGL2RenderingContext != 'undefined') ? 2 : 1, #else majorVersion: 1, #endif @@ -355,7 +355,7 @@ var LibraryBrowser = { // This check of existence of GL is here to satisfy Closure compiler, which yells if variable GL is referenced below but GL object is not // actually compiled in because application is not doing any GL operations. TODO: Ideally if GL is not being used, this function // Browser.createContext() should not even be emitted. - if (typeof GL !== 'undefined') { + if (typeof GL != 'undefined') { contextHandle = GL.createContext(canvas, contextAttributes); if (contextHandle) { ctx = GL.getContext(contextHandle).GLctx; @@ -368,7 +368,7 @@ var LibraryBrowser = { if (!ctx) return null; if (setInModule) { - if (!useWebGL) assert(typeof GLctx === 'undefined', 'cannot set in module if GLctx is used, but we are a non-GL context that would replace it'); + if (!useWebGL) assert(typeof GLctx == 'undefined', 'cannot set in module if GLctx is used, but we are a non-GL context that would replace it'); Module.ctx = ctx; if (useWebGL) GL.makeContextCurrent(contextHandle); @@ -387,8 +387,8 @@ var LibraryBrowser = { requestFullscreen: function(lockPointer, resizeCanvas) { Browser.lockPointer = lockPointer; Browser.resizeCanvas = resizeCanvas; - if (typeof Browser.lockPointer === 'undefined') Browser.lockPointer = true; - if (typeof Browser.resizeCanvas === 'undefined') Browser.resizeCanvas = false; + if (typeof Browser.lockPointer == 'undefined') Browser.lockPointer = true; + if (typeof Browser.resizeCanvas == 'undefined') Browser.resizeCanvas = false; var canvas = Module['canvas']; function fullscreenChange() { @@ -484,13 +484,13 @@ var LibraryBrowser = { }, requestAnimationFrame: function(func) { - if (typeof requestAnimationFrame === 'function') { + if (typeof requestAnimationFrame == 'function') { requestAnimationFrame(func); return; } var RAF = Browser.fakeRequestAnimationFrame; #if LEGACY_VM_SUPPORT - if (typeof window !== 'undefined') { + if (typeof window != 'undefined') { RAF = window['requestAnimationFrame'] || window['mozRequestAnimationFrame'] || window['webkitRequestAnimationFrame'] || @@ -637,12 +637,12 @@ var LibraryBrowser = { // Neither .scrollX or .pageXOffset are defined in a spec, but // we prefer .scrollX because it is currently in a spec draft. // (see: http://www.w3.org/TR/2013/WD-cssom-view-20131217/) - var scrollX = ((typeof window.scrollX !== 'undefined') ? window.scrollX : window.pageXOffset); - var scrollY = ((typeof window.scrollY !== 'undefined') ? window.scrollY : window.pageYOffset); + var scrollX = ((typeof window.scrollX != 'undefined') ? window.scrollX : window.pageXOffset); + var scrollY = ((typeof window.scrollY != 'undefined') ? window.scrollY : window.pageYOffset); #if ASSERTIONS // If this assert lands, it's likely because the browser doesn't support scrollX or pageXOffset // and we have no viable fallback. - assert((typeof scrollX !== 'undefined') && (typeof scrollY !== 'undefined'), 'Unable to retrieve scroll position, mouse positions likely broken.'); + assert((typeof scrollX != 'undefined') && (typeof scrollY != 'undefined'), 'Unable to retrieve scroll position, mouse positions likely broken.'); #endif if (event.type === 'touchstart' || event.type === 'touchend' || event.type === 'touchmove') { @@ -942,7 +942,7 @@ var LibraryBrowser = { }; Browser.mainLoop.method = 'rAF'; } else if (mode == 2 /*EM_TIMING_SETIMMEDIATE*/) { - if (typeof setImmediate === 'undefined') { + if (typeof setImmediate == 'undefined') { // Emulate setImmediate. (note: not a complete polyfill, we don't emulate clearImmediate() to keep code size to minimum, since not needed) var setImmediates = []; var emscriptenMainLoopMessageId = 'setimmediate'; @@ -1084,7 +1084,7 @@ var LibraryBrowser = { #if USE_PTHREADS && OFFSCREEN_FRAMEBUFFER && GL_SUPPORT_EXPLICIT_SWAP_CONTROL // If the current GL context is a proxied regular WebGL context, and was initialized with implicit swap mode on the main thread, and we are on the parent thread, // perform the swap on behalf of the user. - if (typeof GL !== 'undefined' && GL.currentContext && GL.currentContextIsProxied) { + if (typeof GL != 'undefined' && GL.currentContext && GL.currentContextIsProxied) { var explicitSwapControl = {{{ makeGetValue('GL.currentContext', 0, 'i32') }}}; if (!explicitSwapControl) _emscripten_webgl_commit_frame(); } @@ -1092,7 +1092,7 @@ var LibraryBrowser = { #if OFFSCREENCANVAS_SUPPORT // If the current GL context is an OffscreenCanvas, but it was initialized with implicit swap mode, perform the swap on behalf of the user. - if (typeof GL !== 'undefined' && GL.currentContext && !GL.currentContextIsProxied && !GL.currentContext.attributes.explicitSwapControl && GL.currentContext.GLctx.commit) { + if (typeof GL != 'undefined' && GL.currentContext && !GL.currentContextIsProxied && !GL.currentContext.attributes.explicitSwapControl && GL.currentContext.GLctx.commit) { GL.currentContext.GLctx.commit(); } #endif @@ -1117,7 +1117,7 @@ var LibraryBrowser = { // to queue the newest produced audio samples. // TODO: Consider adding pre- and post- rAF callbacks so that GL.newRenderingFrameStarted() and SDL.audio.queueNewAudioData() // do not need to be hardcoded into this function, but can be more generic. - if (typeof SDL === 'object' && SDL.audio && SDL.audio.queueNewAudioData) SDL.audio.queueNewAudioData(); + if (typeof SDL == 'object' && SDL.audio && SDL.audio.queueNewAudioData) SDL.audio.queueNewAudioData(); Browser.mainLoop.scheduler(); } diff --git a/src/library_c_preprocessor.js b/src/library_c_preprocessor.js index d97b60f1ed52e..c0487b4dce5a4 100644 --- a/src/library_c_preprocessor.js +++ b/src/library_c_preprocessor.js @@ -150,7 +150,7 @@ mergeInto(LibraryManager.library, { function buildExprTree(tokens) { // Consume tokens array into a function tree until the tokens array is exhausted // to a single root node that evaluates it. - while(tokens.length > 1 || typeof(tokens[0]) != 'function') { + while (tokens.length > 1 || typeof tokens[0] != 'function') { tokens = (function(tokens) { // Find the index 'i' of the operator we should evaluate next: var i, j, p, operatorAndPriority = -2; diff --git a/src/library_dylink.js b/src/library_dylink.js index 5cc5ce0ed9348..929dda9ced024 100644 --- a/src/library_dylink.js +++ b/src/library_dylink.js @@ -102,14 +102,14 @@ var LibraryDylink = { #if DYLINK_DEBUG err("updateGOT: before: " + symName + ' : ' + GOT[symName].value); #endif - if (typeof value === 'function') { + if (typeof value == 'function') { GOT[symName].value = addFunction(value); #if DYLINK_DEBUG err("updateGOT: FUNC: " + symName + ' : ' + GOT[symName].value); #endif - } else if (typeof value === 'number') { + } else if (typeof value == 'number') { GOT[symName].value = value; - } else if (typeof value === 'bigint') { + } else if (typeof value == 'bigint') { GOT[symName].value = Number(value); } else { err("unhandled export type for `" + symName + "`: " + (typeof value)); @@ -145,12 +145,12 @@ var LibraryDylink = { continue; } #endif - if (typeof value === 'object') { + if (typeof value == 'object') { // a breaking change in the wasm spec, globals are now objects // https://github.com/WebAssembly/mutable-global/issues/1 value = value.value; } - if (typeof value === 'number') { + if (typeof value == 'number') { value += memoryBase; } relocated[e] = value; @@ -174,13 +174,13 @@ var LibraryDylink = { #if DYLINK_DEBUG err('assigning dynamic symbol from main module: ' + symName + ' -> ' + prettyPrint(value)); #endif - if (typeof value === 'function') { + if (typeof value == 'function') { /** @suppress {checkTypes} */ GOT[symName].value = addFunction(value, value.sig); #if DYLINK_DEBUG err('assigning table entry for : ' + symName + ' -> ' + GOT[symName].value); #endif - } else if (typeof value === 'number') { + } else if (typeof value == 'number') { GOT[symName].value = value; } else { throw new Error('bad export type for `' + symName + '`: ' + (typeof value)); @@ -415,7 +415,7 @@ var LibraryDylink = { else { var curr = asmLibraryArg[sym], next = exports[sym]; // don't warn on functions - might be odr, linkonce_odr, etc. - if (!(typeof curr === 'function' && typeof next === 'function')) { + if (!(typeof curr == 'function' && typeof next == 'function')) { err("warning: symbol '" + sym + "' from '" + libName + "' already exists (duplicate symbol? or weak linking, which isn't supported yet?)"); // + [curr, ' vs ', next]); } } @@ -947,7 +947,7 @@ var LibraryDylink = { result = lib.module[symbol]; } - if (typeof result === 'function') { + if (typeof result == 'function') { #if DYLINK_DEBUG err('dlsym: ' + symbol + ' getting table slot for: ' + result); #endif diff --git a/src/library_eventloop.js b/src/library_eventloop.js index e66454daf5db9..8e65bb68087db 100644 --- a/src/library_eventloop.js +++ b/src/library_eventloop.js @@ -37,10 +37,10 @@ LibraryJSEventLoop = { $polyfillSetImmediate__postset: 'var emSetImmediate;\n' + 'var emClearImmediate;\n' + - 'if (typeof setImmediate !== "undefined") {\n' + + 'if (typeof setImmediate != "undefined") {\n' + 'emSetImmediate = setImmediateWrapped;\n' + 'emClearImmediate = clearImmediateWrapped;\n' + - '} else if (typeof addEventListener === "function") {\n' + + '} else if (typeof addEventListener == "function") {\n' + 'var __setImmediate_id_counter = 0;\n' + 'var __setImmediate_queue = [];\n' + 'var __setImmediate_message_id = "_si";\n' + diff --git a/src/library_fs.js b/src/library_fs.js index 565d5518bd56d..bc5cc412cb2ae 100644 --- a/src/library_fs.js +++ b/src/library_fs.js @@ -249,7 +249,7 @@ FS.staticInit();` + }, createNode: (parent, name, mode, rdev) => { #if ASSERTIONS - assert(typeof parent === 'object') + assert(typeof parent == 'object') #endif var node = new FS.FSNode(parent, name, mode, rdev); @@ -305,7 +305,7 @@ FS.staticInit();` + // convert the 'r', 'r+', etc. to it's corresponding set of O_* flags modeStringToFlags: (str) => { var flags = FS.flagModes[str]; - if (typeof flags === 'undefined') { + if (typeof flags == 'undefined') { throw new Error('Unknown file open mode: ' + str); } return flags; @@ -481,7 +481,7 @@ FS.staticInit();` + return mounts; }, syncfs: (populate, callback) => { - if (typeof(populate) === 'function') { + if (typeof populate == 'function') { callback = populate; populate = false; } @@ -526,7 +526,7 @@ FS.staticInit();` + }, mount: (type, opts, mountpoint) => { #if ASSERTIONS - if (typeof type === 'string') { + if (typeof type == 'string') { // The filesystem was not included, and instead we have an error // message stored in the variable. throw type; @@ -668,7 +668,7 @@ FS.staticInit();` + } }, mkdev: (path, mode, dev) => { - if (typeof(dev) === 'undefined') { + if (typeof dev == 'undefined') { dev = mode; mode = 438 /* 0666 */; } @@ -888,7 +888,7 @@ FS.staticInit();` + }, chmod: (path, mode, dontFollow) => { var node; - if (typeof path === 'string') { + if (typeof path == 'string') { var lookup = FS.lookupPath(path, { follow: !dontFollow }); node = lookup.node; } else { @@ -914,7 +914,7 @@ FS.staticInit();` + }, chown: (path, uid, gid, dontFollow) => { var node; - if (typeof path === 'string') { + if (typeof path == 'string') { var lookup = FS.lookupPath(path, { follow: !dontFollow }); node = lookup.node; } else { @@ -943,7 +943,7 @@ FS.staticInit();` + throw new FS.ErrnoError({{{ cDefine('EINVAL') }}}); } var node; - if (typeof path === 'string') { + if (typeof path == 'string') { var lookup = FS.lookupPath(path, { follow: true }); node = lookup.node; } else { @@ -988,15 +988,15 @@ FS.staticInit();` + if (path === "") { throw new FS.ErrnoError({{{ cDefine('ENOENT') }}}); } - flags = typeof flags === 'string' ? FS.modeStringToFlags(flags) : flags; - mode = typeof mode === 'undefined' ? 438 /* 0666 */ : mode; + flags = typeof flags == 'string' ? FS.modeStringToFlags(flags) : flags; + mode = typeof mode == 'undefined' ? 438 /* 0666 */ : mode; if ((flags & {{{ cDefine('O_CREAT') }}})) { mode = (mode & {{{ cDefine('S_IALLUGO') }}}) | {{{ cDefine('S_IFREG') }}}; } else { mode = 0; } var node; - if (typeof path === 'object') { + if (typeof path == 'object') { node = path; } else { path = PATH.normalize(path); @@ -1147,7 +1147,7 @@ FS.staticInit();` + if (!stream.stream_ops.read) { throw new FS.ErrnoError({{{ cDefine('EINVAL') }}}); } - var seeking = typeof position !== 'undefined'; + var seeking = typeof position != 'undefined'; if (!seeking) { position = stream.position; } else if (!stream.seekable) { @@ -1185,7 +1185,7 @@ FS.staticInit();` + // seek to the end before writing in append mode FS.llseek(stream, 0, {{{ cDefine('SEEK_END') }}}); } - var seeking = typeof position !== 'undefined'; + var seeking = typeof position != 'undefined'; if (!seeking) { position = stream.position; } else if (!stream.seekable) { @@ -1280,7 +1280,7 @@ FS.staticInit();` + writeFile: (path, data, opts = {}) => { opts.flags = opts.flags || {{{ cDefine('O_TRUNC') | cDefine('O_CREAT') | cDefine('O_WRONLY') }}}; var stream = FS.open(path, opts.flags, opts.mode); - if (typeof data === 'string') { + if (typeof data == 'string') { var buf = new Uint8Array(lengthBytesUTF8(data)+1); var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); @@ -1547,7 +1547,7 @@ FS.staticInit();` + return ret; }, createPath: (parent, path, canRead, canWrite) => { - parent = typeof parent === 'string' ? parent : FS.getPath(parent); + parent = typeof parent == 'string' ? parent : FS.getPath(parent); var parts = path.split('/').reverse(); while (parts.length) { var part = parts.pop(); @@ -1563,20 +1563,20 @@ FS.staticInit();` + return current; }, createFile: (parent, name, properties, canRead, canWrite) => { - var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name); + var path = PATH.join2(typeof parent == 'string' ? parent : FS.getPath(parent), name); var mode = FS.getMode(canRead, canWrite); return FS.create(path, mode); }, createDataFile: (parent, name, data, canRead, canWrite, canOwn) => { var path = name; if (parent) { - parent = typeof parent === 'string' ? parent : FS.getPath(parent); + parent = typeof parent == 'string' ? parent : FS.getPath(parent); path = name ? PATH.join2(parent, name) : parent; } var mode = FS.getMode(canRead, canWrite); var node = FS.create(path, mode); if (data) { - if (typeof data === 'string') { + if (typeof data == 'string') { var arr = new Array(data.length); for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); data = arr; @@ -1591,7 +1591,7 @@ FS.staticInit();` + return node; }, createDevice: (parent, name, input, output) => { - var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name); + var path = PATH.join2(typeof parent == 'string' ? parent : FS.getPath(parent), name); var mode = FS.getMode(!!input, !!output); if (!FS.createDevice.major) FS.createDevice.major = 64; var dev = FS.makedev(FS.createDevice.major++, 0); @@ -1648,7 +1648,7 @@ FS.staticInit();` + // been loaded successfully. No-op for files that have been loaded already. forceLoadFile: (obj) => { if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; - if (typeof XMLHttpRequest !== 'undefined') { + if (typeof XMLHttpRequest != 'undefined') { throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); } else if (read_) { // Command-line. @@ -1733,10 +1733,10 @@ FS.staticInit();` + var start = chunkNum * chunkSize; var end = (chunkNum+1) * chunkSize - 1; // including this byte end = Math.min(end, datalength-1); // if datalength-1 is selected, this is the last block - if (typeof(lazyArray.chunks[chunkNum]) === "undefined") { + if (typeof lazyArray.chunks[chunkNum] == 'undefined') { lazyArray.chunks[chunkNum] = doXHR(start, end); } - if (typeof(lazyArray.chunks[chunkNum]) === "undefined") throw new Error("doXHR failed!"); + if (typeof lazyArray.chunks[chunkNum] == 'undefined') throw new Error('doXHR failed!'); return lazyArray.chunks[chunkNum]; }); @@ -1752,7 +1752,7 @@ FS.staticInit();` + this._chunkSize = chunkSize; this.lengthKnown = true; }; - if (typeof XMLHttpRequest !== 'undefined') { + if (typeof XMLHttpRequest != 'undefined') { if (!ENVIRONMENT_IS_WORKER) throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc'; var lazyArray = new LazyUint8Array(); Object.defineProperties(lazyArray, { diff --git a/src/library_glemu.js b/src/library_glemu.js index a22cee4a1136b..5438b1ecbe277 100644 --- a/src/library_glemu.js +++ b/src/library_glemu.js @@ -2814,7 +2814,7 @@ var LibraryGLEmulation = { }; {{{ updateExport('glDisable') }}} - var glTexEnvf = (typeof(_glTexEnvf) != 'undefined') ? _glTexEnvf : () => {}; + var glTexEnvf = (typeof _glTexEnvf != 'undefined') ? _glTexEnvf : () => {}; /** @suppress {checkTypes} */ _glTexEnvf = _emscripten_glTexEnvf = (target, pname, param) => { GLImmediate.TexEnvJIT.hook_texEnvf(target, pname, param); @@ -2823,7 +2823,7 @@ var LibraryGLEmulation = { }; {{{ updateExport('glTexEnvf') }}} - var glTexEnvi = (typeof(_glTexEnvi) != 'undefined') ? _glTexEnvi : () => {}; + var glTexEnvi = (typeof _glTexEnvi != 'undefined') ? _glTexEnvi : () => {}; /** @suppress {checkTypes} */ _glTexEnvi = _emscripten_glTexEnvi = (target, pname, param) => { GLImmediate.TexEnvJIT.hook_texEnvi(target, pname, param); @@ -2832,7 +2832,7 @@ var LibraryGLEmulation = { }; {{{ updateExport('glTexEnvi') }}} - var glTexEnvfv = (typeof(_glTexEnvfv) != 'undefined') ? _glTexEnvfv : () => {}; + var glTexEnvfv = (typeof _glTexEnvfv != 'undefined') ? _glTexEnvfv : () => {}; /** @suppress {checkTypes} */ _glTexEnvfv = _emscripten_glTexEnvfv = (target, pname, param) => { GLImmediate.TexEnvJIT.hook_texEnvfv(target, pname, param); diff --git a/src/library_html5.js b/src/library_html5.js index d0cb5a58a3bd5..d345a4d75dbfa 100644 --- a/src/library_html5.js +++ b/src/library_html5.js @@ -303,7 +303,7 @@ var LibraryHTML5 = { // specialHTMLTargets["!canvas"] = Module.canvas; // (that will let !canvas map to the canvas held in Module.canvas). #if ENVIRONMENT_MAY_BE_WORKER || ENVIRONMENT_MAY_BE_NODE || ENVIRONMENT_MAY_BE_SHELL || USE_PTHREADS - $specialHTMLTargets: "[0, typeof document !== 'undefined' ? document : 0, typeof window !== 'undefined' ? window : 0]", + $specialHTMLTargets: "[0, typeof document != 'undefined' ? document : 0, typeof window != 'undefined' ? window : 0]", #else $specialHTMLTargets: "[0, document, window]", #endif @@ -321,7 +321,7 @@ var LibraryHTML5 = { $findEventTarget: function(target) { target = maybeCStringToJsString(target); #if ENVIRONMENT_MAY_BE_WORKER || ENVIRONMENT_MAY_BE_NODE - var domElement = specialHTMLTargets[target] || (typeof document !== 'undefined' ? document.querySelector(target) : undefined); + var domElement = specialHTMLTargets[target] || (typeof document != 'undefined' ? document.querySelector(target) : undefined); #else var domElement = specialHTMLTargets[target] || document.querySelector(target); #endif @@ -350,7 +350,7 @@ var LibraryHTML5 = { || (target == 'canvas' && Object.keys(GL.offscreenCanvases)[0]) // If that is not found either, query via the regular DOM selector. #if USE_PTHREADS - || (typeof document !== 'undefined' && document.querySelector(target)); + || (typeof document != 'undefined' && document.querySelector(target)); #else || document.querySelector(target); #endif @@ -372,12 +372,12 @@ var LibraryHTML5 = { // since DOM events mostly can default to that. Specific callback registrations // override their own defaults. if (!target) return window; - if (typeof target === "number") target = specialHTMLTargets[target] || UTF8ToString(target); + if (typeof target == "number") target = specialHTMLTargets[target] || UTF8ToString(target); if (target === '#window') return window; else if (target === '#document') return document; else if (target === '#screen') return screen; else if (target === '#canvas') return Module['canvas']; - return (typeof target === 'string') ? document.getElementById(target) : target; + return (typeof target == 'string') ? document.getElementById(target) : target; } catch(e) { // In Web Workers, some objects above, such as '#document' do not exist. Gracefully // return null for them. @@ -388,12 +388,12 @@ var LibraryHTML5 = { // Like findEventTarget, but looks for OffscreenCanvas elements first $findCanvasEventTarget__deps: ['$findEventTarget'], $findCanvasEventTarget: function(target) { - if (typeof target === 'number') target = UTF8ToString(target); + if (typeof target == 'number') target = UTF8ToString(target); if (!target || target === '#canvas') { - if (typeof GL !== 'undefined' && GL.offscreenCanvases['canvas']) return GL.offscreenCanvases['canvas']; // TODO: Remove this line, target '#canvas' should refer only to Module['canvas'], not to GL.offscreenCanvases['canvas'] - but need stricter tests to be able to remove this line. + if (typeof GL != 'undefined' && GL.offscreenCanvases['canvas']) return GL.offscreenCanvases['canvas']; // TODO: Remove this line, target '#canvas' should refer only to Module['canvas'], not to GL.offscreenCanvases['canvas'] - but need stricter tests to be able to remove this line. return Module['canvas']; } - if (typeof GL !== 'undefined' && GL.offscreenCanvases[target]) return GL.offscreenCanvases[target]; + if (typeof GL != 'undefined' && GL.offscreenCanvases[target]) return GL.offscreenCanvases[target]; return findEventTarget(target); }, #endif @@ -697,11 +697,11 @@ var LibraryHTML5 = { emscripten_set_wheel_callback_on_thread__deps: ['$JSEvents', '$registerWheelEventCallback', '$findEventTarget'], emscripten_set_wheel_callback_on_thread: function(target, userData, useCapture, callbackfunc, targetThread) { target = findEventTarget(target); - if (typeof target.onwheel !== 'undefined') { + if (typeof target.onwheel != 'undefined') { registerWheelEventCallback(target, userData, useCapture, callbackfunc, {{{ cDefine('EMSCRIPTEN_EVENT_WHEEL') }}}, "wheel", targetThread); return {{{ cDefine('EMSCRIPTEN_RESULT_SUCCESS') }}}; #if MIN_IE_VERSION <= 8 || MIN_SAFARI_VERSION < 60100 // Browsers that do not support https://caniuse.com/#feat=mdn-api_wheelevent - } else if (typeof target.onmousewheel !== 'undefined') { + } else if (typeof target.onmousewheel != 'undefined') { registerWheelEventCallback(target, userData, useCapture, callbackfunc, {{{ cDefine('EMSCRIPTEN_EVENT_WHEEL') }}}, "mousewheel", targetThread); return {{{ cDefine('EMSCRIPTEN_RESULT_SUCCESS') }}}; #endif @@ -1066,7 +1066,7 @@ var LibraryHTML5 = { emscripten_get_orientation_status__sig: 'ii', emscripten_get_orientation_status__deps: ['$fillOrientationChangeEventData', '$screenOrientation'], emscripten_get_orientation_status: function(orientationChangeEvent) { - if (!screenOrientation() && typeof orientation === 'undefined') return {{{ cDefine('EMSCRIPTEN_RESULT_NOT_SUPPORTED') }}}; + if (!screenOrientation() && typeof orientation == 'undefined') return {{{ cDefine('EMSCRIPTEN_RESULT_NOT_SUPPORTED') }}}; fillOrientationChangeEventData(orientationChangeEvent); return {{{ cDefine('EMSCRIPTEN_RESULT_SUCCESS') }}}; }, @@ -2032,7 +2032,7 @@ var LibraryHTML5 = { emscripten_get_visibility_status__sig: 'ii', emscripten_get_visibility_status__deps: ['$fillVisibilityChangeEventData'], emscripten_get_visibility_status: function(visibilityStatus) { - if (typeof document.visibilityState === 'undefined' && typeof document.hidden === 'undefined') { + if (typeof document.visibilityState == 'undefined' && typeof document.hidden == 'undefined') { return {{{ cDefine('EMSCRIPTEN_RESULT_NOT_SUPPORTED') }}}; } fillVisibilityChangeEventData(visibilityStatus); @@ -2176,14 +2176,14 @@ var LibraryHTML5 = { {{{ makeSetValue('eventStruct+i*8', C_STRUCTS.EmscriptenGamepadEvent.axis, 'e.axes[i]', 'double') }}}; } for (var i = 0; i < e.buttons.length; ++i) { - if (typeof(e.buttons[i]) === 'object') { + if (typeof e.buttons[i] == 'object') { {{{ makeSetValue('eventStruct+i*8', C_STRUCTS.EmscriptenGamepadEvent.analogButton, 'e.buttons[i].value', 'double') }}}; } else { {{{ makeSetValue('eventStruct+i*8', C_STRUCTS.EmscriptenGamepadEvent.analogButton, 'e.buttons[i]', 'double') }}}; } } for (var i = 0; i < e.buttons.length; ++i) { - if (typeof(e.buttons[i]) === 'object') { + if (typeof e.buttons[i] == 'object') { {{{ makeSetValue('eventStruct+i*4', C_STRUCTS.EmscriptenGamepadEvent.digitalButton, 'e.buttons[i].pressed', 'i32') }}}; } else { // Assigning a boolean to HEAP32, that's ok, but Closure would like to warn about it: @@ -2327,7 +2327,7 @@ var LibraryHTML5 = { emscripten_set_beforeunload_callback_on_thread__sig: 'iii', emscripten_set_beforeunload_callback_on_thread__deps: ['$registerBeforeUnloadEventCallback'], emscripten_set_beforeunload_callback_on_thread: function(userData, callbackfunc, targetThread) { - if (typeof onbeforeunload === 'undefined') return {{{ cDefine('EMSCRIPTEN_RESULT_NOT_SUPPORTED') }}}; + if (typeof onbeforeunload == 'undefined') return {{{ cDefine('EMSCRIPTEN_RESULT_NOT_SUPPORTED') }}}; // beforeunload callback can only be registered on the main browser thread, because the page will go away immediately after returning from the handler, // and there is no time to start proxying it anywhere. if (targetThread !== {{{ cDefine('EM_CALLBACK_THREAD_CONTEXT_MAIN_BROWSER_THREAD') }}}) return {{{ cDefine('EMSCRIPTEN_RESULT_INVALID_PARAM') }}}; @@ -2686,7 +2686,7 @@ var LibraryHTML5 = { emscripten_get_device_pixel_ratio__sig: 'd', emscripten_get_device_pixel_ratio: function() { #if ENVIRONMENT_MAY_BE_NODE || ENVIRONMENT_MAY_BE_SHELL - return (typeof devicePixelRatio === 'number' && devicePixelRatio) || 1.0; + return (typeof devicePixelRatio == 'number' && devicePixelRatio) || 1.0; #else // otherwise, on the web and in workers, things are simpler #if MIN_IE_VERSION < 11 || MIN_FIREFOX_VERSION < 18 || MIN_CHROME_VERSION < 4 || MIN_SAFARI_VERSION < 30100 // https://caniuse.com/#feat=devicepixelratio return window.devicePixelRatio || 1.0; diff --git a/src/library_html5_webgl.js b/src/library_html5_webgl.js index 46a6736634182..884b0d6019b5e 100644 --- a/src/library_html5_webgl.js +++ b/src/library_html5_webgl.js @@ -9,7 +9,7 @@ var LibraryHtml5WebGL = { $writeGLArray: function(arr, dst, dstLength, heapType) { #if ASSERTIONS assert(arr); - assert(typeof arr.length !== 'undefined'); + assert(typeof arr.length != 'undefined'); #endif var len = arr.length; var writeLength = dstLength < len ? dstLength : len; @@ -118,7 +118,7 @@ var LibraryHtml5WebGL = { err('Performance warning: forcing renderViaOffscreenBackBuffer=true and preserveDrawingBuffer=true since proxying WebGL rendering.'); #endif // We will be proxying - if OffscreenCanvas is supported, we can proxy a bit more efficiently by avoiding having to create an Offscreen FBO. - if (typeof OffscreenCanvas === 'undefined') { + if (typeof OffscreenCanvas == 'undefined') { {{{ makeSetValue('attributes', C_STRUCTS.EmscriptenWebGLContextAttributes.renderViaOffscreenBackBuffer, '1', 'i32') }}}; {{{ makeSetValue('attributes', C_STRUCTS.EmscriptenWebGLContextAttributes.preserveDrawingBuffer, '1', 'i32') }}}; } @@ -138,12 +138,12 @@ var LibraryHtml5WebGL = { if (canvas.offscreenCanvas) canvas = canvas.offscreenCanvas; #if GL_DEBUG - if (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) out('emscripten_webgl_create_context: Creating an OffscreenCanvas-based WebGL context on target "' + targetStr + '"'); - else if (typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement) out('emscripten_webgl_create_context: Creating an HTMLCanvasElement-based WebGL context on target "' + targetStr + '"'); + if (typeof OffscreenCanvas != 'undefined' && canvas instanceof OffscreenCanvas) out('emscripten_webgl_create_context: Creating an OffscreenCanvas-based WebGL context on target "' + targetStr + '"'); + else if (typeof HTMLCanvasElement != 'undefined' && canvas instanceof HTMLCanvasElement) out('emscripten_webgl_create_context: Creating an HTMLCanvasElement-based WebGL context on target "' + targetStr + '"'); #endif if (contextAttributes.explicitSwapControl) { - var supportsOffscreenCanvas = canvas.transferControlToOffscreen || (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas); + var supportsOffscreenCanvas = canvas.transferControlToOffscreen || (typeof OffscreenCanvas != 'undefined' && canvas instanceof OffscreenCanvas); if (!supportsOffscreenCanvas) { #if OFFSCREEN_FRAMEBUFFER @@ -246,7 +246,7 @@ var LibraryHtml5WebGL = { emscripten_webgl_do_commit_frame__sig: 'i', emscripten_webgl_do_commit_frame: function() { #if TRACE_WEBGL_CALLS - var threadId = (typeof _pthread_self !== 'undefined') ? _pthread_self : function() { return 1; }; + var threadId = (typeof _pthread_self != 'undefined') ? _pthread_self : function() { return 1; }; err('[Thread ' + threadId() + ', GL ctx: ' + GL.currentContext.handle + ']: emscripten_webgl_do_commit_frame()'); #endif if (!GL.currentContext || !GL.currentContext.GLctx) { @@ -389,7 +389,7 @@ var LibraryHtml5WebGL = { // TODO: Add a new build mode, e.g. OFFSCREENCANVAS_SUPPORT=2, which // necessitates OffscreenCanvas support at build time, and "return 1;" here in that build mode. #if OFFSCREENCANVAS_SUPPORT - return typeof OffscreenCanvas !== 'undefined'; + return typeof OffscreenCanvas != 'undefined'; #else return 0; #endif diff --git a/src/library_idbfs.js b/src/library_idbfs.js index 5f351b95e7026..f5d226014bf64 100644 --- a/src/library_idbfs.js +++ b/src/library_idbfs.js @@ -9,9 +9,9 @@ mergeInto(LibraryManager.library, { $IDBFS: { dbs: {}, indexedDB: () => { - if (typeof indexedDB !== 'undefined') return indexedDB; + if (typeof indexedDB != 'undefined') return indexedDB; var ret = null; - if (typeof window === 'object') ret = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; + if (typeof window == 'object') ret = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; assert(ret, 'IDBFS used, but indexedDB not supported'); return ret; }, diff --git a/src/library_noderawfs.js b/src/library_noderawfs.js index ad031d2924529..78f9958308f29 100644 --- a/src/library_noderawfs.js +++ b/src/library_noderawfs.js @@ -83,7 +83,7 @@ mergeInto(LibraryManager.library, { }, utime: function() { fs.utimesSync.apply(void 0, arguments); }, open: function(path, flags, mode, suggestFD) { - if (typeof flags === "string") { + if (typeof flags == "string") { flags = VFS.modeStringToFlags(flags) } var pathTruncated = path.split('/').map(function(s) { return s.substr(0, 255); }).join('/'); @@ -131,7 +131,7 @@ mergeInto(LibraryManager.library, { // this stream is created by in-memory filesystem return VFS.read(stream, buffer, offset, length, position); } - var seeking = typeof position !== 'undefined'; + var seeking = typeof position != 'undefined'; if (!seeking && stream.seekable) position = stream.position; var bytesRead = fs.readSync(stream.nfd, Buffer.from(buffer.buffer), offset, length, position); // update position marker when non-seeking @@ -147,7 +147,7 @@ mergeInto(LibraryManager.library, { // seek to the end before writing in append mode FS.llseek(stream, 0, +"{{{ cDefine('SEEK_END') }}}"); } - var seeking = typeof position !== 'undefined'; + var seeking = typeof position != 'undefined'; if (!seeking && stream.seekable) position = stream.position; var bytesWritten = fs.writeSync(stream.nfd, Buffer.from(buffer.buffer), offset, length, position); // update position marker when non-seeking diff --git a/src/library_openal.js b/src/library_openal.js index 997be92ba2b0e..ab0d9aea1a768 100644 --- a/src/library_openal.js +++ b/src/library_openal.js @@ -181,11 +181,11 @@ var LibraryOpenAL = { audioSrc.connect(src.gain); - if (typeof(audioSrc.start) !== 'undefined') { + if (typeof audioSrc.start != 'undefined') { // Sample the current time as late as possible to mitigate drift startTime = Math.max(startTime, src.context.audioCtx.currentTime); audioSrc.start(startTime, startOffset); - } else if (typeof(audioSrc.noteOn) !== 'undefined') { + } else if (typeof audioSrc.noteOn != 'undefined') { startTime = Math.max(startTime, src.context.audioCtx.currentTime); audioSrc.noteOn(startTime); #if OPENAL_DEBUG @@ -2079,7 +2079,7 @@ var LibraryOpenAL = { } } - if (typeof(AudioContext) !== 'undefined' || typeof(webkitAudioContext) !== 'undefined') { + if (typeof AudioContext != 'undefined' || typeof webkitAudioContext != 'undefined') { var deviceId = AL.newId(); AL.deviceRefCounts[deviceId] = 0; return deviceId; @@ -2202,7 +2202,7 @@ var LibraryOpenAL = { autoResumeAudioContext(ac); // Old Web Audio API (e.g. Safari 6.0.5) had an inconsistently named createGainNode function. - if (typeof(ac.createGain) === 'undefined') { + if (typeof ac.createGain == 'undefined') { ac.createGain = ac.createGainNode; } @@ -2428,16 +2428,16 @@ var LibraryOpenAL = { ret = 'Out of Memory'; break; case 0x1004 /* ALC_DEFAULT_DEVICE_SPECIFIER */: - if (typeof(AudioContext) !== 'undefined' || - typeof(webkitAudioContext) !== 'undefined') { + if (typeof AudioContext != 'undefined' || + typeof webkitAudioContext != 'undefined') { ret = AL.DEVICE_NAME; } else { return 0; } break; case 0x1005 /* ALC_DEVICE_SPECIFIER */: - if (typeof(AudioContext) !== 'undefined' || - typeof(webkitAudioContext) !== 'undefined') { + if (typeof AudioContext != 'undefined' || + typeof webkitAudioContext != 'undefined') { ret = AL.DEVICE_NAME.concat('\0'); } else { ret = '\0'; diff --git a/src/library_path.js b/src/library_path.js index d68e653a66342..7fe59dfc3deeb 100644 --- a/src/library_path.js +++ b/src/library_path.js @@ -94,7 +94,7 @@ mergeInto(LibraryManager.library, { for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { var path = (i >= 0) ? arguments[i] : FS.cwd(); // Skip empty and invalid entries - if (typeof path !== 'string') { + if (typeof path != 'string') { throw new TypeError('Arguments to path.resolve must be strings'); } else if (!path) { return ''; // an invalid portion invalidates the whole thing diff --git a/src/library_pthread.js b/src/library_pthread.js index 00fd658f7c07d..561c654eb0e1f 100644 --- a/src/library_pthread.js +++ b/src/library_pthread.js @@ -31,7 +31,7 @@ var LibraryPThread = { debugInit: function() { function pthreadLogPrefix() { var t = 0; - if (runtimeInitialized && !runtimeExited && typeof _pthread_self !== 'undefined') { + if (runtimeInitialized && !runtimeExited && typeof _pthread_self != 'undefined') { t = _pthread_self(); } return 'w:' + (Module['workerID'] || 0) + ',t:' + ptrToString(t) + ': '; @@ -195,7 +195,7 @@ var LibraryPThread = { }, receiveObjectTransfer: function(data) { #if OFFSCREENCANVAS_SUPPORT - if (typeof GL !== 'undefined') { + if (typeof GL != 'undefined') { Object.assign(GL.offscreenCanvases, data.offscreenCanvases); if (!Module['canvas'] && data.moduleCanvasId && GL.offscreenCanvases[data.moduleCanvasId]) { Module['canvas'] = GL.offscreenCanvases[data.moduleCanvasId].offscreenCanvas; @@ -364,7 +364,7 @@ var LibraryPThread = { #endif #if TRUSTED_TYPES // Use Trusted Types compatible wrappers. - if (typeof trustedTypes !== 'undefined' && trustedTypes.createPolicy) { + if (typeof trustedTypes != 'undefined' && trustedTypes.createPolicy) { var p = trustedTypes.createPolicy( 'emscripten#workerPolicy1', { @@ -390,7 +390,7 @@ var LibraryPThread = { #endif #if TRUSTED_TYPES // Use Trusted Types compatible wrappers. - if (typeof trustedTypes !== 'undefined' && trustedTypes.createPolicy) { + if (typeof trustedTypes != 'undefined' && trustedTypes.createPolicy) { var p = trustedTypes.createPolicy('emscripten#workerPolicy2', { createScriptURL: function(ignored) { return pthreadMainJs } }); PThread.unusedWorkers.push(new Worker(p.createScriptURL('ignored'))); } else @@ -584,7 +584,7 @@ var LibraryPThread = { }, emscripten_has_threading_support: function() { - return typeof SharedArrayBuffer !== 'undefined'; + return typeof SharedArrayBuffer != 'undefined'; }, emscripten_num_logical_cores: function() { @@ -624,7 +624,7 @@ var LibraryPThread = { __pthread_create_js__sig: 'iiiii', __pthread_create_js__deps: ['$spawnThread', 'pthread_self', 'memalign', 'emscripten_sync_run_in_main_thread_4'], __pthread_create_js: function(pthread_ptr, attr, start_routine, arg) { - if (typeof SharedArrayBuffer === 'undefined') { + if (typeof SharedArrayBuffer == 'undefined') { err('Current environment does not support SharedArrayBuffer, pthreads are not available!'); return {{{ cDefine('EAGAIN') }}}; } @@ -669,7 +669,7 @@ var LibraryPThread = { name = Module['canvas'].id; } #if ASSERTIONS - assert(typeof GL === 'object', 'OFFSCREENCANVAS_SUPPORT assumes GL is in use (you can force-include it with -s \'DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=["$GL"]\')'); + assert(typeof GL == 'object', 'OFFSCREENCANVAS_SUPPORT assumes GL is in use (you can force-include it with -s \'DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=["$GL"]\')'); #endif if (GL.offscreenCanvases[name]) { offscreenCanvasInfo = GL.offscreenCanvases[name]; @@ -897,7 +897,7 @@ var LibraryPThread = { for (var i = 0; i < numCallArgs; i++) { var arg = outerArgs[2 + i]; #if WASM_BIGINT - if (typeof arg === 'bigint') { + if (typeof arg == 'bigint') { // The prefix is non-zero to indicate a bigint. HEAP64[b + 2*i] = BigInt(1); HEAP64[b + 2*i + 1] = arg; diff --git a/src/library_pthread_stub.js b/src/library_pthread_stub.js index 1053f803d31ce..bb22d57b68b68 100644 --- a/src/library_pthread_stub.js +++ b/src/library_pthread_stub.js @@ -11,7 +11,7 @@ var LibraryPThreadStub = { emscripten_is_main_browser_thread: function() { #if MINIMAL_RUNTIME - return typeof importScripts === 'undefined'; + return typeof importScripts == 'undefined'; #else return !ENVIRONMENT_IS_WORKER; #endif diff --git a/src/library_sdl.js b/src/library_sdl.js index 4448a208f6884..129d64e6c13e1 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -896,7 +896,7 @@ var LibrarySDL = { // returns false if the event was determined to be irrelevant makeCEvent: function(event, ptr) { - if (typeof event === 'number') { + if (typeof event == 'number') { // This is a pointer to a copy of a native C event that was SDL_PushEvent'ed _memcpy(ptr, event, {{{ C_STRUCTS.SDL_KeyboardEvent.__size__ }}}); _free(event); // the copy is no longer needed @@ -1177,8 +1177,8 @@ var LibrarySDL = { // Initialize Web Audio API if we haven't done so yet. Note: Only initialize Web Audio context ever once on the web page, // since initializing multiple times fails on Chrome saying 'audio resources have been exhausted'. if (!SDL.audioContext) { - if (typeof(AudioContext) !== 'undefined') SDL.audioContext = new AudioContext(); - else if (typeof(webkitAudioContext) !== 'undefined') SDL.audioContext = new webkitAudioContext(); + if (typeof AudioContext != 'undefined') SDL.audioContext = new AudioContext(); + else if (typeof webkitAudioContext != 'undefined') SDL.audioContext = new webkitAudioContext(); } }, @@ -1252,7 +1252,7 @@ var LibrarySDL = { // Abstracts away implementation differences. // Returns 'true' if pressed, 'false' otherwise. getJoystickButtonState: function(button) { - if (typeof button === 'object') { + if (typeof button == 'object') { // Current gamepad API editor's draft (Firefox Nightly) // https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#idl-def-GamepadButton return button['pressed']; @@ -1268,13 +1268,13 @@ var LibrarySDL = { var state = SDL.getGamepad(joystick - 1); var prevState = SDL.lastJoystickState[joystick]; // If joystick was removed, state returns null. - if (typeof state === 'undefined') return; + if (typeof state == 'undefined') return; if (state === null) return; // Check only if the timestamp has differed. // NOTE: Timestamp is not available in Firefox. // NOTE: Timestamp is currently not properly set for the GearVR controller // on Samsung Internet: it is always zero. - if (typeof state.timestamp !== 'number' || state.timestamp !== prevState.timestamp || !state.timestamp) { + if (typeof state.timestamp != 'number' || state.timestamp != prevState.timestamp || !state.timestamp) { var i; for (i = 0; i < state.buttons.length; i++) { var buttonState = SDL.getJoystickButtonState(state.buttons[i]); @@ -1631,7 +1631,7 @@ var LibrarySDL = { var dst = 0; var isScreen = surf == SDL.screen; var num; - if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) { + if (typeof CanvasPixelArray != 'undefined' && data instanceof CanvasPixelArray) { // IE10/IE11: ImageData objects are backed by the deprecated CanvasPixelArray, // not UInt8ClampedArray. These don't have buffers, so we need to revert // to copying a byte at a time. We do the undefined check because modern @@ -1746,7 +1746,7 @@ var LibrarySDL = { SDL_WM_SetCaption__proxy: 'sync', SDL_WM_SetCaption__sig: 'vii', SDL_WM_SetCaption: function(title, icon) { - if (title && typeof setWindowTitle !== 'undefined') { + if (title && typeof setWindowTitle != 'undefined') { setWindowTitle(UTF8ToString(title)); } icon = icon && UTF8ToString(icon); @@ -2584,9 +2584,9 @@ var LibrarySDL = { // Don't ever start buffer playbacks earlier from current time than a given constant 'SDL.audio.bufferingDelay', since a browser // may not be able to mix that audio clip in immediately, and there may be subsequent jitter that might cause the stream to starve. var playtime = Math.max(curtime + SDL.audio.bufferingDelay, SDL.audio.nextPlayTime); - if (typeof source['start'] !== 'undefined') { + if (typeof source['start'] != 'undefined') { source['start'](playtime); // New Web Audio API: sound sources are started with a .start() call. - } else if (typeof source['noteOn'] !== 'undefined') { + } else if (typeof source['noteOn'] != 'undefined') { source['noteOn'](playtime); // Support old Web Audio API specification which had the .noteOn() API. } /* @@ -3195,7 +3195,7 @@ var LibrarySDL = { // like CI might be creating a context here but one that is not entirely // valid. Check that explicitly and fall back to a plain Canvas if we need // to. See https://github.com/emscripten-core/emscripten/issues/16242 - if (typeof SDL.ttfContext.measureText !== 'function') { + if (typeof SDL.ttfContext.measureText != 'function') { throw 'bad context'; } } catch (ex) { @@ -3205,7 +3205,7 @@ var LibrarySDL = { #if ASSERTIONS // Check the final context looks valid. See // https://github.com/emscripten-core/emscripten/issues/16242 - assert(typeof SDL.ttfContext.measureText === 'function', + assert(typeof SDL.ttfContext.measureText == 'function', 'context ' + SDL.ttfContext + 'must provide valid methods'); #endif return 0; diff --git a/src/library_sockfs.js b/src/library_sockfs.js index 1134f741e9b32..e609d2ff87bb5 100644 --- a/src/library_sockfs.js +++ b/src/library_sockfs.js @@ -143,7 +143,7 @@ mergeInto(LibraryManager.library, { createPeer: function(sock, addr, port) { var ws; - if (typeof addr === 'object') { + if (typeof addr == 'object') { ws = addr; addr = null; port = null; @@ -251,7 +251,7 @@ mergeInto(LibraryManager.library, { // if this is a bound dgram socket, send the port number first to allow // us to override the ephemeral port reported to us by remotePort on the // remote end. - if (sock.type === {{{ cDefine('SOCK_DGRAM') }}} && typeof sock.sport !== 'undefined') { + if (sock.type === {{{ cDefine('SOCK_DGRAM') }}} && typeof sock.sport != 'undefined') { #if SOCKET_DEBUG out('websocket queuing port message (port ' + sock.sport + ')'); #endif @@ -300,7 +300,7 @@ mergeInto(LibraryManager.library, { }; function handleMessage(data) { - if (typeof data === 'string') { + if (typeof data == 'string') { var encoder = new TextEncoder(); // should be utf-8 data = encoder.encode(data); // make a typed array from the string } else { @@ -444,7 +444,7 @@ mergeInto(LibraryManager.library, { return 0; }, bind: function(sock, addr, port) { - if (typeof sock.saddr !== 'undefined' || typeof sock.sport !== 'undefined') { + if (typeof sock.saddr != 'undefined' || typeof sock.sport != 'undefined') { throw new FS.ErrnoError({{{ cDefine('EINVAL') }}}); // already bound } sock.saddr = addr; @@ -478,7 +478,7 @@ mergeInto(LibraryManager.library, { // } // early out if we're already connected / in the middle of connecting - if (typeof sock.daddr !== 'undefined' && typeof sock.dport !== 'undefined') { + if (typeof sock.daddr != 'undefined' && typeof sock.dport != 'undefined') { var dest = SOCKFS.websocket_sock_ops.getPeer(sock, sock.daddr, sock.dport); if (dest) { if (dest.socket.readyState === dest.socket.CONNECTING) { @@ -752,7 +752,7 @@ mergeInto(LibraryManager.library, { if (e instanceof ExitStatus) { return; } else { - if (e && typeof e === 'object' && e.stack) err('exception thrown: ' + [e, e.stack]); + if (e && typeof e == 'object' && e.stack) err('exception thrown: ' + [e, e.stack]); throw e; } } diff --git a/src/library_syscall.js b/src/library_syscall.js index fea550030ccf1..3513aabd2f40e 100644 --- a/src/library_syscall.js +++ b/src/library_syscall.js @@ -1134,7 +1134,7 @@ function wrapSyscallFunction(x, library, isWasi) { } var t = library[x]; - if (typeof t === 'string') return; + if (typeof t == 'string') return; t = t.toString(); // If a syscall uses FS, but !SYSCALLS_REQUIRE_FILESYSTEM, then the user @@ -1184,7 +1184,7 @@ function wrapSyscallFunction(x, library, isWasi) { pre += 'try {\n'; handler += "} catch (e) {\n" + - " if (typeof FS === 'undefined' || !(e instanceof FS.ErrnoError)) throw e;\n"; + " if (typeof FS == 'undefined' || !(e instanceof FS.ErrnoError)) throw e;\n"; #if SYSCALL_DEBUG handler += " err('error: syscall failed with ' + e.errno + ' (' + ERRNO_MESSAGES[e.errno] + ')');\n" + diff --git a/src/library_trace.js b/src/library_trace.js index 5658890efe687..a453715f4f3ae 100644 --- a/src/library_trace.js +++ b/src/library_trace.js @@ -219,7 +219,7 @@ var LibraryTracing = { }, emscripten_trace_record_allocation: function(address, size) { - if (typeof Module['onMalloc'] === 'function') Module['onMalloc'](address, size); + if (typeof Module['onMalloc'] == 'function') Module['onMalloc'](address, size); if (EmscriptenTrace.postEnabled) { var now = EmscriptenTrace.now(); EmscriptenTrace.post([EmscriptenTrace.EVENT_ALLOCATE, @@ -228,7 +228,7 @@ var LibraryTracing = { }, emscripten_trace_record_reallocation: function(old_address, new_address, size) { - if (typeof Module['onRealloc'] === 'function') Module['onRealloc'](old_address, new_address, size); + if (typeof Module['onRealloc'] == 'function') Module['onRealloc'](old_address, new_address, size); if (EmscriptenTrace.postEnabled) { var now = EmscriptenTrace.now(); EmscriptenTrace.post([EmscriptenTrace.EVENT_REALLOCATE, @@ -237,7 +237,7 @@ var LibraryTracing = { }, emscripten_trace_record_free: function(address) { - if (typeof Module['onFree'] === 'function') Module['onFree'](address); + if (typeof Module['onFree'] == 'function') Module['onFree'](address); if (EmscriptenTrace.postEnabled) { var now = EmscriptenTrace.now(); EmscriptenTrace.post([EmscriptenTrace.EVENT_FREE, diff --git a/src/library_uuid.js b/src/library_uuid.js index e4980d24cf1d4..7d042735606b7 100644 --- a/src/library_uuid.js +++ b/src/library_uuid.js @@ -45,8 +45,8 @@ mergeInto(LibraryManager.library, { } catch(e) {} #endif // ENVIRONMENT_MAY_BE_NODE } else if (ENVIRONMENT_IS_WEB && - typeof(window.crypto) !== 'undefined' && - typeof(window.crypto.getRandomValues) !== 'undefined') { + typeof window.crypto != 'undefined' && + typeof window.crypto.getRandomValues != 'undefined') { // If crypto.getRandomValues is available try to use it. uuid = new Uint8Array(16); window.crypto.getRandomValues(uuid); diff --git a/src/library_wasi.js b/src/library_wasi.js index a514ba2c40969..d91a7f563c0da 100644 --- a/src/library_wasi.js +++ b/src/library_wasi.js @@ -21,7 +21,7 @@ var WasiLibrary = { // Default values. #if !DETERMINISTIC // Browser language detection #8751 - var lang = ((typeof navigator === 'object' && navigator.languages && navigator.languages[0]) || 'C').replace('-', '_') + '.UTF-8'; + var lang = ((typeof navigator == 'object' && navigator.languages && navigator.languages[0]) || 'C').replace('-', '_') + '.UTF-8'; #else // Deterministic language detection, ignore the browser's language. var lang = 'C.UTF-8'; diff --git a/src/library_webgl.js b/src/library_webgl.js index 5212fcf8ee364..012759efcfe2e 100644 --- a/src/library_webgl.js +++ b/src/library_webgl.js @@ -520,7 +520,7 @@ var LibraryGL = { var numArgs = glCtx[realf].length; if (numArgs === undefined) console.warn('Unexpected WebGL function ' + f + ' when binding TRACE_WEBGL_CALLS'); var contextHandle = glCtx.canvas.GLctxObject.handle; - var threadId = (typeof _pthread_self !== 'undefined') ? _pthread_self : function() { return 1; }; + var threadId = (typeof _pthread_self != 'undefined') ? _pthread_self : function() { return 1; }; // Accessing 'arguments' is super slow, so to avoid overhead, statically reason the number of arguments. switch (numArgs) { case 0: glCtx[f] = function webgl_0() { var ret = glCtx[realf](); err('[Thread ' + threadId() + ', GL ctx: ' + contextHandle + ']: ' + f + '() -> ' + ret); return ret; }; break; @@ -542,8 +542,8 @@ var LibraryGL = { hookWebGL: function(glCtx) { if (!glCtx) glCtx = this.detectWebGLContext(); if (!glCtx) return; - if (!((typeof WebGLRenderingContext !== 'undefined' && glCtx instanceof WebGLRenderingContext) - || (typeof WebGL2RenderingContext !== 'undefined' && glCtx instanceof WebGL2RenderingContext))) { + if (!((typeof WebGLRenderingContext != 'undefined' && glCtx instanceof WebGLRenderingContext) + || (typeof WebGL2RenderingContext != 'undefined' && glCtx instanceof WebGL2RenderingContext))) { return; } @@ -553,7 +553,7 @@ var LibraryGL = { // Hot GL functions are ones that you'd expect to find during render loops (render calls, dynamic resource uploads), cold GL functions are load time functions (shader compilation, texture/mesh creation) // Distinguishing between these two allows pinpointing locations of troublesome GL usage that might cause performance issues. for (var f in glCtx) { - if (typeof glCtx[f] !== 'function' || f.startsWith('real_')) continue; + if (typeof glCtx[f] != 'function' || f.startsWith('real_')) continue; this.hookWebGLFunction(f, glCtx); } // The above injection won't work for texImage2D and texSubImage2D, which have multiple overloads. @@ -622,7 +622,7 @@ var LibraryGL = { if (Module['preinitializedWebGLContext']) { var ctx = Module['preinitializedWebGLContext']; #if MAX_WEBGL_VERSION >= 2 - webGLContextAttributes.majorVersion = (typeof WebGL2RenderingContext !== 'undefined' && ctx instanceof WebGL2RenderingContext) ? 2 : 1; + webGLContextAttributes.majorVersion = (typeof WebGL2RenderingContext != 'undefined' && ctx instanceof WebGL2RenderingContext) ? 2 : 1; #else webGLContextAttributes.majorVersion = 1; #endif @@ -1014,7 +1014,7 @@ var LibraryGL = { if (ctx.canvas) ctx.canvas.GLctxObject = context; GL.contexts[handle] = context; #if GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS - if (typeof webGLContextAttributes.enableExtensionsByDefault === 'undefined' || webGLContextAttributes.enableExtensionsByDefault) { + if (typeof webGLContextAttributes.enableExtensionsByDefault == 'undefined' || webGLContextAttributes.enableExtensionsByDefault) { GL.initExtensions(context); } #endif @@ -1063,7 +1063,7 @@ var LibraryGL = { deleteContext: function(contextHandle) { if (GL.currentContext === GL.contexts[contextHandle]) GL.currentContext = null; - if (typeof JSEvents === 'object') JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas); // Release all JS event handlers on the DOM element that the GL context is associated with since the context is now deleted. + if (typeof JSEvents == 'object') JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas); // Release all JS event handlers on the DOM element that the GL context is associated with since the context is now deleted. if (GL.contexts[contextHandle] && GL.contexts[contextHandle].GLctx.canvas) GL.contexts[contextHandle].GLctx.canvas.GLctxObject = undefined; // Make sure the canvas object no longer refers to the context object so there are no GC surprises. #if USE_PTHREADS _free(GL.contexts[contextHandle].handle); @@ -1294,7 +1294,7 @@ var LibraryGL = { if (ret === undefined) { var result = GLctx.getParameter(name_); - switch (typeof(result)) { + switch (typeof result) { case "number": ret = result; break; @@ -2073,7 +2073,7 @@ var LibraryGL = { // If an integer, we have not yet bound the location, so do it now. The integer value specifies the array index // we should bind to. - if (typeof webglLoc === 'number') { + if (typeof webglLoc == 'number') { p.uniformLocsById[location] = webglLoc = GLctx.getUniformLocation(p, p.uniformArrayNamesById[location] + (webglLoc > 0 ? '[' + webglLoc + ']' : '')); } // Else an already cached WebGLUniformLocation, return it. @@ -4214,14 +4214,14 @@ function recordGLProcAddressGet(lib) { Object.keys(lib).forEach((x) => { if (isJsLibraryConfigIdentifier(x)) return; if (x.substr(0, 2) != 'gl') return; - while (typeof lib[x] === 'string') { + while (typeof lib[x] == 'string') { // resolve aliases right here, simpler for fastcomp copyLibEntry(lib, x, lib[x]); } const y = 'emscripten_' + x; lib[x + '__deps'] = (lib[x + '__deps'] || []).map((dep) => { // prefix dependencies as well - if (typeof dep === 'string' && dep[0] == 'g' && dep[1] == 'l' && lib[dep]) { + if (typeof dep == 'string' && dep[0] == 'g' && dep[1] == 'l' && lib[dep]) { const orig = dep; dep = 'emscripten_' + dep; let fixed = lib[x].toString().replace(new RegExp('_' + orig + '\\(', 'g'), '_' + dep + '('); diff --git a/src/library_webgl2.js b/src/library_webgl2.js index 632436a4bc592..30e356c069cc5 100644 --- a/src/library_webgl2.js +++ b/src/library_webgl2.js @@ -1128,7 +1128,7 @@ var webgl2Funcs = [[0, 'endTransformFeedback pauseTransformFeedback resumeTransf // If user passes -s MAX_WEBGL_VERSION >= 2 -s STRICT=1 but not -lGL (to link in WebGL 1), then WebGL2 library should not // be linked in as well. -if (typeof createGLPassthroughFunctions === 'undefined') { +if (typeof createGLPassthroughFunctions == 'undefined') { throw 'In order to use WebGL 2 in strict mode with -s MAX_WEBGL_VERSION=2, you need to link in WebGL support with -lGL!'; } diff --git a/src/library_webgpu.js b/src/library_webgpu.js index e7523a7f934bf..11297569a3620 100644 --- a/src/library_webgpu.js +++ b/src/library_webgpu.js @@ -73,7 +73,7 @@ return 'assert(' + str + ');'; }, makeCheckDefined: function(name) { - return this.makeCheck('typeof ' + name + ' !== "undefined"'); + return this.makeCheck('typeof ' + name + ' != "undefined"'); }, makeCheckDescriptor: function(descriptor) { // Assert descriptor is non-null, then that its nextInChain is null. @@ -155,7 +155,7 @@ var LibraryWebGPU = { wrapper = wrapper || {}; var id = this.nextId++; - {{{ gpu.makeCheck("typeof this.objects[id] === 'undefined'") }}} + {{{ gpu.makeCheck("typeof this.objects[id] == 'undefined'") }}} wrapper.refcount = 1; wrapper.object = object; this.objects[id] = wrapper; @@ -741,8 +741,8 @@ var LibraryWebGPU = { var OutOfMemory = 0x00000002; var type; #if ASSERTIONS - assert(typeof GPUValidationError !== 'undefined'); - assert(typeof GPUOutOfMemoryError !== 'undefined'); + assert(typeof GPUValidationError != 'undefined'); + assert(typeof GPUOutOfMemoryError != 'undefined'); #endif if (ev.error instanceof GPUValidationError) type = Validation; else if (ev.error instanceof GPUOutOfMemoryError) type = OutOfMemory; diff --git a/src/library_websocket.js b/src/library_websocket.js index d654dc7c03bb8..382c9dffcb075 100644 --- a/src/library_websocket.js +++ b/src/library_websocket.js @@ -248,7 +248,7 @@ var LibraryWebSocket = { err('websocket event "message": socketId='+socketId+',userData='+userData+',callbackFunc='+callbackFunc+')'); #endif HEAPU32[WS.socketEvent>>2] = socketId; - if (typeof e.data === 'string') { + if (typeof e.data == 'string') { var len = lengthBytesUTF8(e.data)+1; var buf = _malloc(len); stringToUTF8(e.data, buf, len); @@ -285,7 +285,7 @@ var LibraryWebSocket = { emscripten_websocket_new__proxy: 'sync', emscripten_websocket_new__sig: 'ii', emscripten_websocket_new: function(createAttributes) { - if (typeof WebSocket === 'undefined') { + if (typeof WebSocket == 'undefined') { #if WEBSOCKET_DEBUG err('emscripten_websocket_new(): WebSocket API is not supported by current browser)'); #endif @@ -423,7 +423,7 @@ var LibraryWebSocket = { emscripten_websocket_is_supported__proxy: 'sync', emscripten_websocket_is_supported__sig: 'i', emscripten_websocket_is_supported: function() { - return typeof WebSocket !== 'undefined'; + return typeof WebSocket != 'undefined'; }, emscripten_websocket_deinitialize__deps: ['$WS'], diff --git a/src/memoryprofiler.js b/src/memoryprofiler.js index dc36733f2e5ea..a4b0bde3c1301 100644 --- a/src/memoryprofiler.js +++ b/src/memoryprofiler.js @@ -15,12 +15,12 @@ var emscriptenMemoryProfiler = { // Allocations of memory blocks larger than this threshold will get their // detailed callstack captured and logged at runtime. - trackedCallstackMinSizeBytes: (typeof new Error().stack === 'undefined') ? Infinity : 16*1024*1024, + trackedCallstackMinSizeBytes: (typeof new Error().stack == 'undefined') ? Infinity : 16*1024*1024, // Allocations from call sites having more than this many outstanding // allocated pointers will get their detailed callstack captured and logged at // runtime. - trackedCallstackMinAllocCount: (typeof new Error().stack === 'undefined') ? Infinity : 10000, + trackedCallstackMinAllocCount: (typeof new Error().stack == 'undefined') ? Infinity : 10000, // If true, we hook into stackAlloc to be able to catch better estimate of the // maximum used STACK space. You might only ever want to set this to false @@ -161,7 +161,7 @@ var emscriptenMemoryProfiler = { }, recordStackWatermark: function() { - if (typeof runtimeInitialized === 'undefined' || runtimeInitialized) { + if (typeof runtimeInitialized == 'undefined' || runtimeInitialized) { var self = emscriptenMemoryProfiler; self.stackTopWatermark = Math.min(self.stackTopWatermark, _emscripten_stack_get_current()); } @@ -251,7 +251,7 @@ var emscriptenMemoryProfiler = { if (!Module['preRun']) Module['preRun'] = []; Module['preRun'].push(function() { emscriptenMemoryProfiler.onPreloadComplete(); }); - if (emscriptenMemoryProfiler.hookStackAlloc && typeof stackAlloc === 'function') { + if (emscriptenMemoryProfiler.hookStackAlloc && typeof stackAlloc == 'function') { // Inject stack allocator. var prevStackAlloc = stackAlloc; var hookedStackAlloc = function(size) { @@ -368,7 +368,7 @@ var emscriptenMemoryProfiler = { }, countOpenALAudioDataSize: function countOpenALAudioDataSize() { - if (typeof AL == "undefined" || !AL.currentContext) return 0; + if (typeof AL == 'undefined' || !AL.currentContext) return 0; var totalMemory = 0; @@ -435,7 +435,7 @@ var emscriptenMemoryProfiler = { }, printHeapResizeLog: function(heapResizes) { - var demangler = typeof demangleAll !== 'undefined' ? demangleAll : function(x) { return x; }; + var demangler = typeof demangleAll != 'undefined' ? demangleAll : function(x) { return x; }; var html = ''; for (var i = 0; i < heapResizes.length; ++i) { var j = i+1; @@ -487,7 +487,7 @@ var emscriptenMemoryProfiler = { self.canvas.width = document.documentElement.clientWidth - 32; } - if (typeof runtimeInitialized !== 'undefined' && !runtimeInitialized) { + if (typeof runtimeInitialized != 'undefined' && !runtimeInitialized) { return; } var stackBase = _emscripten_stack_get_base(); @@ -602,7 +602,7 @@ var emscriptenMemoryProfiler = { html += self.printHeapResizeLog(self.sbrkSources); html += '' } else { - var demangler = typeof demangleAll !== 'undefined' ? demangleAll : function(x) { return x; }; + var demangler = typeof demangleAll != 'undefined' ? demangleAll : function(x) { return x; }; // Print out statistics of individual allocations if they were tracked. if (Object.keys(self.allocationsAtLoc).length > 0) { var calls = []; @@ -632,6 +632,6 @@ var emscriptenMemoryProfiler = { // anymore! function memoryprofiler_add_hooks() { emscriptenMemoryProfiler.initialize(); } -if (typeof Module !== 'undefined' && typeof document !== 'undefined' && typeof window !== 'undefined' && typeof process === 'undefined') emscriptenMemoryProfiler.initialize(); +if (typeof Module != 'undefined' && typeof document != 'undefined' && typeof window != 'undefined' && typeof process == 'undefined') emscriptenMemoryProfiler.initialize(); #endif diff --git a/src/modules.js b/src/modules.js index f6440b59280f4..540c2b923873e 100644 --- a/src/modules.js +++ b/src/modules.js @@ -248,20 +248,20 @@ global.LibraryManager = { } continue; } - if (typeof lib[x] === 'string') { + if (typeof lib[x] == 'string') { let target = x; - while (typeof lib[target] === 'string') { + while (typeof lib[target] == 'string') { // ignore code and variable assignments, aliases are just simple names if (lib[target].search(/[=({; ]/) >= 0) continue libloop; target = lib[target]; } if (!isNaN(target)) continue; // This is a number, and so cannot be an alias target. - if (typeof lib[target] === 'undefined' || typeof lib[target] === 'function') { + if (typeof lib[target] == 'undefined' || typeof lib[target] == 'function') { // When functions are aliased, a signature for the function must be // provided so that an efficient form of forwarding can be // implemented. function testStringType(sig) { - if (typeof lib[sig] !== 'undefined' && typeof typeof lib[sig] !== 'string') { + if (typeof lib[sig] != 'undefined' && typeof typeof lib[sig] != 'string') { error(`${sig} should be a string! (was ${typeof lib[sig]})`); } } @@ -269,12 +269,12 @@ global.LibraryManager = { const targetSig = target + '__sig'; testStringType(aliasSig); testStringType(targetSig); - if (typeof lib[aliasSig] === 'string' && typeof lib[targetSig] === 'string' && lib[aliasSig] != lib[targetSig]) { + if (typeof lib[aliasSig] == 'string' && typeof lib[targetSig] == 'string' && lib[aliasSig] != lib[targetSig]) { error(`${aliasSig} (${lib[aliasSig]}) differs from ${targetSig} (${lib[targetSig]})`); } const sig = lib[aliasSig] || lib[targetSig]; - if (typeof sig !== 'string') { + if (typeof sig != 'string') { error(`Function ${x} aliases to target function ${target}, but neither the alias or the target provide a signature. Please add a ${targetSig}: 'vifj...' annotation or a ${aliasSig}: 'vifj...' annotation to describe the type of function forwarding that is needed!`); } @@ -286,7 +286,7 @@ global.LibraryManager = { lib[targetSig] = lib[aliasSig]; } - if (typeof lib[target] !== 'function') { + if (typeof lib[target] != 'function') { error(`no alias found for ${x}`); } diff --git a/src/parseTools.js b/src/parseTools.js index 25a18fc419c3d..8b0ea3f083a2b 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -259,7 +259,7 @@ function splitI64(value, floatConversion) { function indentify(text, indent) { // Don't try to indentify huge strings - we may run out of memory if (text.length > 1024 * 1024) return text; - if (typeof indent === 'number') { + if (typeof indent == 'number') { const len = indent; indent = ''; for (let i = 0; i < len; i++) { @@ -555,11 +555,11 @@ function getFastValue(a, op, b, type) { let aNumber = null; let bNumber = null; - if (typeof a === 'number') { + if (typeof a == 'number') { aNumber = a; a = a.toString(); } else if (isNumber(a)) aNumber = parseFloat(a); - if (typeof b === 'number') { + if (typeof b == 'number') { bNumber = b; b = b.toString(); } else if (isNumber(b)) bNumber = parseFloat(b); @@ -896,7 +896,7 @@ function makeRetainedCompilerSettings() { for (const x in global) { if (!ignore.has(x) && x[0] !== '_' && x == x.toUpperCase()) { try { - if (typeof global[x] === 'number' || typeof global[x] === 'string' || this.isArray()) { + if (typeof global[x] == 'number' || typeof global[x] == 'string' || this.isArray()) { ret[x] = global[x]; } } catch (e) {} diff --git a/src/polyfill/objassign.js b/src/polyfill/objassign.js index ebb9a43edd79e..c8991888f557a 100644 --- a/src/polyfill/objassign.js +++ b/src/polyfill/objassign.js @@ -5,7 +5,7 @@ assert(false, "this file should never be included unless POLYFILL is set"); #endif -if (typeof Object.assign === 'undefined') { +if (typeof Object.assign == 'undefined') { /** * Equivalent to the Object.assign() method, but guaranteed to be available for use in code * generated by the compiler. diff --git a/src/polyfill/promise.js b/src/polyfill/promise.js index ce7f0d24b5e87..55cfe10bc701f 100644 --- a/src/polyfill/promise.js +++ b/src/polyfill/promise.js @@ -46,7 +46,7 @@ var Promise = (function() { function Promise(fn) { if (!(this instanceof Promise)) throw new TypeError('Promises must be constructed via new'); - if (typeof fn !== 'function') throw new TypeError('not a function'); + if (typeof fn != 'function') throw new TypeError('not a function'); /** @type {!number} */ this._state = 0; /** @type {!boolean} */ @@ -92,7 +92,7 @@ var Promise = (function() { throw new TypeError('A promise cannot be resolved with itself.'); if ( newValue && - (typeof newValue === 'object' || typeof newValue === 'function') + (typeof newValue == 'object' || typeof newValue == 'function') ) { var then = newValue.then; if (newValue instanceof Promise) { @@ -100,7 +100,7 @@ var Promise = (function() { self._value = newValue; finale(self); return; - } else if (typeof then === 'function') { + } else if (typeof then == 'function') { doResolve(bind(then, newValue), self); return; } @@ -138,8 +138,8 @@ var Promise = (function() { * @constructor */ function Handler(onFulfilled, onRejected, promise) { - this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; - this.onRejected = typeof onRejected === 'function' ? onRejected : null; + this.onFulfilled = typeof onFulfilled == 'function' ? onFulfilled : null; + this.onRejected = typeof onRejected == 'function' ? onRejected : null; this.promise = promise; } @@ -195,9 +195,9 @@ var Promise = (function() { function res(i, val) { try { - if (val && (typeof val === 'object' || typeof val === 'function')) { + if (val && (typeof val == 'object' || typeof val == 'function')) { var then = val.then; - if (typeof then === 'function') { + if (typeof then == 'function') { then.call( val, function(val) { @@ -224,7 +224,7 @@ var Promise = (function() { }; Promise.resolve = function(value) { - if (value && typeof value === 'object' && value.constructor === Promise) { + if (value && typeof value == 'object' && value.constructor == Promise) { return value; } @@ -254,7 +254,7 @@ var Promise = (function() { // Use polyfill for setImmediate for performance gains Promise._immediateFn = // @ts-ignore - (typeof setImmediate === 'function' && + (typeof setImmediate == 'function' && function(fn) { // @ts-ignore setImmediate(fn); @@ -264,7 +264,7 @@ var Promise = (function() { }; Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) { - if (typeof console !== 'undefined' && console) { + if (typeof console != 'undefined' && console) { console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console } }; diff --git a/src/postamble_minimal.js b/src/postamble_minimal.js index f145a923ffe49..2676c85c386cc 100644 --- a/src/postamble_minimal.js +++ b/src/postamble_minimal.js @@ -252,7 +252,7 @@ WebAssembly.instantiate(Module['wasm'], imports).then(function(output) { #if WASM == 2 #if ENVIRONMENT_MAY_BE_NODE || ENVIRONMENT_MAY_BE_SHELL - if (typeof location !== 'undefined') { + if (typeof location != 'undefined') { #endif // WebAssembly compilation failed, try running the JS fallback instead. var search = location.search; diff --git a/src/preamble.js b/src/preamble.js index 9fb3bcbda71be..6cb195fcc1163 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -37,7 +37,7 @@ if (Module['doWasm2JS']) { #endif #if WASM == 1 -if (typeof WebAssembly !== 'object') { +if (typeof WebAssembly != 'object') { abort('no native wasm support detected'); } #endif @@ -288,7 +288,7 @@ if (Module['TOTAL_STACK']) assert(TOTAL_STACK === Module['TOTAL_STACK'], 'the st 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, +assert(typeof Int32Array != 'undefined' && typeof Float64Array !== 'undefined' && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, 'JS engine does not provide full typed array support'); #endif @@ -499,7 +499,7 @@ function addRunDependency(id) { if (id) { assert(!runDependencyTracking[id]); runDependencyTracking[id] = 1; - if (runDependencyWatcher === null && typeof setInterval !== 'undefined') { + if (runDependencyWatcher === null && typeof setInterval != 'undefined') { // Check for missing dependencies every few seconds runDependencyWatcher = setInterval(function() { if (ABORT) { @@ -715,7 +715,7 @@ function instrumentWasmExportsWithAbort(exports) { var instExports = {}; for (var name in exports) { var original = exports[name]; - if (typeof original === 'function') { + if (typeof original == 'function') { instExports[name] = makeAbortWrapper(original); } else { instExports[name] = original; @@ -838,7 +838,7 @@ function getBinaryPromise() { // Cordova or Electron apps are typically loaded from a file:// url. // So use fetch if it is available and the url is not a file, otherwise fall back to XHR. if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) { - if (typeof fetch === 'function' + if (typeof fetch == 'function' #if ENVIRONMENT_MAY_BE_WEBVIEW && !isFileURI(wasmBinaryFile) #endif @@ -1153,7 +1153,7 @@ function createWasm() { #if WASM == 2 #if ENVIRONMENT_MAY_BE_NODE || ENVIRONMENT_MAY_BE_SHELL - if (typeof location !== 'undefined') { + if (typeof location != 'undefined') { #endif // WebAssembly compilation failed, try running the JS fallback instead. var search = location.search; @@ -1181,13 +1181,13 @@ function createWasm() { function instantiateAsync() { if (!wasmBinary && - typeof WebAssembly.instantiateStreaming === 'function' && + typeof WebAssembly.instantiateStreaming == 'function' && !isDataURI(wasmBinaryFile) && #if ENVIRONMENT_MAY_BE_WEBVIEW // Don't use streaming for file:// delivered objects in a webview, fetch them synchronously. !isFileURI(wasmBinaryFile) && #endif - typeof fetch === 'function') { + typeof fetch == 'function') { return fetch(wasmBinaryFile, { credentials: 'same-origin' }).then(function (response) { // Suppress closure warning here since the upstream definition for // instantiateStreaming only allows Promise rather than diff --git a/src/proxyClient.js b/src/proxyClient.js index 8e5067452025e..2275a66bd58cd 100644 --- a/src/proxyClient.js +++ b/src/proxyClient.js @@ -6,7 +6,7 @@ // proxy to/from worker -if (typeof Module === 'undefined') { +if (typeof Module == 'undefined') { console.warn('no Module object defined - cannot proxy canvas rendering and input events, etc.'); Module = { print: function(x) { @@ -271,7 +271,7 @@ function cloneObject(event) { for (var x in event) { if (x == x.toUpperCase()) continue; var prop = event[x]; - if (typeof prop === 'number' || typeof prop === 'string') ret[x] = prop; + if (typeof prop == 'number' || typeof prop == 'string') ret[x] = prop; } return ret; }; diff --git a/src/proxyWorker.js b/src/proxyWorker.js index 496c7e60e5b2e..a8fbb70fe7a4e 100644 --- a/src/proxyWorker.js +++ b/src/proxyWorker.js @@ -4,23 +4,23 @@ * SPDX-License-Identifier: MIT */ -if (typeof console === 'undefined') { +if (typeof console == 'undefined') { // we can't call Module.printErr because that might be circular var console = { log: function(x) { - if (typeof dump === 'function') dump('log: ' + x + '\n'); + if (typeof dump == 'function') dump('log: ' + x + '\n'); }, debug: function(x) { - if (typeof dump === 'function') dump('debug: ' + x + '\n'); + if (typeof dump == 'function') dump('debug: ' + x + '\n'); }, info: function(x) { - if (typeof dump === 'function') dump('info: ' + x + '\n'); + if (typeof dump == 'function') dump('info: ' + x + '\n'); }, warn: function(x) { - if (typeof dump === 'function') dump('warn: ' + x + '\n'); + if (typeof dump == 'function') dump('warn: ' + x + '\n'); }, error: function(x) { - if (typeof dump === 'function') dump('error: ' + x + '\n'); + if (typeof dump == 'function') dump('error: ' + x + '\n'); }, }; } @@ -511,7 +511,7 @@ if (!ENVIRONMENT_IS_PTHREAD) { // proxyWorker.js has defined 'document' and 'window' objects above, so need to // initialize them for library_html5.js explicitly here. -if (typeof specialHTMLTargets !== 'undefined') { +if (typeof specialHTMLTargets != 'undefined') { specialHTMLTargets = [0, document, window]; } diff --git a/src/runtime_debug.js b/src/runtime_debug.js index dbe4ba4b7548b..b7ec162899d36 100644 --- a/src/runtime_debug.js +++ b/src/runtime_debug.js @@ -45,12 +45,12 @@ function prettyPrint(arg) { ret += 'f32:' + arr.toString().replace(/,/g, ',') + '}'; return ret; } - if (typeof arg === 'function') { + if (typeof arg == 'function') { return ''; - } else if (typeof arg === 'object') { + } else if (typeof arg == 'object') { printObjectList.push(arg); return '<' + arg + '|' + (printObjectList.length-1) + '>'; - } else if (typeof arg === 'number') { + } else if (typeof arg == 'number') { if (arg > 0) return '0x' + arg.toString(16) + ' (' + arg + ')'; } return arg; diff --git a/src/runtime_functions.js b/src/runtime_functions.js index fa1a2d2afbb91..d638a41f55835 100644 --- a/src/runtime_functions.js +++ b/src/runtime_functions.js @@ -14,7 +14,7 @@ function convertJsFunctionToWasm(func, sig) { // "WebAssembly.Function" constructor. // Otherwise, construct a minimal wasm module importing the JS function and // re-exporting it. - if (typeof WebAssembly.Function === "function") { + if (typeof WebAssembly.Function == "function") { var typeNames = { 'i': 'i32', 'j': 'i64', @@ -131,7 +131,7 @@ function updateTableMap(offset, count) { */ function addFunction(func, sig) { #if ASSERTIONS - assert(typeof func !== 'undefined'); + assert(typeof func != 'undefined'); #endif // ASSERTIONS // Check if the function is already in the table, to ensure each function @@ -166,7 +166,7 @@ function addFunction(func, sig) { throw err; } #if ASSERTIONS - assert(typeof sig !== 'undefined', 'Missing signature argument to addFunction: ' + func); + assert(typeof sig != 'undefined', 'Missing signature argument to addFunction: ' + func); #endif var wrapped = convertJsFunctionToWasm(func, sig); setWasmTableEntry(ret, wrapped); diff --git a/src/runtime_legacy.js b/src/runtime_legacy.js index 9b4b88cb23471..863f2a043a900 100644 --- a/src/runtime_legacy.js +++ b/src/runtime_legacy.js @@ -19,8 +19,8 @@ var ALLOC_STACK = 1; // Lives for the duration of the current function call function allocate(slab, allocator) { var ret; #if ASSERTIONS - assert(typeof allocator === 'number', 'allocate no longer takes a type argument') - assert(typeof slab !== 'number', 'allocate no longer takes a number as arg0') + assert(typeof allocator == 'number', 'allocate no longer takes a type argument') + assert(typeof slab != 'number', 'allocate no longer takes a number as arg0') #endif if (allocator == ALLOC_STACK) { diff --git a/src/runtime_strings.js b/src/runtime_strings.js index cb45fdf37c67e..3b10d6c3eb3dd 100644 --- a/src/runtime_strings.js +++ b/src/runtime_strings.js @@ -39,7 +39,7 @@ function TextDecoderWrapper(encoding) { var UTF8Decoder = new TextDecoder{{{ USE_PTHREADS ? 'Wrapper' : ''}}}('utf8'); #else // TEXTDECODER == 2 #if TEXTDECODER -var UTF8Decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder{{{ USE_PTHREADS ? 'Wrapper' : ''}}}('utf8') : undefined; +var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder{{{ USE_PTHREADS ? 'Wrapper' : ''}}}('utf8') : undefined; #endif // TEXTDECODER #endif // TEXTDECODER == 2 diff --git a/src/runtime_strings_extra.js b/src/runtime_strings_extra.js index c9d33a707ebf9..e471aaab37f02 100644 --- a/src/runtime_strings_extra.js +++ b/src/runtime_strings_extra.js @@ -35,7 +35,7 @@ function stringToAscii(str, outPtr) { var UTF16Decoder = new TextDecoder{{{ USE_PTHREADS ? 'Wrapper' : ''}}}('utf-16le'); #else // TEXTDECODER == 2 #if TEXTDECODER -var UTF16Decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder{{{ USE_PTHREADS ? 'Wrapper' : ''}}}('utf-16le') : undefined; +var UTF16Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder{{{ USE_PTHREADS ? 'Wrapper' : ''}}}('utf-16le') : undefined; #endif // TEXTDECODER #endif // TEXTDECODER == 2 diff --git a/src/shell.js b/src/shell.js index 8bbc1748469e6..408a64cf669ec 100644 --- a/src/shell.js +++ b/src/shell.js @@ -36,7 +36,7 @@ var /** @type {{ */ Module; if (!Module) /** @suppress{checkTypes}*/Module = {"__EMSCRIPTEN_PRIVATE_MODULE_EXPORT_NAME_SUBSTITUTION__":1}; #else -var Module = typeof {{{ EXPORT_NAME }}} !== 'undefined' ? {{{ EXPORT_NAME }}} : {}; +var Module = typeof {{{ EXPORT_NAME }}} != 'undefined' ? {{{ EXPORT_NAME }}} : {}; #endif // USE_CLOSURE_COMPILER #if POLYFILL @@ -89,7 +89,7 @@ var quit_ = (status, toThrow) => { var ENVIRONMENT_IS_WEB = {{{ ENVIRONMENT === 'web' }}}; #if USE_PTHREADS && ENVIRONMENT_MAY_BE_NODE // node+pthreads always supports workers; detect which we are at runtime -var ENVIRONMENT_IS_WORKER = typeof importScripts === 'function'; +var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function'; #else var ENVIRONMENT_IS_WORKER = {{{ ENVIRONMENT === 'worker' }}}; #endif @@ -97,11 +97,11 @@ var ENVIRONMENT_IS_NODE = {{{ ENVIRONMENT === 'node' }}}; var ENVIRONMENT_IS_SHELL = {{{ ENVIRONMENT === 'shell' }}}; #else // ENVIRONMENT // Attempt to auto-detect the environment -var ENVIRONMENT_IS_WEB = typeof window === 'object'; -var ENVIRONMENT_IS_WORKER = typeof importScripts === 'function'; +var ENVIRONMENT_IS_WEB = typeof window == 'object'; +var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function'; // 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'; +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; #endif // ENVIRONMENT @@ -127,7 +127,7 @@ var ENVIRONMENT_IS_PTHREAD = Module['ENVIRONMENT_IS_PTHREAD'] || false; #if EXPORT_ES6 var _scriptDir = import.meta.url; #else -var _scriptDir = (typeof document !== 'undefined' && document.currentScript) ? document.currentScript.src : undefined; +var _scriptDir = (typeof document != 'undefined' && document.currentScript) ? document.currentScript.src : undefined; if (ENVIRONMENT_IS_WORKER) { _scriptDir = self.location.href; @@ -169,7 +169,7 @@ function logExceptionOnExit(e) { if (e instanceof ExitStatus) return; let toLog = e; #if ASSERTIONS - if (e && typeof e === 'object' && e.stack) { + if (e && typeof e == 'object' && e.stack) { toLog = [e, e.stack]; } #endif @@ -185,7 +185,7 @@ var requireNodeFS; if (ENVIRONMENT_IS_NODE) { #if ENVIRONMENT #if ASSERTIONS - 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 (!(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?)'); #endif #endif if (ENVIRONMENT_IS_WORKER) { @@ -205,7 +205,7 @@ if (ENVIRONMENT_IS_NODE) { #if MODULARIZE // MODULARIZE will export the module in the proper place outside, we don't need to export here #else - if (typeof module !== 'undefined') { + if (typeof module != 'undefined') { module['exports'] = Module; } #endif @@ -252,7 +252,7 @@ if (ENVIRONMENT_IS_NODE) { #if WASM == 2 // If target shell does not support Wasm, load the JS version of the code. - if (typeof WebAssembly === 'undefined') { + if (typeof WebAssembly == 'undefined') { requireNodeFS(); eval(fs.readFileSync(locateFile('{{{ TARGET_BASENAME }}}.wasm.js'))+''); } @@ -265,7 +265,7 @@ if (ENVIRONMENT_IS_SHELL) { #if ENVIRONMENT #if ASSERTIONS - 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 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?)'); #endif #endif @@ -289,11 +289,11 @@ if (ENVIRONMENT_IS_SHELL) { return data; } #endif - if (typeof readbuffer === 'function') { + if (typeof readbuffer == 'function') { return new Uint8Array(readbuffer(f)); } data = read(f, 'binary'); - assert(typeof data === 'object'); + assert(typeof data == 'object'); return data; }; @@ -307,23 +307,23 @@ if (ENVIRONMENT_IS_SHELL) { arguments_ = arguments; } - if (typeof quit === 'function') { + if (typeof quit == 'function') { quit_ = (status, toThrow) => { logExceptionOnExit(toThrow); quit(status); }; } - if (typeof print !== 'undefined') { + if (typeof print != 'undefined') { // Prefer to use print/printErr where they exist, as they usually work better. - if (typeof console === 'undefined') console = /** @type{!Console} */({}); + 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); + console.warn = console.error = /** @type{!function(this:Console, ...*): undefined} */ (typeof printErr != 'undefined' ? printErr : print); } #if WASM == 2 // If target shell does not support Wasm, load the JS version of the code. - if (typeof WebAssembly === 'undefined') { + if (typeof WebAssembly == 'undefined') { eval(read(locateFile('{{{ TARGET_BASENAME }}}.wasm.js'))+''); } #endif @@ -338,7 +338,7 @@ if (ENVIRONMENT_IS_SHELL) { if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { if (ENVIRONMENT_IS_WORKER) { // Check worker, not web, since window could be polyfilled scriptDirectory = self.location.href; - } else if (typeof document !== 'undefined' && document.currentScript) { // web + } else if (typeof document != 'undefined' && document.currentScript) { // web scriptDirectory = document.currentScript.src; } #if MODULARIZE @@ -362,7 +362,7 @@ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { #if ENVIRONMENT #if ASSERTIONS - 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 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?)'); #endif #endif @@ -388,7 +388,7 @@ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { if (ENVIRONMENT_IS_NODE) { // Polyfill the performance object, which emscripten pthreads support // depends on for good timing. - if (typeof performance === 'undefined') { + if (typeof performance == 'undefined') { global.performance = require('perf_hooks').performance; } } @@ -430,15 +430,15 @@ moduleOverrides = null; // perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message #if ASSERTIONS // 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'); +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'); {{{ makeRemovedModuleAPIAssert('read', 'read_') }}} {{{ makeRemovedModuleAPIAssert('readAsync') }}} {{{ makeRemovedModuleAPIAssert('readBinary') }}} diff --git a/src/shell_minimal.js b/src/shell_minimal.js index 8384993c8bc57..d317aa61eb1a6 100644 --- a/src/shell_minimal.js +++ b/src/shell_minimal.js @@ -25,11 +25,11 @@ Module['ready'] = new Promise((resolve, reject) => { #endif #if ENVIRONMENT_MAY_BE_NODE -var ENVIRONMENT_IS_NODE = typeof process === 'object'; +var ENVIRONMENT_IS_NODE = typeof process == 'object'; #endif #if ENVIRONMENT_MAY_BE_SHELL -var ENVIRONMENT_IS_SHELL = typeof read === 'function'; +var ENVIRONMENT_IS_SHELL = typeof read == 'function'; #endif #if ASSERTIONS || USE_PTHREADS @@ -59,7 +59,7 @@ if (ENVIRONMENT_IS_NODE && ENVIRONMENT_IS_SHELL) { if (ENVIRONMENT_IS_NODE) { var fs = require('fs'); #if WASM == 2 - if (typeof WebAssembly !== 'undefined') Module['wasm'] = fs.readFileSync(__dirname + '/{{{ TARGET_BASENAME }}}.wasm'); + if (typeof WebAssembly != 'undefined') Module['wasm'] = fs.readFileSync(__dirname + '/{{{ TARGET_BASENAME }}}.wasm'); else eval(fs.readFileSync(__dirname + '/{{{ TARGET_BASENAME }}}.wasm.js')+''); #else #if !WASM2JS @@ -75,7 +75,7 @@ if (ENVIRONMENT_IS_NODE) { #if ENVIRONMENT_MAY_BE_SHELL && ((WASM == 1 && (!WASM2JS || !MEM_INIT_IN_WASM)) || WASM == 2) if (ENVIRONMENT_IS_SHELL) { #if WASM == 2 - if (typeof WebAssembly !== 'undefined') Module['wasm'] = read('{{{ TARGET_BASENAME }}}.wasm', 'binary'); + if (typeof WebAssembly != 'undefined') Module['wasm'] = read('{{{ TARGET_BASENAME }}}.wasm', 'binary'); else eval(read('{{{ TARGET_BASENAME }}}.wasm.js')+''); #else #if !WASM2JS @@ -142,14 +142,14 @@ function ready() { #if !MODULARIZE // In MODULARIZE mode _scriptDir needs to be captured already at the very top of the page immediately when the page is parsed, so it is generated there // before the page load. In non-MODULARIZE modes generate it here. -var _scriptDir = (typeof document !== 'undefined' && document.currentScript) ? document.currentScript.src : undefined; +var _scriptDir = (typeof document != 'undefined' && document.currentScript) ? document.currentScript.src : undefined; #endif // MINIMAL_RUNTIME does not support --proxy-to-worker option, so Worker and Pthread environments // coincide. -var ENVIRONMENT_IS_WORKER = ENVIRONMENT_IS_PTHREAD = typeof importScripts === 'function'; +var ENVIRONMENT_IS_WORKER = ENVIRONMENT_IS_PTHREAD = typeof importScripts == 'function'; -var currentScriptUrl = typeof _scriptDir !== 'undefined' ? _scriptDir : ((typeof document !== 'undefined' && document.currentScript) ? document.currentScript.src : undefined); +var currentScriptUrl = typeof _scriptDir != 'undefined' ? _scriptDir : ((typeof document != 'undefined' && document.currentScript) ? document.currentScript.src : undefined); #endif // USE_PTHREADS {{BODY}} diff --git a/src/source_map_support.js b/src/source_map_support.js index 87b1061610b97..0b59e1bf08aff 100644 --- a/src/source_map_support.js +++ b/src/source_map_support.js @@ -109,7 +109,7 @@ function getSourceMap() { } function getSourceMapPromise() { - if ((ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) && typeof fetch === 'function') { + if ((ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) && typeof fetch == 'function') { return fetch(wasmSourceMapFile, { credentials: 'same-origin' }).then(function(response) { return response['json'](); }).catch(function () { diff --git a/src/threadprofiler.js b/src/threadprofiler.js index 07e3e250c5347..6ff8daca453c2 100644 --- a/src/threadprofiler.js +++ b/src/threadprofiler.js @@ -52,7 +52,7 @@ var emscriptenThreadProfiler = { }, updateUi: function updateUi() { - if (typeof PThread === 'undefined') { + if (typeof PThread == 'undefined') { // Likely running threadprofiler on a singlethreaded build, or not // initialized yet, ignore updating. return; @@ -97,10 +97,10 @@ var emscriptenThreadProfiler = { } }; -if (typeof Module !== 'undefined') { - if (typeof document !== 'undefined') { +if (typeof Module != 'undefined') { + if (typeof document != 'undefined') { emscriptenThreadProfiler.initialize(); - } else if (!ENVIRONMENT_IS_PTHREAD && typeof process !== 'undefined') { + } else if (!ENVIRONMENT_IS_PTHREAD && typeof process != 'undefined') { emscriptenThreadProfiler.initializeNode(); } } diff --git a/src/utility.js b/src/utility.js index af5ecf8cbffc9..d4fcde8e88c4c 100644 --- a/src/utility.js +++ b/src/utility.js @@ -16,7 +16,7 @@ function safeQuote(x) { function dump(item) { let funcData; try { - if (typeof item == 'object' && item !== null && item.funcData) { + if (typeof item == 'object' && item != null && item.funcData) { funcData = item.funcData; item.funcData = null; } @@ -26,7 +26,7 @@ function dump(item) { for (const i in item) { if (Object.prototype.hasOwnProperty.call(item, i)) { const j = item[i]; - if (typeof j === 'string' || typeof j === 'number') { + if (typeof j == 'string' || typeof j == 'number') { ret.push(i + ': ' + j); } else { ret.push(i + ': [?]'); @@ -98,7 +98,7 @@ function mergeInto(obj, other) { function isNumber(x) { // XXX this does not handle 0xabc123 etc. We should likely also do x == parseInt(x) (which handles that), and remove hack |// handle 0x... as well| - return x == parseFloat(x) || (typeof x == 'string' && x.match(/^-?\d+$/)) || x === 'NaN'; + return x == parseFloat(x) || (typeof x == 'string' && x.match(/^-?\d+$/)) || x == 'NaN'; } function isJsLibraryConfigIdentifier(ident) { diff --git a/src/webGLWorker.js b/src/webGLWorker.js index e13c5c89a2040..f7761e03460d3 100644 --- a/src/webGLWorker.js +++ b/src/webGLWorker.js @@ -867,7 +867,7 @@ function WebGLWorker() { }; function duplicate(something) { // clone data properly: handles numbers, null, typed arrays, js arrays and array buffers - if (!something || typeof something === 'number') return something; + if (!something || typeof something == 'number') return something; if (something.slice) return something.slice(0); // ArrayBuffer or js array return new something.constructor(something); // typed array } diff --git a/src/worker.js b/src/worker.js index 1358229103873..0283ccc3ea41e 100644 --- a/src/worker.js +++ b/src/worker.js @@ -14,7 +14,7 @@ var Module = {}; #if ENVIRONMENT_MAY_BE_NODE // Node.js support -var ENVIRONMENT_IS_NODE = typeof process === 'object' && typeof process.versions === 'object' && typeof process.versions.node === 'string'; +var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string'; if (ENVIRONMENT_IS_NODE) { // Create as web-worker-like an environment as we can. @@ -156,9 +156,9 @@ self.onmessage = (e) => { Module = instance; }); #else - if (typeof e.data.urlOrBlob === 'string') { + if (typeof e.data.urlOrBlob == 'string') { #if TRUSTED_TYPES - if (typeof self.trustedTypes !== 'undefined' && self.trustedTypes.createPolicy) { + if (typeof self.trustedTypes != 'undefined' && self.trustedTypes.createPolicy) { var p = self.trustedTypes.createPolicy('emscripten#workerPolicy3', { createScriptURL: function(ignored) { return e.data.urlOrBlob } }); importScripts(p.createScriptURL('ignored')); } else @@ -167,7 +167,7 @@ self.onmessage = (e) => { } else { var objectUrl = URL.createObjectURL(e.data.urlOrBlob); #if TRUSTED_TYPES - if (typeof self.trustedTypes !== 'undefined' && self.trustedTypes.createPolicy) { + if (typeof self.trustedTypes != 'undefined' && self.trustedTypes.createPolicy) { var p = self.trustedTypes.createPolicy('emscripten#workerPolicy3', { createScriptURL: function(ignored) { return objectUrl } }); importScripts(p.createScriptURL('ignored')); } else diff --git a/tests/code_size/hello_webgl2_wasm.json b/tests/code_size/hello_webgl2_wasm.json index c086bb8ed68c4..acd07b7f8228a 100644 --- a/tests/code_size/hello_webgl2_wasm.json +++ b/tests/code_size/hello_webgl2_wasm.json @@ -1,10 +1,10 @@ { "a.html": 569, "a.html.gz": 379, - "a.js": 4974, - "a.js.gz": 2418, + "a.js": 4973, + "a.js.gz": 2417, "a.wasm": 10440, "a.wasm.gz": 6666, - "total": 15983, - "total_gz": 9463 + "total": 15982, + "total_gz": 9462 } diff --git a/tests/code_size/hello_webgl2_wasm2js.json b/tests/code_size/hello_webgl2_wasm2js.json index 7cefaa2835731..690c20403a46a 100644 --- a/tests/code_size/hello_webgl2_wasm2js.json +++ b/tests/code_size/hello_webgl2_wasm2js.json @@ -1,10 +1,10 @@ { "a.html": 594, "a.html.gz": 389, - "a.js": 20090, - "a.js.gz": 8209, + "a.js": 20089, + "a.js.gz": 8208, "a.mem": 3171, "a.mem.gz": 2714, - "total": 23855, - "total_gz": 11312 + "total": 23854, + "total_gz": 11311 } diff --git a/tests/code_size/hello_webgl_wasm.json b/tests/code_size/hello_webgl_wasm.json index 73994feeb885f..120c62bf93ce7 100644 --- a/tests/code_size/hello_webgl_wasm.json +++ b/tests/code_size/hello_webgl_wasm.json @@ -1,10 +1,10 @@ { "a.html": 569, "a.html.gz": 379, - "a.js": 4480, - "a.js.gz": 2251, + "a.js": 4479, + "a.js.gz": 2250, "a.wasm": 10440, "a.wasm.gz": 6666, - "total": 15489, - "total_gz": 9296 + "total": 15488, + "total_gz": 9295 } diff --git a/tests/code_size/hello_webgl_wasm2js.json b/tests/code_size/hello_webgl_wasm2js.json index 57f041cd0c610..7a014eefc19a3 100644 --- a/tests/code_size/hello_webgl_wasm2js.json +++ b/tests/code_size/hello_webgl_wasm2js.json @@ -1,10 +1,10 @@ { "a.html": 594, "a.html.gz": 389, - "a.js": 19575, + "a.js": 19574, "a.js.gz": 8046, "a.mem": 3171, "a.mem.gz": 2714, - "total": 23340, + "total": 23339, "total_gz": 11149 } diff --git a/tests/other/metadce/hello_libcxx_O2.jssize b/tests/other/metadce/hello_libcxx_O2.jssize index 85575626eb06d..3aa84474d6042 100644 --- a/tests/other/metadce/hello_libcxx_O2.jssize +++ b/tests/other/metadce/hello_libcxx_O2.jssize @@ -1 +1 @@ -96770 +96724 diff --git a/tests/other/metadce/hello_libcxx_O2_EVAL_CTORS.jssize b/tests/other/metadce/hello_libcxx_O2_EVAL_CTORS.jssize index 85575626eb06d..3aa84474d6042 100644 --- a/tests/other/metadce/hello_libcxx_O2_EVAL_CTORS.jssize +++ b/tests/other/metadce/hello_libcxx_O2_EVAL_CTORS.jssize @@ -1 +1 @@ -96770 +96724 diff --git a/tests/other/metadce/hello_libcxx_O2_EVAL_CTORS_2.jssize b/tests/other/metadce/hello_libcxx_O2_EVAL_CTORS_2.jssize index 9f5a9bae37ded..f1a4e38c91035 100644 --- a/tests/other/metadce/hello_libcxx_O2_EVAL_CTORS_2.jssize +++ b/tests/other/metadce/hello_libcxx_O2_EVAL_CTORS_2.jssize @@ -1 +1 @@ -96668 +96622 diff --git a/tests/other/metadce/hello_libcxx_O2_fexceptions.jssize b/tests/other/metadce/hello_libcxx_O2_fexceptions.jssize index 66985d1bad13f..4e59fe58e899e 100644 --- a/tests/other/metadce/hello_libcxx_O2_fexceptions.jssize +++ b/tests/other/metadce/hello_libcxx_O2_fexceptions.jssize @@ -1 +1 @@ -110224 +110178 diff --git a/tests/other/metadce/hello_libcxx_O2_fexceptions_DEMANGLE_SUPPORT.jssize b/tests/other/metadce/hello_libcxx_O2_fexceptions_DEMANGLE_SUPPORT.jssize index 6d62d0ff8d7f5..76dd6ea822339 100644 --- a/tests/other/metadce/hello_libcxx_O2_fexceptions_DEMANGLE_SUPPORT.jssize +++ b/tests/other/metadce/hello_libcxx_O2_fexceptions_DEMANGLE_SUPPORT.jssize @@ -1 +1 @@ -111211 +111165 diff --git a/tests/other/metadce/hello_world.jssize b/tests/other/metadce/hello_world.jssize index 6f29c73bb1179..82289c25bc5eb 100644 --- a/tests/other/metadce/hello_world.jssize +++ b/tests/other/metadce/hello_world.jssize @@ -1 +1 @@ -126200 +125971 diff --git a/tests/other/metadce/hello_world_O1.jssize b/tests/other/metadce/hello_world_O1.jssize index 480d48278b1f9..7fcd30f3aed8c 100644 --- a/tests/other/metadce/hello_world_O1.jssize +++ b/tests/other/metadce/hello_world_O1.jssize @@ -1 +1 @@ -58972 +58956 diff --git a/tests/other/metadce/hello_world_O2.jssize b/tests/other/metadce/hello_world_O2.jssize index 94f71beeac912..ad1c0201ef68e 100644 --- a/tests/other/metadce/hello_world_O2.jssize +++ b/tests/other/metadce/hello_world_O2.jssize @@ -1 +1 @@ -22051 +22035 diff --git a/tests/other/metadce/hello_world_O3.jssize b/tests/other/metadce/hello_world_O3.jssize index db290bd738f16..face90461f220 100644 --- a/tests/other/metadce/hello_world_O3.jssize +++ b/tests/other/metadce/hello_world_O3.jssize @@ -1 +1 @@ -15396 +15382 diff --git a/tests/other/metadce/hello_world_O3_MAIN_MODULE_2.jssize b/tests/other/metadce/hello_world_O3_MAIN_MODULE_2.jssize index 910bf30da431c..12fde61a51abf 100644 --- a/tests/other/metadce/hello_world_O3_MAIN_MODULE_2.jssize +++ b/tests/other/metadce/hello_world_O3_MAIN_MODULE_2.jssize @@ -1 +1 @@ -96935 +96888 diff --git a/tests/other/metadce/hello_world_Os.jssize b/tests/other/metadce/hello_world_Os.jssize index 5a2287d489b1c..52598d0388621 100644 --- a/tests/other/metadce/hello_world_Os.jssize +++ b/tests/other/metadce/hello_world_Os.jssize @@ -1 +1 @@ -15193 +15179 diff --git a/tests/other/metadce/hello_world_Os_EXPORTED_FUNCTIONS_NONE.jssize b/tests/other/metadce/hello_world_Os_EXPORTED_FUNCTIONS_NONE.jssize index 8a6e22b20216a..690f47724ce6b 100644 --- a/tests/other/metadce/hello_world_Os_EXPORTED_FUNCTIONS_NONE.jssize +++ b/tests/other/metadce/hello_world_Os_EXPORTED_FUNCTIONS_NONE.jssize @@ -1 +1 @@ -11919 +11906 diff --git a/tests/other/metadce/hello_world_Oz.jssize b/tests/other/metadce/hello_world_Oz.jssize index 229e82d3c9290..f14659634d305 100644 --- a/tests/other/metadce/hello_world_Oz.jssize +++ b/tests/other/metadce/hello_world_Oz.jssize @@ -1 +1 @@ -15068 +15054 diff --git a/tests/other/metadce/libcxxabi_message_O3.jssize b/tests/other/metadce/libcxxabi_message_O3.jssize index 9a14e64250b07..500a38ba43566 100644 --- a/tests/other/metadce/libcxxabi_message_O3.jssize +++ b/tests/other/metadce/libcxxabi_message_O3.jssize @@ -1 +1 @@ -13249 +13236 diff --git a/tests/other/metadce/libcxxabi_message_O3_STANDALONE_WASM.jssize b/tests/other/metadce/libcxxabi_message_O3_STANDALONE_WASM.jssize index a9414b3366a6b..e75c331129b33 100644 --- a/tests/other/metadce/libcxxabi_message_O3_STANDALONE_WASM.jssize +++ b/tests/other/metadce/libcxxabi_message_O3_STANDALONE_WASM.jssize @@ -1 +1 @@ -14936 +14922 diff --git a/tests/other/metadce/mem_O3.jssize b/tests/other/metadce/mem_O3.jssize index 649f59d1841e1..1f1660ff0442e 100644 --- a/tests/other/metadce/mem_O3.jssize +++ b/tests/other/metadce/mem_O3.jssize @@ -1 +1 @@ -15374 +15361 diff --git a/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH.jssize b/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH.jssize index 6de4db93a50ae..2d0c4acaacdc8 100644 --- a/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH.jssize +++ b/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH.jssize @@ -1 +1 @@ -16125 +16112 diff --git a/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH_STANDALONE_WASM.jssize b/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH_STANDALONE_WASM.jssize index 95d67656cfd47..5e4c356b15b41 100644 --- a/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH_STANDALONE_WASM.jssize +++ b/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH_STANDALONE_WASM.jssize @@ -1 +1 @@ -15831 +15817 diff --git a/tests/other/metadce/mem_O3_STANDALONE_WASM.jssize b/tests/other/metadce/mem_O3_STANDALONE_WASM.jssize index 0ba8ca2ca1ad5..ee14455c7ba9f 100644 --- a/tests/other/metadce/mem_O3_STANDALONE_WASM.jssize +++ b/tests/other/metadce/mem_O3_STANDALONE_WASM.jssize @@ -1 +1 @@ -15653 +15639 diff --git a/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM.jssize b/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM.jssize index a9414b3366a6b..e75c331129b33 100644 --- a/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM.jssize +++ b/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM.jssize @@ -1 +1 @@ -14936 +14922 diff --git a/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM_flto.jssize b/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM_flto.jssize index a9414b3366a6b..e75c331129b33 100644 --- a/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM_flto.jssize +++ b/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM_flto.jssize @@ -1 +1 @@ -14936 +14922 diff --git a/tests/other/metadce/mem_no_main_O3_STANDALONE_WASM_noentry.jssize b/tests/other/metadce/mem_no_main_O3_STANDALONE_WASM_noentry.jssize index a4e085a4e706e..9a14e64250b07 100644 --- a/tests/other/metadce/mem_no_main_O3_STANDALONE_WASM_noentry.jssize +++ b/tests/other/metadce/mem_no_main_O3_STANDALONE_WASM_noentry.jssize @@ -1 +1 @@ -13262 +13249 diff --git a/tests/other/metadce/minimal.jssize b/tests/other/metadce/minimal.jssize index a602d938a1311..355d7ca62a70b 100644 --- a/tests/other/metadce/minimal.jssize +++ b/tests/other/metadce/minimal.jssize @@ -1 +1 @@ -123082 +122853 diff --git a/tests/other/metadce/minimal_O1.jssize b/tests/other/metadce/minimal_O1.jssize index 4916406d2d8b4..28e265eb365c9 100644 --- a/tests/other/metadce/minimal_O1.jssize +++ b/tests/other/metadce/minimal_O1.jssize @@ -1 +1 @@ -56313 +56297 diff --git a/tests/other/metadce/minimal_O2.jssize b/tests/other/metadce/minimal_O2.jssize index 0cb9ec48bcfe8..e1e1c53a59771 100644 --- a/tests/other/metadce/minimal_O2.jssize +++ b/tests/other/metadce/minimal_O2.jssize @@ -1 +1 @@ -20025 +20009 diff --git a/tests/other/metadce/minimal_O3.jssize b/tests/other/metadce/minimal_O3.jssize index 0fc505c5b8e0a..957dc8e5dc5e0 100644 --- a/tests/other/metadce/minimal_O3.jssize +++ b/tests/other/metadce/minimal_O3.jssize @@ -1 +1 @@ -12293 +12280 diff --git a/tests/other/metadce/minimal_Os.jssize b/tests/other/metadce/minimal_Os.jssize index c674acc20eee8..4f1aa91e9731e 100644 --- a/tests/other/metadce/minimal_Os.jssize +++ b/tests/other/metadce/minimal_Os.jssize @@ -1 +1 @@ -12090 +12077 diff --git a/tests/other/metadce/minimal_Os_MINIMAL_RUNTIME.jssize b/tests/other/metadce/minimal_Os_MINIMAL_RUNTIME.jssize index 408adce179f47..34d9aaeb09340 100644 --- a/tests/other/metadce/minimal_Os_MINIMAL_RUNTIME.jssize +++ b/tests/other/metadce/minimal_Os_MINIMAL_RUNTIME.jssize @@ -1 +1 @@ -1044 +1043 diff --git a/tests/other/metadce/minimal_Oz.jssize b/tests/other/metadce/minimal_Oz.jssize index c674acc20eee8..4f1aa91e9731e 100644 --- a/tests/other/metadce/minimal_Oz.jssize +++ b/tests/other/metadce/minimal_Oz.jssize @@ -1 +1 @@ -12090 +12077 diff --git a/tests/other/metadce/minimal_Oz_EVAL_CTORS.jssize b/tests/other/metadce/minimal_Oz_EVAL_CTORS.jssize index e754e30889707..351720e2b31a9 100644 --- a/tests/other/metadce/minimal_Oz_EVAL_CTORS.jssize +++ b/tests/other/metadce/minimal_Oz_EVAL_CTORS.jssize @@ -1 +1 @@ -11826 +11813 diff --git a/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.jssize b/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.jssize index c615de98f3e48..fc4fbafc27817 100644 --- a/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.jssize +++ b/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.jssize @@ -1 +1 @@ -47524 +47501 diff --git a/tests/test_other.py b/tests/test_other.py index d8fc6c8c0c871..57e4f3c73b51e 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -9620,7 +9620,7 @@ def test(args): # Changing this option to [] should decrease code size. self.assertLess(changed, normal) # Check an absolute code size as well, with some slack. - self.assertLess(abs(changed - 5150), 150) + self.assertLess(abs(changed - 4994), 150) def test_llvm_includes(self): create_file('atomics.c', '#include ') diff --git a/tools/experimental/reproduceriter.py b/tools/experimental/reproduceriter.py index 9f36f23f85f07..cf9b4b30b7bb9 100644 --- a/tools/experimental/reproduceriter.py +++ b/tools/experimental/reproduceriter.py @@ -42,7 +42,7 @@ example, if your application is a game that starts receiving events when in fullscreen, add something like - if (typeof Recorder != 'undefined') Recorder.start(); + if (typeof Recorder !== 'undefined') Recorder.start(); in the button that launches fullscreen. start() will start either recording when in record mode, or replaying when