From 778ef4e217e6d4a967741b83cf1a0d13fb482755 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Sat, 20 Mar 2021 13:35:10 +0100 Subject: [HTML5] Fix loading when mime-type is missing. `WebAssembly.instantiateStreaming` requires the mime-type to be `application/wasm`, but some servers (including most debug servers) do not provide the content-type header. This commit forces it via JavaScript, by creating a `Response` object with the `wasm` content, and explicitly defined `content-type` header. --- platform/javascript/js/engine/engine.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/javascript/js/engine/engine.js b/platform/javascript/js/engine/engine.js index 19a0552c8c..7211ebbfd8 100644 --- a/platform/javascript/js/engine/engine.js +++ b/platform/javascript/js/engine/engine.js @@ -102,7 +102,7 @@ const Engine = (function () { const me = this; function doInit(promise) { return promise.then(function (response) { - return Godot(me.config.getModuleConfig(loadPath, response.clone())); + return Godot(me.config.getModuleConfig(loadPath, new Response(response.clone().body, { 'headers': [['content-type', 'application/wasm']] }))); }).then(function (module) { const paths = me.config.persistentPaths; return module['initFS'](paths).then(function (err) { -- cgit v1.2.3