1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00

re. #724: configurable xhr timeout

This commit is contained in:
gorhill 2015-09-25 08:31:46 -04:00
parent 69d4a0aa0a
commit de2d993d61

View File

@ -61,6 +61,7 @@ var lastRepoMetaTimestamp = 0;
var lastRepoMetaIsRemote = false; var lastRepoMetaIsRemote = false;
var refreshRepoMetaPeriod = 5 * oneHour; var refreshRepoMetaPeriod = 5 * oneHour;
var errorCantConnectTo = vAPI.i18n('errorCantConnectTo'); var errorCantConnectTo = vAPI.i18n('errorCantConnectTo');
var xhrTimeout = vAPI.localStorage.getItem('xhrTimeout') || 30000;
var exports = { var exports = {
autoUpdate: true, autoUpdate: true,
@ -318,7 +319,7 @@ var getTextFileFromURL = function(url, onLoad, onError) {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
try { try {
xhr.open('get', url, true); xhr.open('get', url, true);
xhr.timeout = 30000; xhr.timeout = xhrTimeout;
xhr.onload = onResponseReceived; xhr.onload = onResponseReceived;
xhr.onerror = onErrorReceived; xhr.onerror = onErrorReceived;
xhr.ontimeout = onErrorReceived; xhr.ontimeout = onErrorReceived;