diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /devtools/client/debugger/test/mochitest/browser_dbg-content-script-sources.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/debugger/test/mochitest/browser_dbg-content-script-sources.js')
-rw-r--r-- | devtools/client/debugger/test/mochitest/browser_dbg-content-script-sources.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-content-script-sources.js b/devtools/client/debugger/test/mochitest/browser_dbg-content-script-sources.js new file mode 100644 index 0000000000..b95b08cbbb --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg-content-script-sources.js @@ -0,0 +1,52 @@ +/* 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 <http://mozilla.org/MPL/2.0/>. */ + +// Tests that the content scripts are listed in the source tree. + +"use strict"; + +add_task(async function () { + await pushPref("devtools.chrome.enabled", true); + const extension = await installAndStartContentScriptExtension(); + + let dbg = await initDebugger( + "doc-content-script-sources.html", + "content_script.js" + ); + await selectSource(dbg, "content_script.js"); + await closeTab(dbg, "content_script.js"); + + // Destroy the toolbox and repeat the test in a new toolbox + // and ensures that the content script is still listed. + await dbg.toolbox.destroy(); + + const toolbox = await openToolboxForTab(gBrowser.selectedTab, "jsdebugger"); + dbg = createDebuggerContext(toolbox); + await waitForSources(dbg, "content_script.js"); + await selectSource(dbg, "content_script.js"); + + await addBreakpoint(dbg, "content_script.js", 2); + + for (let i = 1; i < 3; i++) { + info(`Reloading tab (${i} time)`); + gBrowser.reloadTab(gBrowser.selectedTab); + await waitForPaused(dbg); + await waitForSelectedSource(dbg, "content_script.js"); + + await waitFor( + () => findElementWithSelector(dbg, ".sources-list .focused"), + "Source is focused" + ); + assertPausedAtSourceAndLine( + dbg, + findSource(dbg, "content_script.js").id, + 2 + ); + await resume(dbg); + } + + await closeTab(dbg, "content_script.js"); + + await extension.unload(); +}); |