summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-values.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-values.js
parentInitial commit. (diff)
downloadfirefox-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-javascript-tracer-values.js')
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-values.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-values.js b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-values.js
new file mode 100644
index 0000000000..92ff3c30a4
--- /dev/null
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer-values.js
@@ -0,0 +1,48 @@
+/* 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 tracing argument values
+
+"use strict";
+add_task(async function testTracingValues() {
+ await pushPref("devtools.debugger.features.javascript-tracing", true);
+
+ // Cover tracing function argument values
+ const jsCode = `function foo() { bar(1, ["array"], { attribute: 3 }, BigInt(4), Infinity, Symbol("6"), "7"); }; function bar(a, b, c) {}`;
+ const dbg = await initDebuggerWithAbsoluteURL(
+ "data:text/html," + encodeURIComponent(`<script>${jsCode}</script>`)
+ );
+
+ await openContextMenuInDebugger(dbg, "trace");
+ const toggled = waitForDispatch(
+ dbg.store,
+ "TOGGLE_JAVASCRIPT_TRACING_VALUES"
+ );
+ selectContextMenuItem(dbg, `#debugger-trace-menu-item-log-values`);
+ await toggled;
+ ok(true, "Toggled the log values setting");
+
+ await clickElement(dbg, "trace");
+
+ const topLevelThreadActorID =
+ dbg.toolbox.commands.targetCommand.targetFront.threadFront.actorID;
+ info("Wait for tracing to be enabled");
+ await waitForState(dbg, state => {
+ return dbg.selectors.getIsThreadCurrentlyTracing(topLevelThreadActorID);
+ });
+
+ invokeInTab("foo");
+
+ await hasConsoleMessage(dbg, "λ foo()");
+ await hasConsoleMessage(dbg, "λ bar");
+ const { value } = await findConsoleMessage(dbg, "λ bar");
+ is(
+ value,
+ `⟶ interpreter λ bar(1, \nArray [ "array" ]\n, \nObject { attribute: 3 }\n, 4n, Infinity, Symbol("6"), "7")`,
+ "The argument were printed for bar()"
+ );
+
+ // Reset the log values setting
+ Services.prefs.clearUserPref("devtools.debugger.javascript-tracing-values");
+});