diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /devtools/client/debugger/test/mochitest/browser_dbg-console-map-bindings.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/debugger/test/mochitest/browser_dbg-console-map-bindings.js')
-rw-r--r-- | devtools/client/debugger/test/mochitest/browser_dbg-console-map-bindings.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-console-map-bindings.js b/devtools/client/debugger/test/mochitest/browser_dbg-console-map-bindings.js new file mode 100644 index 0000000000..26529a75cd --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg-console-map-bindings.js @@ -0,0 +1,47 @@ +/* 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/>. */ + +"use strict"; + +add_task(async function () { + Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true); + const dbg = await initDebugger("doc-strict.html"); + + await getSplitConsole(dbg); + ok(dbg.toolbox.splitConsole, "Split console is shown."); + + invokeInTab("strict", 2); + + await waitForPaused(dbg); + await evaluate(dbg, "var c = 3"); + const msg2 = await evaluate(dbg, "c"); + + is(msg2.trim(), "3"); +}); + +// Return a promise with a reference to jsterm, opening the split +// console if necessary. This cleans up the split console pref so +// it won't pollute other tests. +function getSplitConsole(dbg) { + const { toolbox } = dbg; + + if (!toolbox.splitConsole) { + pressKey(dbg, "Escape"); + } + + return new Promise(resolve => { + toolbox.getPanelWhenReady("webconsole").then(() => { + ok(toolbox.splitConsole, "Split console is shown."); + const jsterm = toolbox.getPanel("webconsole").hud.jsterm; + resolve(jsterm); + }); + }); +} + +async function evaluate(dbg, expression) { + const { toolbox } = dbg; + const { hud } = toolbox.getPanel("webconsole"); + const msg = await evaluateExpressionInConsole(hud, expression); + return msg.innerText; +} |