Bug 1623962 - ensure to close PIP window before removing its belonging tab r=jya

This patch will do :
- close PIP window before remove the tab which PIP window belongs to

The advantage of doing so :
- avoid hitting the error which was caused by closing PIP window too late

Differential Revision: https://phabricator.services.mozilla.com/D72987
This commit is contained in:
alwu 2020-04-29 01:21:13 +00:00
Родитель 74120a24bd
Коммит 0d9a2aef13
2 изменённых файлов: 4 добавлений и 2 удалений

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

@ -132,7 +132,7 @@ add_task(async function testPIPControllerIsAlwaysMainController() {
await isCurrentMetadataEqualTo(tab0.metadata);
info(`trigger Picture-in-Picture mode for tab0`);
await triggerPictureInPicture(tab0.linkedBrowser, testVideoId);
const winPIP = await triggerPictureInPicture(tab0.linkedBrowser, testVideoId);
info(`start media for tab1, main controller should still be tab0`);
await playMediaAndWaitUntilRegisteringController(tab1, testVideoId);
@ -141,6 +141,7 @@ add_task(async function testPIPControllerIsAlwaysMainController() {
await isCurrentMetadataEqualTo(tab0.metadata);
info(`remove tab0 and wait until main controller changes`);
await BrowserTestUtils.closeWindow(winPIP);
await Promise.all([
waitUntilMainMediaControllerChanged(),
BrowserTestUtils.removeTab(tab0),

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

@ -52,7 +52,7 @@ add_task(async function testNotToStopMediaControlForPIPVideo() {
await playMedia(tab, testVideoId);
info(`trigger PIP mode`);
await triggerPictureInPicture(tab.linkedBrowser, testVideoId);
const winPIP = await triggerPictureInPicture(tab.linkedBrowser, testVideoId);
info(`pause media and the stop timer would not stop media control`);
await pauseMedia(tab, testVideoId);
@ -62,6 +62,7 @@ add_task(async function testNotToStopMediaControlForPIPVideo() {
await checkOrWaitUntilMediaStartedPlaying(tab, testVideoId);
info(`remove tab`);
await BrowserTestUtils.closeWindow(winPIP);
await BrowserTestUtils.removeTab(tab);
});