fx-compat: Scaffold: Non-async detectWeb and async scrape by default

We don't usually want an async detectWeb, since HTTP requests should only be
used there in very exceptional cases. We do usually want an async scrape (and we
were already - mistakenly - awaiting it).
This commit is contained in:
Abe Jellinek 2022-08-17 16:31:30 -04:00
parent f7b8d25e75
commit f5f49c7b1d

View file

@ -22,7 +22,7 @@
*/
async function detectWeb(doc, url) {
function detectWeb(doc, url) {
// TODO: adjust the logic here
if ($$CURSOR$$url.includes('/article/')) {
return 'newspaperArticle';
@ -52,7 +52,7 @@ function getSearchResults(doc, checkOnly) {
}
async function doWeb(doc, url) {
if (await detectWeb(doc, url) == 'multiple') {
if (detectWeb(doc, url) == 'multiple') {
let items = await Zotero.selectItems(getSearchResults(doc, false));
if (items) {
await Promise.all(
@ -66,7 +66,7 @@ async function doWeb(doc, url) {
}
}
function scrape(doc, url = doc.location.href) {
async function scrape(doc, url = doc.location.href) {
// TODO: implement or add a scrape function template
}