Fix regression in b8ad18e96d

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()`.
This commit is contained in:
Dan Stillman 2021-06-26 17:46:43 -04:00
parent ebc21742dd
commit 06075a25c0

View file

@ -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