diff options
Diffstat (limited to 'devtools/startup/tests')
-rw-r--r-- | devtools/startup/tests/browser/browser_command_line_urls.js | 23 | ||||
-rw-r--r-- | devtools/startup/tests/browser/browser_shim_disable_devtools.js | 2 |
2 files changed, 16 insertions, 9 deletions
diff --git a/devtools/startup/tests/browser/browser_command_line_urls.js b/devtools/startup/tests/browser/browser_command_line_urls.js index 4494d635c6..af724faf2e 100644 --- a/devtools/startup/tests/browser/browser_command_line_urls.js +++ b/devtools/startup/tests/browser/browser_command_line_urls.js @@ -70,8 +70,9 @@ add_task(async function openingWithDevToolsButUnknownSource() { gBrowser, "data:text/html;charset=utf-8,<title>foo</title>" ); + gBrowser.selectedTab = tab; - const toolbox = await gDevTools.showToolboxForTab(gBrowser.selectedTab, { + const toolbox = await gDevTools.showToolboxForTab(tab, { toolId: "jsdebugger", }); @@ -102,7 +103,9 @@ add_task(async function openingWithDevToolsButUnknownSource() { * the url will be opened in the debugger. */ add_task(async function openingWithDevToolsAndKnownSource() { - const url = URL_ROOT + "command-line.js:5:2"; + const line = 5; + const column = 2; + const url = URL_ROOT + `command-line.js:${line}:${column}`; const tab = await BrowserTestUtils.openNewForegroundTab( gBrowser, @@ -116,22 +119,26 @@ add_task(async function openingWithDevToolsAndKnownSource() { sendUrlViaCommandLine(url); const dbg = toolbox.getPanel("jsdebugger"); + // Wait for the expected location to be selected and ignore any other default ones. const selectedLocation = await BrowserTestUtils.waitForCondition(() => { - return dbg._selectors.getSelectedLocation(dbg._getState()); + const location = dbg._selectors.getSelectedLocation(dbg._getState()); + return location?.line == line ? location : false; }); + is(selectedLocation.source.url, URL_ROOT + "command-line.js"); - is(selectedLocation.line, 5); - is(selectedLocation.column, 1); + is(selectedLocation.line, line); + is(selectedLocation.column, column - 1); info("Open another URL with only a line"); - const url2 = URL_ROOT + "command-line.js:6"; + const secondLine = 6; + const url2 = URL_ROOT + `command-line.js:${secondLine}`; sendUrlViaCommandLine(url2); const selectedLocation2 = await BrowserTestUtils.waitForCondition(() => { const location = dbg._selectors.getSelectedLocation(dbg._getState()); - return location.line == 6 ? location : false; + return location.line == secondLine ? location : false; }); is(selectedLocation2.source.url, URL_ROOT + "command-line.js"); - is(selectedLocation2.line, 6); + is(selectedLocation2.line, secondLine); is(selectedLocation2.column, 0); await toolbox.destroy(); diff --git a/devtools/startup/tests/browser/browser_shim_disable_devtools.js b/devtools/startup/tests/browser/browser_shim_disable_devtools.js index c3a4725a4b..a9c3903d78 100644 --- a/devtools/startup/tests/browser/browser_shim_disable_devtools.js +++ b/devtools/startup/tests/browser/browser_shim_disable_devtools.js @@ -134,7 +134,7 @@ add_task(async function () { info("Close the test window"); const winClosed = BrowserTestUtils.windowClosed(win); - win.BrowserTryToCloseWindow(); + win.BrowserCommands.tryToCloseWindow(); await winClosed; }); |