зеркало из https://github.com/mozilla/gecko-dev.git
time out requests after 30 seconds
This commit is contained in:
Родитель
6360e435d6
Коммит
9f0826260d
|
@ -133,6 +133,12 @@ DAVCollection.prototype = {
|
||||||
request.mozBackgroundRequest = true;
|
request.mozBackgroundRequest = true;
|
||||||
request.open(op, this._baseURL + path, true);
|
request.open(op, this._baseURL + path, true);
|
||||||
|
|
||||||
|
// time out requests after 30 seconds
|
||||||
|
let cb = function() { request.abort(); };
|
||||||
|
let listener = new Utils.EventListener(cb);
|
||||||
|
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||||
|
timer.initWithCallback(listener, 30000, timer.TYPE_ONE_SHOT);
|
||||||
|
|
||||||
// Force cache validation
|
// Force cache validation
|
||||||
let channel = request.channel;
|
let channel = request.channel;
|
||||||
channel = channel.QueryInterface(Ci.nsIRequest);
|
channel = channel.QueryInterface(Ci.nsIRequest);
|
||||||
|
@ -156,7 +162,7 @@ DAVCollection.prototype = {
|
||||||
if (ret.status == 423)
|
if (ret.status == 423)
|
||||||
this._log.warn("_makeRequest: got status " + ret.status + " (This is not necessarily bad. It could just mean that another Firefox was syncing at the same time.)");
|
this._log.warn("_makeRequest: got status " + ret.status + " (This is not necessarily bad. It could just mean that another Firefox was syncing at the same time.)");
|
||||||
else
|
else
|
||||||
if (ret.status < 200 || ret.status >= 300)
|
if (ret.status < 200 || ret.status >= 300)
|
||||||
this._log.warn("_makeRequest: got status " + ret.status);
|
this._log.warn("_makeRequest: got status " + ret.status);
|
||||||
|
|
||||||
self.done(ret);
|
self.done(ret);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче