time out requests after 30 seconds

This commit is contained in:
Dan Mills 2008-07-17 20:40:29 -07:00
Родитель 6360e435d6
Коммит 9f0826260d
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -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);