diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 7bbeb0a692..dc0039528e 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -205,6 +205,8 @@ const { CommandLineOptions } = ChromeUtils.importESModule("chrome://zotero/conte this.uiReadyPromise.then(() => { Zotero.debug("User interface ready in " + (new Date() - _startupTime) + " ms"); }); + this.startupSyncDeferred = Zotero.Promise.defer(); + this.startupSyncPromise = this.startupSyncDeferred.promise; if (options) { let opts = [ diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 54d8c11511..0a59c7b583 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -862,6 +862,7 @@ var ZoteroPane = new function () { } // Auto-sync on pane open or if new account + let startupSync = false; if (Zotero.Prefs.get('sync.autoSync') || Zotero.initAutoSync) { await Zotero.proxyAuthComplete; await Zotero.uiReadyPromise; @@ -879,11 +880,19 @@ var ZoteroPane = new function () { Zotero.debug('Firefox profile access error -- skipping initial auto-sync', 4); } else { + startupSync = true; Zotero.Sync.Runner.sync({ background: true - }).then(() => Zotero.initAutoSync = false); + }) + .then(() => { + Zotero.initAutoSync = false; + Zotero.startupSyncDeferred.resolve(); + }); } } + if (!startupSync) { + Zotero.startupSyncDeferred.resolve(); + } // Set sync icon to spinning if there's an existing sync //