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