Closed Bug 1734099 Opened 2 years ago Closed 2 years ago

We should not unload tabs with webrtc peer connections


(Firefox :: Tabbed Browser, enhancement)




96 Branch
Tracking Status
firefox96 --- fixed


(Reporter: toshi, Assigned: toshi)


(Regressed 1 open bug)



(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

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
Never unload tabs with active RTCPeerConnection instances.  r=peterv,jesup
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
You need to log in before you can comment on or make changes to this bug.