mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-08-24 17:56:27 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user