Check for 200 response code.

Without this check, missing sourcemaps cause the package to continue as
if the 404 message is the sourcemap, leading to crashes when responses
like "Not Found" cannot be parsed as source maps.
master
Tim Oxley 9 years ago
parent e1a092fe79
commit fcac27c283

@ -29,7 +29,10 @@ function retrieveFile(path) {
var xhr = new XMLHttpRequest();
xhr.open('GET', path, false);
xhr.send(null);
var contents = xhr.readyState === 4 ? xhr.responseText : null;
var contents = null
if (xhr.readyState === 4 && xhr.status === 200) {
contents = xhr.responseText
}
}
// Otherwise, use the filesystem

Loading…
Cancel
Save