commit 21aff6f467623f83f1d08ba14e7a6efa2d19c80b
parent d19c87ef8389261742c44b9efd9410c5164a2ea6
Author: Simon Kornblith <simon@simonster.com>
Date: Tue, 20 Sep 2011 21:59:28 +0000
Remove processNextEvent() call
Diffstat:
2 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/chrome/content/zotero/xpcom/ipc.js b/chrome/content/zotero/xpcom/ipc.js
@@ -88,7 +88,7 @@ Zotero.IPC = new function() {
// 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
// translators
- Zotero.onInitComplete();
+ Zotero.initComplete();
}
}
}
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -183,8 +183,6 @@ if(appInfo.platformVersion[0] >= 2) {
// whether we are waiting for another Zotero process to release its DB lock
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
@@ -422,27 +420,35 @@ if(appInfo.platformVersion[0] >= 2) {
Zotero.Connector_Types.init();
if(!Zotero.isFirstLoadThisSession) {
- // Wait for initComplete message if we switched to connector because standalone was
- // started. This shouldn't loop indefinitely, but even if it does, it won't hang
- // anything (since it will stop looping on shutdown).
+ // We want to get a checkInitComplete message before initializing if we switched to
+ // connector mode because Standalone was launched
Zotero.IPC.broadcast("checkInitComplete");
- Zotero.debug("Waiting for initComplete message");
- _waitingForInitComplete = true;
- while(_waitingForInitComplete && !Zotero.closing) {
- Zotero.mainThread.processNextEvent(true);
- }
- Zotero.debug("initComplete message received");
- if(Zotero.closing) return false;
+ } else {
+ Zotero.initComplete();
}
-
- Zotero.Repo.init();
} else {
Zotero.debug("Loading in full mode");
if(!_initFull()) return false;
+ Zotero.initComplete();
}
+ return true;
+ }
+
+ /**
+ * Triggers events when initialization finishes
+ */
+ this.initComplete = function() {
+ if(Zotero.initialized) return;
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) {
// trigger zotero-reloaded event
Zotero.debug('Triggering "zotero-reloaded" event');
@@ -451,8 +457,6 @@ if(appInfo.platformVersion[0] >= 2) {
Zotero.debug('Triggering "zotero-loaded" event');
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
*/