From 06075a25c0abda54e011323f8bfad882568f3944 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 26 Jun 2021 17:46:43 -0400 Subject: [PATCH] Fix regression in b8ad18e96d5 We're relying on Bluebird's synchronous promise inspection for noWait translate mode (as used in Quick Copy). We should decide if we want to keep the Bluebird dependency or rewrite this to use native promises (e.g., with a separate synchronous `_loadTranslator()` function for noWait mode), but for now just restore the `Zotero.Promise.method()`. --- chrome/content/zotero/xpcom/translation/translate.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 26cc063985..78a7d885ee 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -1756,7 +1756,7 @@ Zotero.Translate.Base.prototype = { * @param {Zotero.Translator} translator * @return {Promise} */ - _loadTranslator: async function (translator) { + _loadTranslator: Zotero.Promise.method(function (translator) { var sandboxLocation = this._getSandboxLocation(); if(!this._sandboxLocation || sandboxLocation !== this._sandboxLocation) { this._sandboxLocation = sandboxLocation; @@ -1805,10 +1805,9 @@ Zotero.Translate.Base.prototype = { parse(codePromise.value()); } else { - let code = await translator.getCode(); - await parse(code); + return translator.getCode().then(parse); } - }, + }), /** * Generates a sandbox for scraping/scraper detection