mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-06-26 10:01:08 +12:00
this fixes #13, hopefully
This commit is contained in:
parent
4612deaf69
commit
b946a96bb6
|
@ -212,14 +212,20 @@ var cachedAssetsManager = (function() {
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var getTextFileFromURL = function(url, onLoad, onError) {
|
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);
|
// console.log('assets.js > getTextFileFromURL("%s"):', url);
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('get', url, true);
|
||||||
xhr.responseType = 'text';
|
xhr.responseType = 'text';
|
||||||
xhr.timeout = 15000;
|
xhr.timeout = 15000;
|
||||||
xhr.onload = onLoad;
|
xhr.onload = onResponseReceived;
|
||||||
xhr.onerror = onError;
|
xhr.onerror = onError;
|
||||||
xhr.ontimeout = onError;
|
xhr.ontimeout = onError;
|
||||||
xhr.open('get', url, true);
|
|
||||||
xhr.send();
|
xhr.send();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue