Skip to content

Fix stale frame routing in hotkey and speed control flows#871

Open
CMJNB wants to merge 3 commits intopolywock:masterfrom
CMJNB:fix/hotkey-media-frame-routing
Open

Fix stale frame routing in hotkey and speed control flows#871
CMJNB wants to merge 3 commits intopolywock:masterfrom
CMJNB:fix/hotkey-media-frame-routing

Conversation

@CMJNB
Copy link
Copy Markdown
Contributor

@CMJNB CMJNB commented Apr 7, 2026

Background

After page navigation or iframe recreation, stale frame IDs can remain in media cache.
This may cause hotkeys or speed-related messages to be sent to dead frames on first attempt.

Changes

  • Improved media auto-selection:
    • Added content-script liveness check for the final candidate.
    • If the selected frame is stale, remove the corresponding m:scope:tabId:frameId entry and reselect.
  • Improved media event delivery:
    • Check target frame availability before sending.
    • Fallback to frameId=0 when the original frame is unavailable.
  • Improved temporary speed delivery:
    • Applied the same frame liveness check and fallback strategy to temporary-speed messages.

Scope

  • Only affects media message routing and frame-id recovery logic.
  • Does not change speed/lastSpeed context semantics or toggle strategy.
  • Other command behaviors remain unchanged.

Files

  • src/background/utils/getAutoMedia.ts
  • src/utils/configUtils.ts
  • src/background/utils/processKeybinds.ts

Validation

  • Local build passes (npm run dev).
  • Stale-frame scenarios now recover by rerouting to a live frame.

@CMJNB
Copy link
Copy Markdown
Contributor Author

CMJNB commented Apr 7, 2026

Thanks for the fix and iteration, really appreciate the effort.
Two small notes for reference:

  1. Some parts of this change may still be a bit inconsistent in coding style. If possible, could we do a light cleanup pass later? Sorry for the extra ask.
  2. I have tested this for a full day on the websites that usually expose this issue, and the previous problem is now mostly gone; that said, I think it still makes sense to keep monitoring for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant