diff --git a/chrome/content/zotero/bibliography.js b/chrome/content/zotero/bibliography.js index 5e198255fe..85b3fc35d7 100644 --- a/chrome/content/zotero/bibliography.js +++ b/chrome/content/zotero/bibliography.js @@ -67,8 +67,11 @@ var Zotero_File_Interface_Bibliography = new function() { _io.style = Zotero.Prefs.get("export.lastStyle"); } - // Initialize styles - yield Zotero.Styles.init(); + // See note in style.js + if (!Zotero.Styles.initialized) { + // Initialize styles + yield Zotero.Styles.init(); + } // add styles to list diff --git a/chrome/content/zotero/xpcom/style.js b/chrome/content/zotero/xpcom/style.js index f73a3c54a1..84395c393a 100644 --- a/chrome/content/zotero/xpcom/style.js +++ b/chrome/content/zotero/xpcom/style.js @@ -117,6 +117,14 @@ Zotero.Styles = new function() { }); this.init = Zotero.lazy(this.reinit); + // This is used by bibliography.js to work around a weird interaction between Bluebird and modal + // dialogs in tests. Calling `yield Zotero.Styles.init()` from `Zotero_File_Interface_Bibliography.init()` + // in the modal Create Bibliography dialog results in a hang, so instead use a synchronous check for + // initialization. The hang doesn't seem to happen (at least in the same way) outside of tests. + this.initialized = function () { + return _initialized; + }; + /** * Reads all styles from a given directory and caches their metadata * @private