Fix switching in and out of connector mode

Broken by 9d3f55be51
This commit is contained in:
Simon Kornblith 2013-08-09 10:55:29 -04:00
parent 8f0dac0eb4
commit 2069b5b396
3 changed files with 34 additions and 16 deletions

View file

@ -164,11 +164,16 @@ ZoteroContext.prototype = {
*/
"switchConnectorMode":function(isConnector) {
if(isConnector !== this.isConnector) {
zContext.Zotero.shutdown();
// create a new zContext
makeZoteroContext(isConnector);
zContext.Zotero.init();
zContext.Zotero.shutdown(function() {
try {
// create a new zContext
makeZoteroContext(isConnector);
zContext.Zotero.init();
} catch(e) {
dump(e.toSource());
throw e;
}
});
}
return zContext;
@ -294,9 +299,16 @@ function ZoteroService() {
} catch(e) {
if(e === "ZOTERO_SHOULD_START_AS_CONNECTOR") {
// if Zotero should start as a connector, reload it
zContext.Zotero.shutdown();
makeZoteroContext(true);
zContext.Zotero.init();
zContext.Zotero.shutdown(function() {
try {
makeZoteroContext(true);
zContext.Zotero.init();
} catch(e) {
dump(e.toSource());
Components.utils.reportError(e);
throw e;
}
});
} else {
dump(e.toSource());
Components.utils.reportError(e);