From 5863991bfb28bc80f3b13c7e9479237399bf306a Mon Sep 17 00:00:00 2001 From: KoalaDev <6156589+Shik3i@users.noreply.github.com> Date: Fri, 26 Jun 2026 13:23:24 +0200 Subject: [PATCH] fix(host-control-mode): remove redundant CONTENT_EVENT guard, persist desync in storage, block stale tab HCM_DESYNC_STATE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original code at L1957 already validates sender.tab tabId against currentTabId before calling processEvent() — added guard was duplicate. HCM_DESYNC_STATE had no such guard; added with same sender.tab && currentTabId pattern (popup-safe via undefined short-circuit). hcmDesynced now persisted in session storage: - Restored in ensureState() - Set on HCM_DESYNC_STATE change - Reset to false in all 3 teardown storage.sets Survives SW restarts; cleared on leave/switch/idle-room --- extension/background.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/extension/background.js b/extension/background.js index e2123e5..5ab34f4 100644 --- a/extension/background.js +++ b/extension/background.js @@ -1857,13 +1857,6 @@ async function handleAsyncMessage(message, sender, sendResponse) { } }); } else if (message.type === 'CONTENT_EVENT') { - // Only process media events from the currently selected tab — ignore - // stale content scripts in previously-selected tabs. Popup-originated - // events (no sender.tab) always pass through. - if (sender.tab && currentTabId && currentTabId !== sender.tab.id) { - sendResponse({ status: 'ignored_unselected_tab' }); - return; - } const processEvent = () => { // Host Control Mode (sender-side): a guest in host-only mode must not // drive the room. Don't broadcast; hand the action back to content.js so