diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-03-20 13:35:10 +0100 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-03-20 13:41:44 +0100 |
commit | 778ef4e217e6d4a967741b83cf1a0d13fb482755 (patch) | |
tree | 1a13ad1a2d801fe77046e5cdac5fa524cf9dfd68 | |
parent | 62e134a0c01bf19c2623dc73e05ebb6e0ab0c1b5 (diff) |
[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.
-rw-r--r-- | platform/javascript/js/engine/engine.js | 2 |
1 files changed, 1 insertions, 1 deletions
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) { |