diff --git a/devtools/client/framework/test/browser_toolbox_backward_forward_navigation.js b/devtools/client/framework/test/browser_toolbox_backward_forward_navigation.js index 87a18e338507..dad3d8ebe5d0 100644 --- a/devtools/client/framework/test/browser_toolbox_backward_forward_navigation.js +++ b/devtools/client/framework/test/browser_toolbox_backward_forward_navigation.js @@ -19,18 +19,34 @@ Services.scriptloader.loadSubScript( ); add_task(async function() { - // Start with a page without much activity so the toolbox gets initialized safely - const tab = await addTab(`data:text/html,`); + // Don't show the third panel to limit the logs and activity. + await pushPref("devtools.inspector.three-pane-enabled", false); + await pushPref("devtools.inspector.activeSidebar", "ruleview"); + const DATA_URL = `data:text/html,`; + const tab = await addTab(DATA_URL); // Select the debugger so there will be more activity const toolbox = await openToolboxForTab(tab, "jsdebugger"); const inspector = await toolbox.selectTool("inspector"); info("Navigate to the ORG test page"); - await navigateTo(TEST_URI_ORG); + // We don't use `navigateTo` as the page is adding stylesheets and js files which might + // delay the load event indefinitely (and we don't need for anything to be loaded, or + // ready, just to register the initial navigation so we can go back and forth between urls) + let onLocationChange = BrowserTestUtils.waitForLocationChange( + gBrowser, + TEST_URI_ORG + ); + BrowserTestUtils.loadURI(gBrowser, TEST_URI_ORG); + await onLocationChange; info("And then navigate to a different origin"); - await navigateTo(TEST_URI_COM); + onLocationChange = BrowserTestUtils.waitForLocationChange( + gBrowser, + TEST_URI_COM + ); + BrowserTestUtils.loadURI(gBrowser, TEST_URI_COM); + await onLocationChange; info( "Navigate backward and forward multiple times between the two origins, with different delays" @@ -40,12 +56,18 @@ add_task(async function() { // Navigate one last time to a document with less activity so we don't have to deal // with pending promises when we destroy the toolbox const onInspectorReloaded = inspector.once("reloaded"); + info("Navigate to final document"); await navigateTo(`${TEST_URI_ORG}?no-mutation`); + info("Waiting for inspector to reload…"); await onInspectorReloaded; + info("-> inspector reloaded"); await checkToolboxState(toolbox); }); add_task(async function() { + // Don't show the third panel to limit the logs and activity. + await pushPref("devtools.inspector.three-pane-enabled", false); + await pushPref("devtools.inspector.activeSidebar", "ruleview"); const DATA_URL = `data:text/html,`; const tab = await addTab(DATA_URL); @@ -65,8 +87,11 @@ add_task(async function() { // Navigate one last time to a document with less activity so we don't have to deal // with pending promises when we destroy the toolbox const onInspectorReloaded = inspector.once("reloaded"); + info("Navigate to final document"); await navigateTo(`${TEST_URI_ORG}?no-mutation`); + info("Waiting for inspector to reload…"); await onInspectorReloaded; + info("-> inspector reloaded"); await checkToolboxState(toolbox); });