From 3d615f2b9c8657514647411f6028fd7b47f082f8 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 14 Nov 2008 19:15:18 +0000 Subject: [PATCH] - Fix errors when auto-saving proxies with transparent setting off (due to proxy variable not being set) - Fixed display of proxy settings validation failure window - Tweaked validation failure window title --- .../content/zotero/preferences/proxyEditor.js | 9 +++-- chrome/content/zotero/xpcom/proxy.js | 34 +++++++++++-------- chrome/locale/en-US/zotero/zotero.properties | 2 +- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/chrome/content/zotero/preferences/proxyEditor.js b/chrome/content/zotero/preferences/proxyEditor.js index 524bb87b1f..aaae7224eb 100644 --- a/chrome/content/zotero/preferences/proxyEditor.js +++ b/chrome/content/zotero/preferences/proxyEditor.js @@ -111,8 +111,13 @@ var Zotero_ProxyEditor = new function() { var hasErrors = proxy.validate(); if(hasErrors) { - Components.interfaces.nsIPromptService.getService().alert(window, - Zotero.getString("proxies.error"), Zotero.getString("proxies.error."+hasErrors)); + var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] + .getService(Components.interfaces.nsIPromptService); + promptService.alert( + window, + Zotero.getString("proxies.error"), + Zotero.getString("proxies.error." + hasErrors) + ); if(window.arguments && window.arguments[0]) proxy.revert(); return false; } diff --git a/chrome/content/zotero/xpcom/proxy.js b/chrome/content/zotero/xpcom/proxy.js index fe127b20ca..2475f3a517 100644 --- a/chrome/content/zotero/xpcom/proxy.js +++ b/chrome/content/zotero/xpcom/proxy.js @@ -95,25 +95,29 @@ Zotero.Proxies = new function() { Components.utils.reportError(e); } + if (!proxy) { + continue; + } + + // if transparent is turned off, just save the proxy if(!transparent) { - // if transparent is turned off, just save the proxy proxy.save(); - } else if(proxy) { - // otherwise, make sure we want it - var io = {site:proxy.hosts[0], proxy:channel.URI.hostPort}; - var window = Components.classes["@mozilla.org/appshell/window-mediator;1"] - .getService(Components.interfaces.nsIWindowMediator) - .getMostRecentWindow("navigator:browser"); - window.openDialog('chrome://zotero/content/proxy.xul', '', 'chrome,modal', io); - - if(io.add) proxy.save(); - if(io.disable) { - transparent = false; - Zotero.Prefs.set("proxies.transparent", false); - } - break; } + + // otherwise, make sure we want it + var io = {site:proxy.hosts[0], proxy:channel.URI.hostPort}; + var window = Components.classes["@mozilla.org/appshell/window-mediator;1"] + .getService(Components.interfaces.nsIWindowMediator) + .getMostRecentWindow("navigator:browser"); + window.openDialog('chrome://zotero/content/proxy.xul', '', 'chrome,modal', io); + + if(io.add) proxy.save(); + if(io.disable) { + transparent = false; + Zotero.Prefs.set("proxies.transparent", false); + } + break; } } diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index 37a82fe8ff..726eed2c37 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -509,7 +509,7 @@ sync.storage.kbRemaining = %SKB remaining sync.storage.none = None proxies.multiSite = Multi-Site -proxies.error = Information Validation Error +proxies.error = Invalid Proxy Settings proxies.error.scheme.noHTTP = Valid proxy schemes must start with "http://" or "https://" proxies.error.host.invalid = You must enter a full hostname for the site served by this proxy (e.g., jstor.org). proxies.error.scheme.noHost = A multi-site proxy scheme must contain the host variable (%h).