From 07309d7c25efa4a9e6aa5353dfaf8ca8727c415c Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 3 Aug 2023 05:11:26 -0400 Subject: [PATCH] Add Zotero.getMainWindows() --- chrome/content/zotero/xpcom/zotero.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 1b262565ed..756647faf9 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -79,6 +79,18 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); this.getMainWindow = function () { return Services.wm.getMostRecentWindow("navigator:browser"); }; + + /** + * @return {ChromeWindow[]} - An array of open windows + */ + this.getMainWindows = function () { + var enumerator = Services.wm.getEnumerator("navigator:browser"); + var windows = []; + while (enumerator.hasMoreElements()) { + windows.push(enumerator.getNext()); + } + return windows; + }; this.getActiveZoteroPane = function() { var win = Services.wm.getMostRecentWindow("navigator:browser");