www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit d2a4cf768077ccbe82c99fb61a5a12bcb35de53f
parent b5974570e8b2b37b6570e6a8127a5b523dcecf2e
Author: Simon Kornblith <simon@simonster.com>
Date:   Wed, 29 Apr 2009 20:58:26 +0000

Fixes a bug where transparent proxies wouldn't be transparent until Zotero is restarted


Diffstat:
Mchrome/content/zotero/xpcom/proxy.js | 19+++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/chrome/content/zotero/xpcom/proxy.js b/chrome/content/zotero/xpcom/proxy.js @@ -409,18 +409,14 @@ Zotero.Proxy.prototype.validate = function() { */ Zotero.Proxy.prototype.save = function(transparent) { // ensure this proxy is valid - Zotero.debug(this); var hasErrors = this.validate(); if(hasErrors) throw "Zotero.Proxy: could not be saved because it is invalid: error "+hasErrors[0]; + // we never save any changes to non-persisting proxies, so this works + var newProxy = !!this.proxyID; + this.autoAssociate = this.multiHost && this.autoAssociate; this.compileRegexp(); - if(this.proxyID) { - Zotero.Proxies.refreshHostMap(this); - if(!transparent) throw "Zotero.Proxy: cannot save transparent proxy without transparent param"; - } else { - Zotero.Proxies.save(this); - } if(transparent) { try { @@ -432,7 +428,7 @@ Zotero.Proxy.prototype.save = function(transparent) { Zotero.DB.query("DELETE FROM proxyHosts WHERE proxyID = ?", [this.proxyID]); } else { this.proxyID = Zotero.DB.query("INSERT INTO proxies (multiHost, autoAssociate, scheme) VALUES (?, ?, ?)", - [this.multiHost ? 1 : 0, this.autoAssociate ? 1 : 0, this.scheme]) + [this.multiHost ? 1 : 0, this.autoAssociate ? 1 : 0, this.scheme]); } this.hosts = this.hosts.sort(); @@ -449,6 +445,13 @@ Zotero.Proxy.prototype.save = function(transparent) { throw(e); } } + + if(newProxy) { + Zotero.Proxies.save(this); + } else { + Zotero.Proxies.refreshHostMap(this); + if(!transparent) throw "Zotero.Proxy: cannot save transparent proxy without transparent param"; + } } /**