diff options
Diffstat (limited to 'platform/web/js')
| -rw-r--r-- | platform/web/js/engine/config.js | 3 | ||||
| -rw-r--r-- | platform/web/js/libs/audio.worklet.js | 2 | ||||
| -rw-r--r-- | platform/web/js/libs/library_godot_audio.js | 9 | ||||
| -rw-r--r-- | platform/web/js/libs/library_godot_os.js | 14 | 
4 files changed, 20 insertions, 8 deletions
diff --git a/platform/web/js/engine/config.js b/platform/web/js/engine/config.js index 9c4b6c2012..41be7b2512 100644 --- a/platform/web/js/engine/config.js +++ b/platform/web/js/engine/config.js @@ -317,7 +317,8 @@ const InternalConfig = function (initConfig) { // eslint-disable-line no-unused-  		if (!(this.canvas instanceof HTMLCanvasElement)) {  			const nodes = document.getElementsByTagName('canvas');  			if (nodes.length && nodes[0] instanceof HTMLCanvasElement) { -				this.canvas = nodes[0]; +				const first = nodes[0]; +				this.canvas = /** @type {!HTMLCanvasElement} */ (first);  			}  			if (!this.canvas) {  				throw new Error('No canvas found in page'); diff --git a/platform/web/js/libs/audio.worklet.js b/platform/web/js/libs/audio.worklet.js index ea4d8cb221..daf5c9ef12 100644 --- a/platform/web/js/libs/audio.worklet.js +++ b/platform/web/js/libs/audio.worklet.js @@ -133,6 +133,8 @@ class GodotProcessor extends AudioWorkletProcessor {  			this.running = false;  			this.output = null;  			this.input = null; +			this.lock = null; +			this.notifier = null;  		} else if (p_cmd === 'start_nothreads') {  			this.output = new RingBuffer(p_data[0], p_data[0].length, false);  		} else if (p_cmd === 'chunk') { diff --git a/platform/web/js/libs/library_godot_audio.js b/platform/web/js/libs/library_godot_audio.js index 756c1ac595..68e100cca0 100644 --- a/platform/web/js/libs/library_godot_audio.js +++ b/platform/web/js/libs/library_godot_audio.js @@ -339,16 +339,21 @@ const GodotAudioWorklet = {  				if (GodotAudioWorklet.promise === null) {  					return;  				} -				GodotAudioWorklet.promise.then(function () { +				const p = GodotAudioWorklet.promise; +				p.then(function () {  					GodotAudioWorklet.worklet.port.postMessage({  						'cmd': 'stop',  						'data': null,  					});  					GodotAudioWorklet.worklet.disconnect(); +					GodotAudioWorklet.worklet.port.onmessage = null;  					GodotAudioWorklet.worklet = null;  					GodotAudioWorklet.promise = null;  					resolve(); -				}).catch(function (err) { /* aborted? */ }); +				}).catch(function (err) { +					// Aborted? +					GodotRuntime.error(err); +				});  			});  		},  	}, diff --git a/platform/web/js/libs/library_godot_os.js b/platform/web/js/libs/library_godot_os.js index 377eec3234..ce64fb98c0 100644 --- a/platform/web/js/libs/library_godot_os.js +++ b/platform/web/js/libs/library_godot_os.js @@ -106,12 +106,14 @@ autoAddDeps(GodotConfig, '$GodotConfig');  mergeInto(LibraryManager.library, GodotConfig);  const GodotFS = { -	$GodotFS__deps: ['$ERRNO_CODES', '$FS', '$IDBFS', '$GodotRuntime'], +	$GodotFS__deps: ['$FS', '$IDBFS', '$GodotRuntime'],  	$GodotFS__postset: [  		'Module["initFS"] = GodotFS.init;',  		'Module["copyToFS"] = GodotFS.copy_to_fs;',  	].join(''),  	$GodotFS: { +		// ERRNO_CODES works every odd version of emscripten, but this will break too eventually. +		ENOENT: 44,  		_idbfs: false,  		_syncing: false,  		_mount_points: [], @@ -138,8 +140,9 @@ const GodotFS = {  				try {  					FS.stat(dir);  				} catch (e) { -					if (e.errno !== ERRNO_CODES.ENOENT) { -						throw e; +					if (e.errno !== GodotFS.ENOENT) { +						// Let mkdirTree throw in case, we cannot trust the above check. +						GodotRuntime.error(e);  					}  					FS.mkdirTree(dir);  				} @@ -208,8 +211,9 @@ const GodotFS = {  			try {  				FS.stat(dir);  			} catch (e) { -				if (e.errno !== ERRNO_CODES.ENOENT) { -					throw e; +				if (e.errno !== GodotFS.ENOENT) { +					// Let mkdirTree throw in case, we cannot trust the above check. +					GodotRuntime.error(e);  				}  				FS.mkdirTree(dir);  			}  |