author | Johann Hofmann <jhofmann@mozilla.com> |
Thu, 08 Mar 2018 14:08:21 +0100 | |
changeset 459763 | 2a403dec22d8ad4ba4c2a4a501f96959f02ee7db |
parent 459762 | 07b6161c7f60c5bc4d71388d952f1e643cdc8837 |
child 459764 | f16ffbb4a46ae1178aff31d9100cca09792a4fff |
push id | 8824 |
push user | archaeopteryx@coole-files.de |
push date | Mon, 12 Mar 2018 14:54:48 +0000 |
treeherder | mozilla-beta@8d9daab95d68 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | florian |
bugs | 1442294 |
milestone | 60.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
browser/base/content/test/webrtc/head.js | file | annotate | diff | comparison | revisions | |
browser/modules/ContentWebRTC.jsm | file | annotate | diff | comparison | revisions |
--- a/browser/base/content/test/webrtc/head.js +++ b/browser/base/content/test/webrtc/head.js @@ -470,16 +470,20 @@ async function checkSharingUI(aExpected, let doc = aWin.document; // First check the icon above the control center (i) icon. let identityBox = doc.getElementById("identity-box"); ok(identityBox.hasAttribute("sharing"), "sharing attribute is set"); let sharing = identityBox.getAttribute("sharing"); if (aExpected.screen) is(sharing, "screen", "showing screen icon in the identity block"); + else if (aExpected.video == STATE_CAPTURE_ENABLED) + is(sharing, "camera", "showing camera icon in the identity block"); + else if (aExpected.audio == STATE_CAPTURE_ENABLED) + is(sharing, "microphone", "showing mic icon in the identity block"); else if (aExpected.video) is(sharing, "camera", "showing camera icon in the identity block"); else if (aExpected.audio) is(sharing, "microphone", "showing mic icon in the identity block"); let allStreamsPaused = Object.values(aExpected).every(isPaused); is(identityBox.hasAttribute("paused"), allStreamsPaused, "sharing icon(s) should be in paused state when paused");
--- a/browser/modules/ContentWebRTC.jsm +++ b/browser/modules/ContentWebRTC.jsm @@ -379,30 +379,41 @@ function getTabStateForContentWindow(aCo tabState.screen = "ScreenPaused"; else if (window.value == MediaManagerService.STATE_CAPTURE_DISABLED) tabState.screen = "WindowPaused"; else if (app.value == MediaManagerService.STATE_CAPTURE_DISABLED) tabState.screen = "ApplicationPaused"; else if (browser.value == MediaManagerService.STATE_CAPTURE_DISABLED) tabState.screen = "BrowserPaused"; - if (tabState.screen) { + let screenEnabled = tabState.screen && !tabState.screen.includes("Paused"); + let cameraEnabled = tabState.camera == MediaManagerService.STATE_CAPTURE_ENABLED; + let microphoneEnabled = tabState.microphone == MediaManagerService.STATE_CAPTURE_ENABLED; + + // tabState.sharing controls which global indicator should be shown + // for the tab. It should always be set to the _enabled_ device which + // we consider most intrusive (screen > camera > microphone). + if (screenEnabled) { + tabState.sharing = "screen"; + } else if (cameraEnabled) { + tabState.sharing = "camera"; + } else if (microphoneEnabled) { + tabState.sharing = "microphone"; + } else if (tabState.screen) { tabState.sharing = "screen"; } else if (tabState.camera) { tabState.sharing = "camera"; } else if (tabState.microphone) { tabState.sharing = "microphone"; } // The stream is considered paused when we're sharing something // but all devices are off or set to disabled. tabState.paused = tabState.sharing && - (!tabState.screen || tabState.screen.includes("Paused")) && - tabState.camera != MediaManagerService.STATE_CAPTURE_ENABLED && - tabState.microphone != MediaManagerService.STATE_CAPTURE_ENABLED; + !screenEnabled && !cameraEnabled && !microphoneEnabled; tabState.windowId = getInnerWindowIDForWindow(aContentWindow); tabState.documentURI = aContentWindow.document.documentURI; return tabState; } function getInnerWindowIDForWindow(aContentWindow) {