From 232d5e7ac2fcca24850dae239bc5d2f8ed26c7fb Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Wed, 2 Jul 2025 11:13:22 -0400 Subject: [PATCH] Migrate Zotero.Promise#cancel() in zoteroPane.js --- chrome/content/zotero/zoteroPane.js | 31 ++++++++++------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index a874076711..4879ad63f7 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -1394,10 +1394,9 @@ var ZoteroPane = new function () { let row = this.getCollectionTreeRow(); if (!row || !row.isFeedsOrFeed()) return; this.toggleSelectedItemsRead(); - if (itemReadPromise) { - // FIXME: fx140: replace call to Zotero.Promise instance method 'cancel()' - itemReadPromise.cancel(); - itemReadPromise = null; + if (itemReadTimeout) { + clearTimeout(itemReadTimeout); + itemReadTimeout = null; } break; @@ -6348,18 +6347,17 @@ var ZoteroPane = new function () { } }; - var itemReadPromise; + var itemReadTimeout = null; this.startItemReadTimeout = function (feedItemID) { - if (itemReadPromise) { - // FIXME: fx140: replace call to Zotero.Promise instance method 'cancel()' - itemReadPromise.cancel(); + if (itemReadTimeout) { + clearTimeout(itemReadTimeout); + itemReadTimeout = null; } const FEED_READ_TIMEOUT = 1000; - itemReadPromise = Zotero.Promise.delay(FEED_READ_TIMEOUT) - .then(async function () { - itemReadPromise = null; + itemReadTimeout = setTimeout(async () => { + itemReadTimeout = null; // Check to make sure we're still on the same item var items = this.getSelectedItems(); @@ -6376,15 +6374,8 @@ var ZoteroPane = new function () { await feedItem.toggleRead(true); this.itemPane.setReadLabel(true); - }.bind(this)) - .catch(function (e) { - if (e instanceof Zotero.Promise.CancellationError) { - Zotero.debug(e.message); - return; - } - Zotero.logError(e); - }); - } + }, FEED_READ_TIMEOUT); + }; function reportErrors() {