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

View file

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