Bug 1636496 - Only show global sharing indicator window if we have a media indicator to show. r=johannh

The webrtc global indicator shows media indicators based on the indicator state
of the individual tabs.
Determining the visibility of the global indicator based on if there are active
streams (globally), but saving that state on tab level, lead to conditions where,
after a stream had ended, no tab had any indicators set, but a stray global
indicator without any icons would still be shown.
This patch fixes that by only showing the global indicator if there is actually
a tab with an indicator.

Differential Revision: https://phabricator.services.mozilla.com/D79315
This commit is contained in:
pbz 2020-06-12 19:18:25 +00:00
parent 5de135d535
commit e5fb1763cc

View File

@ -98,7 +98,11 @@ var webrtcUI = {
get showGlobalIndicator() {
for (let [, indicators] of this.perTabIndicators) {
if (indicators.showGlobalIndicator) {
if (
indicators.showCameraIndicator ||
indicators.showMicrophoneIndicator ||
indicators.showScreenSharingIndicator
) {
return true;
}
}
@ -489,7 +493,6 @@ var webrtcUI = {
this.perTabIndicators.set(aTopBrowsingContext, indicators);
}
indicators.showGlobalIndicator = !!webrtcUI._streams.length;
indicators.showCameraIndicator = tabState.showCameraIndicator;
indicators.showMicrophoneIndicator = tabState.showMicrophoneIndicator;
indicators.showScreenSharingIndicator = tabState.showScreenSharingIndicator;