Bug 1294576 - Remove device sharing indicator on location changes, r=johannh.

This commit is contained in:
Florian Quèze 2016-09-08 12:46:25 +02:00
Родитель 1a53278e41
Коммит 564b3b6ddd
3 изменённых файлов: 45 добавлений и 0 удалений

Просмотреть файл

@ -4837,6 +4837,12 @@ var TabsProgressListener = {
if (!Object.getOwnPropertyDescriptor(window, "PopupNotifications").get)
PopupNotifications.locationChange(aBrowser);
let tab = gBrowser.getTabForBrowser(aBrowser);
if (tab && tab._sharingState) {
gBrowser.setBrowserSharing(aBrowser, {});
webrtcUI.forgetStreamsFromBrowser(aBrowser);
}
gBrowser.getNotificationBox(aBrowser).removeTransientNotifications();
FullZoom.onLocationChange(aLocationURI, false, aBrowser);

Просмотреть файл

@ -197,6 +197,41 @@ var gTests = [
yield expectNoObserverCalled();
yield checkNotSharing();
}
},
{
desc: "getUserMedia audio+video: reloading the top level page removes all sharing UI",
run: function* checkReloading() {
let promise = promisePopupNotificationShown("webRTC-shareDevices");
yield promiseRequestDevice(true, true, "frame1");
yield promise;
yield expectObserverCalled("getUserMedia:request");
checkDeviceSelectors(true, true);
let indicator = promiseIndicatorWindow();
yield promiseMessage("ok", () => {
PopupNotifications.panel.firstChild.button.click();
});
yield expectObserverCalled("getUserMedia:response:allow");
yield expectObserverCalled("recording-device-events");
is((yield getMediaCaptureState()), "CameraAndMicrophone",
"expected camera and microphone to be shared");
yield indicator;
yield checkSharingUI({video: true, audio: true});
info("reloading the web page");
promise = promiseObserverCalled("recording-device-events");
content.location.reload();
yield promise;
if ((yield promiseTodoObserverNotCalled("recording-device-events")) == 1) {
todo(false, "Got the 'recording-device-events' notification twice, likely because of bug 962719");
}
yield expectObserverCalled("recording-window-ended");
yield expectNoObserverCalled();
yield checkNotSharing();
}
}
];

Просмотреть файл

@ -128,6 +128,10 @@ this.webrtcUI = {
}
},
forgetStreamsFromBrowser: function(aBrowser) {
this._streams = this._streams.filter(stream => stream.browser != aBrowser);
},
showSharingDoorhanger: function(aActiveStream, aType) {
let browserWindow = aActiveStream.browser.ownerGlobal;
if (aActiveStream.tab) {