fix(extension): report why a target failed instead of a generic comm error

The dev panel asked the content script for video state even when activation
never completed, so every failure surfaced as "communication with the tab
video failed" — the one message that says nothing about the cause. It now
shows the activation state and its actual error, and content injection logs
the frame it was aimed at.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Timo
2026-08-18 00:36:23 +02:00
parent fd42de365a
commit aa5173e0d4
2 changed files with 27 additions and 1 deletions
+8
View File
@@ -2504,6 +2504,14 @@ async function injectContentScript(tabId, {
try { error.contentTarget = contentTarget; } catch { /* immutable browser error */ }
throw error;
}
// Name the frame the injection was aimed at. Without it every failure
// reads the same in the log and there is no way to tell a denied player
// frame from a document that navigated mid-injection.
addLog(
`Content injection failed in frame ${contentTarget.frameId}`
+ `${contentTarget.frameUrl ? ` (${contentTarget.frameUrl})` : ''}: ${error?.message}`,
'warn'
);
if (navigationRetries > 0 && isMediaTargetNavigationError(error)) {
return injectContentScript(tabId, {
requestHostAccess,