commit d5cf33a798a08ea5ad56ac777fc199d0f9c1daf0
parent 64414e49be29b5ecba22b53def158d2508b21de6
Author: Adomas VenĨkauskas <adomas.ven@gmail.com>
Date: Tue, 21 Mar 2017 12:47:32 +0200
Fix document preferences dialog failing when styles unloaded.
Closes #1084
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/bibliography.js b/chrome/content/zotero/bibliography.js
@@ -45,7 +45,7 @@ var Zotero_File_Interface_Bibliography = new function() {
* Initialize some variables and prepare event listeners for when chrome is done
* loading
*/
- this.init = function () {
+ this.init = Zotero.Promise.coroutine(function* () {
// Set font size from pref
// Affects bibliography.xul and integrationDocPrefs.xul
var bibContainer = document.getElementById("zotero-bibliography-container");
@@ -68,6 +68,8 @@ var Zotero_File_Interface_Bibliography = new function() {
}
// add styles to list
+
+ yield Zotero.Styles.init();
var styles = Zotero.Styles.getVisible();
var index = 0;
var nStyles = styles.length;
@@ -171,7 +173,7 @@ var Zotero_File_Interface_Bibliography = new function() {
// set style to false, in case this is cancelled
_io.style = false;
- };
+ });
/*
* Called when locale is changed
diff --git a/chrome/content/zotero/xpcom/style.js b/chrome/content/zotero/xpcom/style.js
@@ -49,7 +49,6 @@ Zotero.Styles = new function() {
this.reinit = Zotero.Promise.coroutine(function* () {
Zotero.debug("Initializing styles");
var start = new Date;
- _initialized = true;
// Upgrade style locale prefs for 4.0.27
var bibliographyLocale = Zotero.Prefs.get("export.bibliographyLocale");
@@ -114,6 +113,7 @@ Zotero.Styles = new function() {
_renamedStyles = xmlhttp.response;
}
})
+ _initialized = true;
});
this.init = Zotero.lazy(this.reinit);