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
+6 -2
View File
@@ -88,6 +88,7 @@
getTabId,
isTabAlive,
markCurrentRegistrationAccountUsed,
queryTabsInAutomationWindow = null,
setState,
sleepWithStop,
waitForTabCompleteUntilStopped,
@@ -1364,13 +1365,16 @@
return null;
}
const activeTabs = await chrome.tabs.query({ active: true, currentWindow: true }).catch(() => []);
const queryTabs = typeof queryTabsInAutomationWindow === 'function'
? queryTabsInAutomationWindow
: (queryInfo) => chrome.tabs.query(queryInfo);
const activeTabs = await queryTabs({ active: true, currentWindow: true }).catch(() => []);
const activeCheckoutTab = activeTabs.find((tab) => Number.isInteger(tab?.id) && isPlusCheckoutUrl(tab.url));
if (activeCheckoutTab) {
return activeCheckoutTab.id;
}
const checkoutTabs = await chrome.tabs.query({ url: 'https://chatgpt.com/checkout/*' }).catch(() => []);
const checkoutTabs = await queryTabs({ url: 'https://chatgpt.com/checkout/*' }).catch(() => []);
const checkoutTab = checkoutTabs.find((tab) => Number.isInteger(tab?.id) && isPlusCheckoutUrl(tab.url));
return checkoutTab?.id || null;
}