fix(tabs): scope payment task tab lookup

This commit is contained in:
朴圣佑
2026-05-12 11:10:03 +08:00
parent 80c3e6217f
commit 7a5b7a26cf
6 changed files with 58 additions and 6 deletions
+5 -1
View File
@@ -21,6 +21,7 @@
ensureContentScriptReadyOnTabUntilStopped,
getTabId,
isTabAlive,
queryTabsInAutomationWindow = null,
registerTab,
sendTabMessageUntilStopped,
setState,
@@ -110,7 +111,10 @@
if (!chrome?.tabs?.query) {
return 0;
}
const tabs = await chrome.tabs.query({}).catch(() => []);
const queryTabs = typeof queryTabsInAutomationWindow === 'function'
? queryTabsInAutomationWindow
: (queryInfo) => chrome.tabs.query(queryInfo);
const tabs = await queryTabs({}).catch(() => []);
const candidates = (Array.isArray(tabs) ? tabs : [])
.filter((tab) => Number.isInteger(tab?.id) && predicate(tab.url || ''));
if (!candidates.length) {