aboutsummaryrefslogtreecommitdiff
path: root/src/emscripten-source-map.min.js
diff options
context:
space:
mode:
authorJoel Croteau <jcroteau@gmail.com>2014-05-22 14:33:56 -0700
committerJoel Croteau <jcroteau@gmail.com>2014-05-22 14:58:51 -0700
commitaf0bd4d113ad6fba9873ec142a8d6e9c44500996 (patch)
treec32b45eb98b8439cb1304ea4fd2de9640d744423 /src/emscripten-source-map.min.js
parent876ae8a8b3867f146aaf545466c6170ad5407897 (diff)
Fix issues with source map loading in Firefox
This fixes a few issues using emscripten-source-map.min.js to load source map data in Firefox. Firefox by default tries to interpret any file loaded from an XHR as an XML file, which the source map is not, producing an error. This tells it to load as a text file instead. This allows a successful read from a status code of 0, which is needed if reading from a non-HTTP source, such as a local file.
Diffstat (limited to 'src/emscripten-source-map.min.js')
-rw-r--r--src/emscripten-source-map.min.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/emscripten-source-map.min.js b/src/emscripten-source-map.min.js
index 9151400f..44cb1d84 100644
--- a/src/emscripten-source-map.min.js
+++ b/src/emscripten-source-map.min.js
@@ -4,7 +4,7 @@ var emscripten_sourcemap_xmlHttp = undefined;
function emscripten_sourceMapLoaded() {
if (emscripten_sourcemap_xmlHttp.readyState === 4) {
Module['removeRunDependency']('sourcemap');
- if (emscripten_sourcemap_xmlHttp.status === 200) {
+ if (emscripten_sourcemap_xmlHttp.status === 200 || emscripten_sourcemap_xmlHttp.status === 0) {
emscripten_source_map = new window.sourceMap.SourceMapConsumer(emscripten_sourcemap_xmlHttp.responseText);
console.log('Source map data loaded.');
} else {
@@ -20,6 +20,7 @@ function emscripten_loadSourceMap() {
emscripten_sourcemap_xmlHttp = new XMLHttpRequest();
emscripten_sourcemap_xmlHttp.onreadystatechange = emscripten_sourceMapLoaded;
emscripten_sourcemap_xmlHttp.open("GET", url, true);
+ emscripten_sourcemap_xmlHttp.responseType = "text";
emscripten_sourcemap_xmlHttp.send(null);
}