mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-05 18:32:30 +01:00
This commit is contained in:
parent
8fc0b4c00d
commit
e594dfa8ab
@ -226,11 +226,18 @@ var cachedAssetsManager = (function() {
|
||||
/******************************************************************************/
|
||||
|
||||
var getTextFileFromURL = function(url, onLoad, onError) {
|
||||
// https://github.com/gorhill/uMatrix/issues/15
|
||||
var onResponseReceived = function() {
|
||||
if ( typeof this.status === 'number' && this.status >= 200 && this.status < 300 ) {
|
||||
return onLoad.call(this);
|
||||
}
|
||||
return onError.call(this);
|
||||
};
|
||||
// console.log('µBlock> getTextFileFromURL("%s"):', url);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.responseType = 'text';
|
||||
xhr.timeout = 15000;
|
||||
xhr.onload = onLoad;
|
||||
xhr.onload = onResponseReceived;
|
||||
xhr.onerror = onError;
|
||||
xhr.ontimeout = onError;
|
||||
xhr.open('get', url, true);
|
||||
|
Loading…
Reference in New Issue
Block a user