From d276ec19c563c345d4d444babfff97f39b7c0315 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 29 Aug 2026 12:06:43 -0400 Subject: [PATCH] Fix the window lookup for OS keystore alerts 'zotero:main' isn't a registered window type, so the lookup always returned null and the alerts were never shown. https://forums.zotero.org/discussion/133418/ --- chrome/content/zotero/xpcom/osKeyStore.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/osKeyStore.js b/chrome/content/zotero/xpcom/osKeyStore.js index 4fa002def8..5fce04c794 100644 --- a/chrome/content/zotero/xpcom/osKeyStore.js +++ b/chrome/content/zotero/xpcom/osKeyStore.js @@ -56,9 +56,16 @@ Zotero.OSKeyStore = { return typeof value == 'string' && value.startsWith(this._prefix); }, + // The settings window, where credentials are usually saved from, or the main window when + // they're saved during a sync + _getParentWindow: function () { + return Services.wm.getMostRecentWindow('zotero:pref') + || Services.wm.getMostRecentWindow('navigator:browser'); + }, + // Show an alert when an active write of new credentials fails (e.g., keychain unavailable) alertSaveFailed: function () { - let win = Services.wm.getMostRecentWindow('zotero:main'); + let win = this._getParentWindow(); if (!win) { return; } @@ -78,7 +85,7 @@ Zotero.OSKeyStore = { return; } this._migrateAlertShown = true; - let win = Services.wm.getMostRecentWindow('zotero:main'); + let win = this._getParentWindow(); if (!win) { return; }