refactor: harden browser relay CDP flows

This commit is contained in:
Peter Steinberger
2026-03-08 23:45:59 +00:00
committed by Vincent Koc
parent 017b389549
commit 43451ebab7
18 changed files with 874 additions and 176 deletions

View File

@@ -46,3 +46,19 @@ export function isRetryableReconnectError(err) {
}
return true;
}
export function isMissingTabError(err) {
const message = (err instanceof Error ? err.message : String(err || "")).toLowerCase();
return (
message.includes("no tab with id") ||
message.includes("no tab with given id") ||
message.includes("tab not found")
);
}
export function isLastRemainingTab(allTabs, tabIdToClose) {
if (!Array.isArray(allTabs)) {
return true;
}
return allTabs.filter((tab) => tab && tab.id !== tabIdToClose).length === 0;
}