From 168bc78f1a4c2fc7b97a285b0bf0a58519068281 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 9 Aug 2018 06:11:33 -0400 Subject: [PATCH] Show error icon at startup if proxy check fails If a proxy is required and we can't connect to S3, show the (sync) error icon. For SSL certificate errors, which are the most common cause of this, the panel includes a link to the SSL cert troubleshooting page. --- chrome/content/zotero/xpcom/http.js | 11 +++++++---- chrome/content/zotero/zoteroPane.js | 12 ++++++++++++ chrome/locale/en-US/zotero/zotero.properties | 1 + 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js index 91d9389967..68faaf4b2d 100644 --- a/chrome/content/zotero/xpcom/http.js +++ b/chrome/content/zotero/xpcom/http.js @@ -651,10 +651,13 @@ Zotero.HTTP = new function() { dontCache: true }) .catch(function (e) { - Components.utils.reportError(e); - var msg = "Error connecting to proxy -- proxied requests may not work"; - Zotero.log(msg, 'error'); - Zotero.debug(msg, 1); + // Show error icon at startup + if (e instanceof Zotero.HTTP.SecurityException) { + Zotero.proxyFailure = e; + } + Zotero.logError(e); + let msg = "Error connecting to proxy -- proxied requests may not work"; + Zotero.logError(msg); }); break; } diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index bf6848d363..8ae80afe82 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -481,6 +481,18 @@ var ZoteroPane = new function() Zotero.Prefs.set(pref, true); } + if (Zotero.proxyFailure) { + try { + Zotero.proxyFailure.message += "\n\n" + + Zotero.getString('startupError.internetFunctionalityMayNotWork'); + Zotero.Sync.Runner.updateIcons(Zotero.proxyFailure); + Zotero.proxyFailure = null; + } + catch (e) { + Zotero.logError(e); + } + } + // Auto-sync on pane open or if new account if (Zotero.Prefs.get('sync.autoSync') || Zotero.initAutoSync) { yield Zotero.proxyAuthComplete; diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index c780be571f..04eaeeebfc 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -185,6 +185,7 @@ startupError.incompatibleDBVersion = This %1$S database requires %1$S %2 startupError.zoteroVersionIsOlder.current = Current version: %S startupError.zoteroVersionIsOlder.upgrade = Please upgrade to the latest version from %S. startupError.databaseUpgradeError = Database upgrade error +startupError.internetFunctionalityMayNotWork = Functionality that depends on an internet connection may not work. date.relative.secondsAgo.one = 1 second ago date.relative.secondsAgo.multiple = %S seconds ago