- Prevent a deadlock when Zotero.wait() was called during initialization

- Don't spin Zotero.mainThread.processNextEvent() forever when translator could not be retrieved
This commit is contained in:
Simon Kornblith 2011-08-16 18:28:55 +00:00
parent 9ce0e47117
commit 91024eb87c
3 changed files with 14 additions and 4 deletions

View file

@ -73,10 +73,17 @@ Zotero.IPC = new function() {
} else if(msg === "checkInitComplete") {
// The Firefox extension sends this to Standalone to tell Standalone to send an
// initComplete message when it is fully initialized
while(!Zotero.initialized) {
Zotero.mainThread.processNextEvent(true)
if(Zotero.initialized) {
Zotero.IPC.broadcast("initComplete");
} else {
var observerService = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
var _loadObserver = function() {
Zotero.IPC.broadcast("initComplete");
observerService.removeObserver(_loadObserver, "zotero-loaded");
};
observerService.addObserver(_loadObserver, "zotero-loaded", false);
}
Zotero.IPC.broadcast("initComplete");
} else if(msg === "initComplete") {
// 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

View file

@ -349,7 +349,7 @@ Zotero.Translate.Sandbox = {
Zotero.Translators.get(translation.translator[0], haveTranslatorFunction);
if(Zotero.isConnector && Zotero.isFx && !callback) {
while(!sandbox) {
while(!sandbox && translate._currentState) {
Zotero.mainThread.processNextEvent(true);
}
}

View file

@ -459,6 +459,9 @@ if(appInfo.platformVersion[0] >= 2) {
observerService.notifyObservers(Zotero, "zotero-reloaded", null);
}
Zotero.debug('Triggering "zotero-loaded" event');
observerService.notifyObservers(Zotero, "zotero-loaded", null);
return true;
}