Fix cancel button in WebDAV verification

This commit is contained in:
Dan Stillman 2013-02-19 06:10:57 -05:00
parent 6c28e61032
commit 6e9167aef1
2 changed files with 10 additions and 8 deletions

View file

@ -375,6 +375,10 @@ function verifyStorageServer() {
var onDone = false;
Zotero.Sync.Storage.WebDAV.checkServer()
// Get the XMLHttpRequest for possible cancelling
.progress(function (obj) {
request = obj.xmlhttp;
})
.finally(function () {
verifyButton.hidden = false;
abortButton.hidden = true;
@ -426,9 +430,6 @@ function verifyStorageServer() {
}
}
})
.progress(function (obj) {
request = obj.request;
})
.catch(function (e) {
Zotero.debug("WebDAV verification failed");
Zotero.debug(e, 1);

View file

@ -1290,11 +1290,12 @@ Zotero.Sync.Storage.WebDAV = (function () {
return deferred.resolve([uri, Zotero.Sync.Storage.ERROR_OFFLINE]);
}
// Pass request to progress handler
var obj = {};
obj.request = request;
deferred.notify(obj)
// Pass XMLHttpRequest to progress handler
setTimeout(function () {
var obj = {};
obj.xmlhttp = request;
deferred.notify(obj)
}, 0);
return deferred.promise;
};