Remove processNextEvent() call

This commit is contained in:
Simon Kornblith 2011-09-20 21:59:28 +00:00
parent d19c87ef83
commit 21aff6f467
2 changed files with 21 additions and 24 deletions

View File

@ -88,7 +88,7 @@ Zotero.IPC = new function() {
// Standalone sends this to the Firefox extension to let the Firefox extension // Standalone sends this to the Firefox extension to let the Firefox extension
// know that Standalone has fully initialized and it should pull the list of // know that Standalone has fully initialized and it should pull the list of
// translators // translators
Zotero.onInitComplete(); Zotero.initComplete();
} }
} }
} }

View File

@ -183,8 +183,6 @@ if(appInfo.platformVersion[0] >= 2) {
// whether we are waiting for another Zotero process to release its DB lock // whether we are waiting for another Zotero process to release its DB lock
var _waitingForDBLock = false; var _waitingForDBLock = false;
// whether we are waiting for another Zotero process to initialize so we can use connector
var _waitingForInitComplete = false;
/** /**
* Maintains nsITimers to be used when Zotero.wait() completes (to reduce performance penalty * Maintains nsITimers to be used when Zotero.wait() completes (to reduce performance penalty
@ -422,27 +420,35 @@ if(appInfo.platformVersion[0] >= 2) {
Zotero.Connector_Types.init(); Zotero.Connector_Types.init();
if(!Zotero.isFirstLoadThisSession) { if(!Zotero.isFirstLoadThisSession) {
// Wait for initComplete message if we switched to connector because standalone was // We want to get a checkInitComplete message before initializing if we switched to
// started. This shouldn't loop indefinitely, but even if it does, it won't hang // connector mode because Standalone was launched
// anything (since it will stop looping on shutdown).
Zotero.IPC.broadcast("checkInitComplete"); Zotero.IPC.broadcast("checkInitComplete");
Zotero.debug("Waiting for initComplete message"); } else {
_waitingForInitComplete = true; Zotero.initComplete();
while(_waitingForInitComplete && !Zotero.closing) {
Zotero.mainThread.processNextEvent(true);
}
Zotero.debug("initComplete message received");
if(Zotero.closing) return false;
} }
Zotero.Repo.init();
} else { } else {
Zotero.debug("Loading in full mode"); Zotero.debug("Loading in full mode");
if(!_initFull()) return false; if(!_initFull()) return false;
Zotero.initComplete();
} }
return true;
}
/**
* Triggers events when initialization finishes
*/
this.initComplete = function() {
if(Zotero.initialized) return;
this.initialized = true; this.initialized = true;
if(Zotero.isConnector) {
Zotero.Repo.init();
}
var observerService = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
if(!Zotero.isFirstLoadThisSession) { if(!Zotero.isFirstLoadThisSession) {
// trigger zotero-reloaded event // trigger zotero-reloaded event
Zotero.debug('Triggering "zotero-reloaded" event'); Zotero.debug('Triggering "zotero-reloaded" event');
@ -451,8 +457,6 @@ if(appInfo.platformVersion[0] >= 2) {
Zotero.debug('Triggering "zotero-loaded" event'); Zotero.debug('Triggering "zotero-loaded" event');
observerService.notifyObservers(Zotero, "zotero-loaded", null); observerService.notifyObservers(Zotero, "zotero-loaded", null);
return true;
} }
/** /**
@ -725,13 +729,6 @@ if(appInfo.platformVersion[0] >= 2) {
} }
} }
/**
* Called when an accessory process has been initialized to let use get data
*/
this.onInitComplete = function() {
_waitingForInitComplete = false;
}
/* /*
* Check if a DB transaction is open and, if so, disable Zotero * Check if a DB transaction is open and, if so, disable Zotero
*/ */