diff --git a/chrome/content/zotero/xpcom/ipc.js b/chrome/content/zotero/xpcom/ipc.js index 107b3d8355..7079c15e37 100755 --- a/chrome/content/zotero/xpcom/ipc.js +++ b/chrome/content/zotero/xpcom/ipc.js @@ -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 diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 685b000307..94f1f71e58 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -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); } } diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 2f4cbbd029..fcce0be1bd 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -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; }