Originally created by: kristofferR
Split out from the [#48] review (PR [#70]).
inject/src/messenger/features/media-permissions.ts sets window.__carrierInCall = true when getUserMedia succeeds and clears it from each track's ended event. Auto-refresh reads this flag so it never reloads the page mid-call. Two issues:
MediaStreamTrack.stop() does not fire ended (per spec — ended is only for external termination like a revoked permission or hardware disconnect). A normal hangup that stops tracks can therefore leave __carrierInCall stuck true, blocking auto-refresh indefinitely.Pre-existing behavior, transcribed verbatim in PR [#70]'s no-behavior-change refactor. CodeRabbit rated it a "heavy lift" and agreed it was reasonable to defer — a correct fix is a small redesign, not a one-liner, and needs camera/mic testing.
Replace the boolean with a shared live-track counter:
getUserMedia.ended, and an explicit stop/teardown wrapper (e.g. patch MediaStreamTrack.stop to decrement, or observe track readyState) — guarding against double-decrement.__carrierInCall becomes counter > 0.Verify a normal hangup clears the state (auto-refresh resumes) and that overlapping calls don't clear it prematurely.
Ref [#48]
Ticket changed by: kristofferR
Originally posted by: kristofferR
Fixed in [#140]. In-call state is now tracked with a live media-track counter instead of the global
__carrierInCallboolean.Related
Tickets:
#140