/* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ "use strict"; /* import-globals-from helper-collapsibilities.js */ Services.scriptloader.loadSubScript( CHROME_URL_ROOT + "helper-collapsibilities.js", this ); /** * Test whether the focus transfers to a tab which is already inspected . */ add_task(async function () { info("Force all debug target panes to be expanded"); prepareCollapsibilitiesTest(); info( "Select 'performance' panel as the initial tool since the tool does not listen " + "any changes of the document without user action" ); await pushPref("devtools.toolbox.selectedTool", "performance"); const { document, tab, window } = await openAboutDebugging(); const { store } = window.AboutDebugging; await selectThisFirefoxPage(document, store); const inspectionTarget = "about:debugging"; info(`Open ${inspectionTarget} as inspection target`); await waitUntil(() => findDebugTargetByText(inspectionTarget, document)); info(`Inspect ${inspectionTarget} page in about:devtools-toolbox`); const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox( document, tab, window, inspectionTarget ); info( "Check the tab state after clicking inspect button " + "when another tab was selected" ); await updateSelectedTab(gBrowser, tab, store); clickInspectButton(inspectionTarget, document); const devtoolsURL = devtoolsWindow.location.href; assertDevtoolsToolboxTabState(devtoolsURL); info( "Check the tab state after clicking inspect button " + "when the toolbox tab is in another window" ); const newNavigator = gBrowser.replaceTabWithWindow(devtoolsTab); await waitUntil( () => newNavigator.gBrowser && newNavigator.gBrowser.selectedTab.linkedBrowser.contentWindow.location .href === devtoolsURL ); info( "Create a tab in the window and select the tab " + "so that the about:devtools-toolbox tab loses focus" ); const newTestTab = newNavigator.gBrowser.addTab( "data:text/html,