Bug 1524223 - Fix flaky test browser_multiselect_tabs_move_to_new_window_contextmenu.js. r=jaws

Differential Revision: https://phabricator.services.mozilla.com/D18820

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Oriol Brufau 2019-02-07 04:01:15 +00:00
Родитель 334701dccd
Коммит 3a0fff40b3
1 изменённых файлов: 14 добавлений и 4 удалений

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

@ -68,11 +68,21 @@ add_task(async function testLazyTabs() {
ok(tabs[i].multiselected, `Tab ${i} should be multiselected`); ok(tabs[i].multiselected, `Tab ${i} should be multiselected`);
} }
let tabsMoved = new Promise(resolve => {
// Tab tabs in the new window will be about:blank before swapping the docshells.
// The "EndSwapDocShells" event is not dispatched for lazy tabs, so listen for
// "TabClose" instead and await a tick.
let i = 0;
window.addEventListener("TabClose", async function listener() {
await Promise.resolve();
if (++i == numTabs) {
window.removeEventListener("TabClose", listener);
resolve();
}
});
});
let newWindow = gBrowser.replaceTabsWithWindow(tabs[0]); let newWindow = gBrowser.replaceTabsWithWindow(tabs[0]);
await tabsMoved;
await TestUtils.waitForCondition(() => newWindow.gBrowser, `Wait for gBrowser`);
await TestUtils.waitForCondition(() => newWindow.gBrowser.visibleTabs.length == numTabs,
`Wait for all ${numTabs} tabs to get moved to the new window`);
tabs = newWindow.gBrowser.tabs; tabs = newWindow.gBrowser.tabs;
isnot(tabs[0].linkedPanel, "", `Tab 0 should continue not being lazy`); isnot(tabs[0].linkedPanel, "", `Tab 0 should continue not being lazy`);