fix: detect contact-verification 500 without content scripts

This commit is contained in:
imxiaozhan
2026-05-10 04:57:09 -04:00
parent b69cadde3e
commit 3763da7a14
4 changed files with 280 additions and 3 deletions
+13 -2
View File
@@ -12209,6 +12209,17 @@ async function readAuthTabSnapshot(tabId) {
if (!Number.isInteger(tabId)) {
return null;
}
let tabSnapshot = null;
try {
const tab = await chrome.tabs.get(tabId);
tabSnapshot = {
url: String(tab?.url || ''),
title: String(tab?.title || ''),
text: '',
};
} catch {
tabSnapshot = null;
}
try {
const executionResults = await chrome.scripting.executeScript({
target: { tabId },
@@ -12219,9 +12230,9 @@ async function readAuthTabSnapshot(tabId) {
text: String(document.body?.innerText || document.documentElement?.innerText || '').trim(),
}),
});
return executionResults?.[0]?.result || null;
return executionResults?.[0]?.result || tabSnapshot;
} catch {
return null;
return tabSnapshot;
}
}