зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1710582 - [devtools] Make refreshTab test helper wait for target switching. r=nchevobbe
navigateTo contains all the logic to wait for panel updates on reload, as well as wait for the process of the new target. Differential Revision: https://phabricator.services.mozilla.com/D114828
This commit is contained in:
Родитель
a4b5e6b006
Коммит
21aafa8249
|
@ -54,7 +54,7 @@ const DESCRIPTION = {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
|
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
|
||||||
const front = panel.panelWin.gStore.getState().front;
|
let front = panel.panelWin.gStore.getState().front;
|
||||||
|
|
||||||
const startWindows = await getWindowsInSnapshot(front);
|
const startWindows = await getWindowsInSnapshot(front);
|
||||||
dumpn(
|
dumpn(
|
||||||
|
@ -65,6 +65,9 @@ this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
|
||||||
|
|
||||||
await refreshTab();
|
await refreshTab();
|
||||||
|
|
||||||
|
// Update the front as we may have switched to a new target and a new memory front
|
||||||
|
front = panel.panelWin.gStore.getState().front;
|
||||||
|
|
||||||
const endWindows = await getWindowsInSnapshot(front);
|
const endWindows = await getWindowsInSnapshot(front);
|
||||||
is(endWindows.length, 1);
|
is(endWindows.length, 1);
|
||||||
|
|
||||||
|
|
|
@ -429,9 +429,16 @@ var removeTab = async function(tab) {
|
||||||
*/
|
*/
|
||||||
var refreshTab = async function(tab = gBrowser.selectedTab) {
|
var refreshTab = async function(tab = gBrowser.selectedTab) {
|
||||||
info("Refreshing tab.");
|
info("Refreshing tab.");
|
||||||
const finished = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
// Use navigateTo if there is a toolbox opened, and wait for panels to update after reload.
|
||||||
gBrowser.reloadTab(tab);
|
// Otherwise only wait for the tab's document to be loaded.
|
||||||
await finished;
|
const isKnownTab = TabDescriptorFactory.isKnownTab(tab);
|
||||||
|
if (isKnownTab) {
|
||||||
|
await navigateTo(tab.linkedBrowser.currentURI.spec);
|
||||||
|
} else {
|
||||||
|
const finished = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||||
|
gBrowser.reloadTab(tab);
|
||||||
|
await finished;
|
||||||
|
}
|
||||||
info("Tab finished refreshing.");
|
info("Tab finished refreshing.");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче