Firefox streaming compilation needs Content-Type header set

3,212 views
Skip to first unread message

Brion Vibber

unread,
Jan 29, 2018, 3:35:37 PM1/29/18
to emscripten Mailing List
I noticed on Firefox 58 I'm getting warnings like this in the console, with code built on 1.37.28:

    wasm streaming compile failed: TypeError: Response has unsupported MIME type
    falling back to ArrayBuffer instantiation

and the .wasm file shows up twice in the network list in dev tools. The file is shown as cached on the second load, and in subsequent page views, but I don't know if that'll hold for larger .wasm executables than my relatively small codecs.


Fix is to reconfigure the web server to serve .wasm files as application/wasm instead of defaulting to something like application/octet-stream.

In Apache, this would be:

    AddType application/wasm .wasm

and while one is in there; to also enable transparent gzip:

    AddOutputFilterByType DEFLATE application/wasm

This decreases the network transfer size nicely as a bonus. :)

-- brion

Alon Zakai

unread,
Jan 30, 2018, 4:22:24 PM1/30/18
to emscripten-discuss
Thanks! Very important stuff. I added a section to the wiki,


--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Gavin

unread,
Jan 31, 2018, 10:08:12 AM1/31/18
to emscripten-discuss
Thanks for the info Brion.

Do you know it effects other web browser?

Brian Gavin

Derek Schuff

unread,
Jan 31, 2018, 11:59:38 AM1/31/18
to emscripte...@googlegroups.com
Yes, the requirement on mime type is part of the spec. See https://webassembly.github.io/spec/web-api/index.html#streaming-modules

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages