mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-08-05 17:07:43 +00:00
fix(host-control-mode): remove redundant CONTENT_EVENT guard, persist desync in storage, block stale tab HCM_DESYNC_STATE
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user