1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-06-17 09:44:59 +12:00

this fixes #13, hopefully

This commit is contained in:
gorhill 2014-10-26 10:13:09 -04:00
parent 4612deaf69
commit b946a96bb6

View file

@ -212,14 +212,20 @@ var cachedAssetsManager = (function() {
/******************************************************************************/
var getTextFileFromURL = function(url, onLoad, onError) {
var onResponseReceived = function() {
if ( typeof this.status === 'number' && this.status >= 200 && this.status < 300 ) {
return onLoad.call(this);
}
return onError.call(this);
};
// console.log('assets.js > getTextFileFromURL("%s"):', url);
var xhr = new XMLHttpRequest();
xhr.open('get', url, true);
xhr.responseType = 'text';
xhr.timeout = 15000;
xhr.onload = onLoad;
xhr.onload = onResponseReceived;
xhr.onerror = onError;
xhr.ontimeout = onError;
xhr.open('get', url, true);
xhr.send();
};