зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1616600, properly update the tab-indicator state when a tab is closed; it previously wasn't being removed properly from the per-tab indicator map when the indicator was from a subframe,r=johannh
Differential Revision: https://phabricator.services.mozilla.com/D63535 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a973454927
Коммит
64d1a3665c
|
@ -505,6 +505,74 @@ var gTests = [
|
|||
await reloadAndAssertClosedStreams();
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
desc:
|
||||
"getUserMedia audio+video: closing a window with two frames sharing at the same time, closes the indicator",
|
||||
skipObserverVerification: true,
|
||||
run: async function checkFrameIndicatorClosedUI() {
|
||||
// This tests a case where the indicator didn't close when audio/video is
|
||||
// shared in two subframes and then the tabs are closed.
|
||||
|
||||
let tabsToRemove = [gBrowser.selectedTab];
|
||||
|
||||
for (let t = 0; t < 2; t++) {
|
||||
let frame1BC = gShouldObserveSubframes
|
||||
? gBrowser.selectedBrowser.browsingContext.getChildren()[0]
|
||||
: undefined;
|
||||
|
||||
let observerPromise = expectObserverCalled(
|
||||
"getUserMedia:request",
|
||||
1,
|
||||
frame1BC
|
||||
);
|
||||
let promise = promisePopupNotificationShown("webRTC-shareDevices");
|
||||
await promiseRequestDevice(true, true, "frame1");
|
||||
await promise;
|
||||
await observerPromise;
|
||||
checkDeviceSelectors(true, true);
|
||||
|
||||
// During the second pass, the indicator is already open.
|
||||
let indicator = t == 0 ? promiseIndicatorWindow() : Promise.resolve();
|
||||
|
||||
let observerPromise1 = expectObserverCalled(
|
||||
"getUserMedia:response:allow",
|
||||
1,
|
||||
frame1BC
|
||||
);
|
||||
let observerPromise2 = expectObserverCalled(
|
||||
"recording-device-events",
|
||||
1,
|
||||
frame1BC
|
||||
);
|
||||
await promiseMessage("ok", () => {
|
||||
PopupNotifications.panel.firstElementChild.button.click();
|
||||
});
|
||||
await observerPromise1;
|
||||
await observerPromise2;
|
||||
Assert.deepEqual(
|
||||
await getMediaCaptureState(),
|
||||
{ audio: true, video: true },
|
||||
"expected camera and microphone to be shared"
|
||||
);
|
||||
|
||||
await indicator;
|
||||
await checkSharingUI({ video: true, audio: true });
|
||||
|
||||
// The first time around, open another tab with the same uri.
|
||||
// The second time, just open a normal test tab.
|
||||
let uri = t == 0 ? gBrowser.selectedBrowser.currentURI.spec : undefined;
|
||||
tabsToRemove.push(
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, uri)
|
||||
);
|
||||
}
|
||||
|
||||
BrowserTestUtils.removeTab(tabsToRemove[0]);
|
||||
BrowserTestUtils.removeTab(tabsToRemove[1]);
|
||||
|
||||
await checkNotSharing();
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
add_task(async function test_inprocess() {
|
||||
|
|
|
@ -280,8 +280,17 @@ var webrtcUI = {
|
|||
}
|
||||
}
|
||||
|
||||
if (aBrowsingContext == aBrowsingContext.top) {
|
||||
this.perTabIndicators.delete(aBrowsingContext);
|
||||
// Remove the per-tab indicator if it no longer needs to be displayed.
|
||||
let topBC = aBrowsingContext.top;
|
||||
if (this.perTabIndicators.has(topBC)) {
|
||||
let tabState = this.getCombinedStateForBrowser(topBC);
|
||||
if (
|
||||
!tabState.showCameraIndicator &&
|
||||
!tabState.showMicrophoneIndicator &&
|
||||
!tabState.showScreenSharingIndicator
|
||||
) {
|
||||
this.perTabIndicators.delete(topBC);
|
||||
}
|
||||
}
|
||||
|
||||
this.updateGlobalIndicator();
|
||||
|
|
Загрузка…
Ссылка в новой задаче