From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../mochitest/browser_dbg-tabs-without-urls.js | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 devtools/client/debugger/test/mochitest/browser_dbg-tabs-without-urls.js (limited to 'devtools/client/debugger/test/mochitest/browser_dbg-tabs-without-urls.js') diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-tabs-without-urls.js b/devtools/client/debugger/test/mochitest/browser_dbg-tabs-without-urls.js new file mode 100644 index 0000000000..f6e223a657 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg-tabs-without-urls.js @@ -0,0 +1,46 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + +// Test that URL-less sources have tabs added to the UI, are named correctly +// and do not persist upon reload + +"use strict"; + +add_task(async function () { + const dbg = await initDebugger( + "doc-scripts.html", + "simple1.js", + "simple2.js" + ); + + await selectSource(dbg, "simple1.js"); + is(countTabs(dbg), 1, "Only the `simple.js` source tab exists"); + + invokeInTab("doEval"); + await waitForPaused(dbg); + + is(countTabs(dbg), 2, "The new eval tab is now added"); + + info("Assert that the eval source the tab source name correctly"); + ok( + /source\d+/g.test(getTabContent(dbg, 0)), + "The tab name pattern is correct" + ); + + await resume(dbg); + + // Test reloading the debugger + await reload(dbg, "simple1.js", "simple2.js"); + is(countTabs(dbg), 1, "The eval source tab is no longer available"); +}); + +/* + * Get the tab content for the specific tab + * + * @param {Number} index - index of the tab to get the source content + */ +function getTabContent(dbg, index) { + const tabs = findElement(dbg, "sourceTabs").children; + return tabs[index]?.innerText || ""; +} -- cgit v1.2.3