From e5fb1763cc0af9471e511df25ba4eedfbafbfd0c Mon Sep 17 00:00:00 2001 From: pbz Date: Fri, 12 Jun 2020 19:18:25 +0000 Subject: [PATCH] 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 --- browser/modules/webrtcUI.jsm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/browser/modules/webrtcUI.jsm b/browser/modules/webrtcUI.jsm index 58809a26cde6..73a7728ef5a2 100644 --- a/browser/modules/webrtcUI.jsm +++ b/browser/modules/webrtcUI.jsm @@ -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;