From 10d23e76bf73dd272f7e76f9402af7ae5bd07440 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 16 Feb 2012 04:50:51 -0500 Subject: [PATCH] Fix "Please restart undefined" in WebDAV error message And a little other weirdness --- chrome/content/zotero/xpcom/storage/webdav.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js index feae35979..6e13eeea3 100644 --- a/chrome/content/zotero/xpcom/storage/webdav.js +++ b/chrome/content/zotero/xpcom/storage/webdav.js @@ -49,7 +49,7 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.includeGroupItems = false; // TEMP // TODO: localize Zotero.Sync.Storage.Session.WebDAV.prototype.defaultError = "A WebDAV file sync error occurred. Please try syncing again.\n\nIf you receive this message repeatedly, check your WebDAV server settings in the Sync pane of the Zotero preferences."; -Zotero.Sync.Storage.Session.WebDAV.prototype.defaultErrorRestart = "A WebDAV file sync error occurred. Please restart " + Zotero.appName + " and try syncing again.\n\nIf you receive this message repeatedly, check your WebDAV server settings in the Sync pane of the Zotero preferences."; +Zotero.Sync.Storage.Session.WebDAV.prototype.__defineGetter__('defaultErrorRestart', function () "A WebDAV file sync error occurred. Please restart " + Zotero.appName + " and try syncing again.\n\nIf you receive this message repeatedly, check your WebDAV server settings in the Sync pane of the Zotero preferences."); Zotero.Sync.Storage.Session.WebDAV.prototype.__defineGetter__('enabled', function () { @@ -703,10 +703,10 @@ Zotero.Sync.Storage.Session.WebDAV.prototype._onUploadCancel = function (httpReq Zotero.Sync.Storage.Session.WebDAV.prototype.getLastSyncTime = function (callback) { + var self = this; + // Cache the credentials at the root URI if (!this._cachedCredentials) { - var self = this; - Zotero.HTTP.doOptions(this.rootURI, function (req) { self._checkResponse(req, self); @@ -729,7 +729,6 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.getLastSyncTime = function (callbac var successFileURI = uri.clone(); successFileURI.spec += "lastsync"; Zotero.HTTP.doGet(successFileURI, function (req) { - var ts = undefined; try { if (req.responseText) { Zotero.debug(req.responseText); @@ -744,10 +743,7 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.getLastSyncTime = function (callbac if (req.status != 200 && req.status != 404) { var msg = "Unexpected status code " + req.status + " for HEAD request " + "in Zotero.Sync.Storage.Session.WebDAV.getLastSyncTime()"; - Zotero.debug(msg, 1); - Components.utils.reportError(msg); - self.onError(); - return; + throw (msg); } if (req.status == 200) { @@ -759,17 +755,21 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.getLastSyncTime = function (callbac else { ts = null; } - } - finally { + callback(ts); } + catch (e) { + Zotero.debug(e, 1); + Components.utils.reportError(e); + self.onError(); + } }); return; } catch (e) { Zotero.debug(e); Components.utils.reportError(e); - callback(); + self.onError(); return; } }