fix(extension): handle browser error pages gracefully
Testing / test (push) Successful in 37s
Testing / remote-protocol-compat (0.9.3) (push) Successful in 39s
Testing / remote-protocol-compat (0.9.5) (push) Successful in 24s

- Treat chrome error page script failures as transient during injection retries.
- Return safe fallback values for read-only DOM commands when tabs land on browser error pages.
- Improve URL watch handling by checking pending URLs and reporting last seen URL/status on timeout.
- Bump package and extension version to 0.9.6 and add regression coverage for error-page behavior.
This commit is contained in:
2026-05-14 13:39:09 +02:00
parent a8b433aa29
commit f79ff0e3c2
7 changed files with 150 additions and 52 deletions
+11 -1
View File
@@ -5,12 +5,22 @@ export async function getProfileAlias() {
return profileAlias || "default";
}
export function isErrorPageScriptError(error) {
const message = String(error?.message || error || "");
return message.includes("error page") || message.includes("chrome-error://chromewebdata");
}
export function isTransientScriptError(error) {
const message = String(error?.message || error || "");
return message.includes("Frame with ID") || message.includes("No tab with id") || isErrorPageScriptError(error);
}
export async function executeScript(options, retries = 3) {
for (let i = 0; i < retries; i++) {
try {
return await chrome.scripting.executeScript(options);
} catch (e) {
if (i < retries - 1 && e.message && (e.message.includes("Frame with ID") || e.message.includes("No tab with id")) && !e.message.includes("error page")) {
if (i < retries - 1 && isTransientScriptError(e)) {
await new Promise(r => setTimeout(r, 300));
continue;
}