Don't update item type menus within transaction when updating schema

This caused an error reported here, though I can't reproduce it:

https://forums.zotero.org/discussion/80287/zotero-database-upgrade-error
This commit is contained in:
Dan Stillman 2019-12-02 04:27:01 -07:00
parent 858de5e6f2
commit 222870d3c7

View file

@ -775,14 +775,15 @@ Zotero.Schema = new function(){
yield Zotero.SearchConditions.init();
// Update item type menus in every open window
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var enumerator = wm.getEnumerator("navigator:browser");
while (enumerator.hasMoreElements()) {
var win = enumerator.getNext();
win.ZoteroPane.buildItemTypeSubMenu();
win.document.getElementById('zotero-editpane-item-box').buildItemTypeMenu();
}
Zotero.Schema.schemaUpdatePromise.then(function () {
var wm = Services.wm;
var enumerator = wm.getEnumerator("navigator:browser");
while (enumerator.hasMoreElements()) {
let win = enumerator.getNext();
win.ZoteroPane.buildItemTypeSubMenu();
win.document.getElementById('zotero-editpane-item-box').buildItemTypeMenu();
}
});
});