Closed Bug 1734099 Opened 4 months ago Closed 2 months ago

We should not unload tabs with webrtc peer connections

Categories

(Firefox :: Tabbed Browser, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: toshi, Assigned: toshi)

References

(Regressed 1 open bug)

Details

Attachments

(1 file)

The tab unloader deprioritizes tabs with webrtc streams. Here are the ideas from the media team. We should check at least HasActivePeerconnections.

  • media recorder needs a stream to record, so it should be covered by browserHasStreams. It looks like browserHasStreams covers tracks from getUserMedia and getDisplayMedia. There could also be ones generated from canvas capture and webAudio. canvases are not rendered in background tabs so canvas capture is not very useful then.

  • Media recorder typically is being used to record a stream from a camera/mic, as pehrsons says, or maybe from a Peerconnection (but that would be covered by HasActivePeerconnections). A WebAudio or screencapture source would be about the only thing not covered; I don't know if there are easy ways to check if mediarecorder is in use; I don't think there is. pehrsons that does remind me that tabs using MediaRecorder shouldn't be allowed in the bfcache, though...

This patch makes sure the Tab Unloading feature does not unload tabs that have
active peer connections not to disrupt browsing experience based on WebRTC peer
connections.

To enable JS code to access the number of active peer connections, this patch
moves nsPIDOMWindowInner::mTotalActivePeerConnections to WindowContext as
a synched field of the top window.

Pushed by tkikuchi@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/812ed5275f0d
Never unload tabs with active RTCPeerConnection instances.  r=peterv,jesup
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
You need to log in before you can comment on or make changes to this bug.