summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/browser_dbg-expressions-error.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /devtools/client/debugger/test/mochitest/browser_dbg-expressions-error.js
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/debugger/test/mochitest/browser_dbg-expressions-error.js')
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-expressions-error.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-expressions-error.js b/devtools/client/debugger/test/mochitest/browser_dbg-expressions-error.js
new file mode 100644
index 0000000000..39436a7d80
--- /dev/null
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-expressions-error.js
@@ -0,0 +1,57 @@
+/* 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/>. */
+
+/**
+ * test pausing on an errored watch expression
+ * assert that you can:
+ * 1. resume
+ * 2. still evalutate expressions
+ * 3. expand properties
+ */
+
+const EXPRESSION_SELECTORS = {
+ plusIcon: ".watch-expressions-pane button.plus",
+ input: "input.input-expression"
+};
+
+add_task(async function() {
+ const dbg = await initDebugger("doc-script-switching.html");
+
+ await togglePauseOnExceptions(dbg, true, true);
+
+ // add a good expression, 2 bad expressions, and another good one
+ log(`Adding location`);
+ await addExpression(dbg, "location");
+ await addExpression(dbg, "foo.bar");
+ await addExpression(dbg, "foo.batt");
+ await addExpression(dbg, "2");
+ // check the value of
+ is(getValue(dbg, 2), "(unavailable)");
+ is(getValue(dbg, 3), "(unavailable)");
+ is(getValue(dbg, 4), "2");
+
+ await toggleExpressionNode(dbg, 1);
+ is(findAllElements(dbg, "expressionNodes").length, 37);
+});
+
+function getLabel(dbg, index) {
+ return findElement(dbg, "expressionNode", index).innerText;
+}
+
+function getValue(dbg, index) {
+ return findElement(dbg, "expressionValue", index).innerText;
+}
+
+async function addExpression(dbg, input) {
+ const plusIcon = findElementWithSelector(dbg, EXPRESSION_SELECTORS.plusIcon);
+ if (plusIcon) {
+ plusIcon.click();
+ }
+
+ const evaluation = waitForDispatch(dbg, "EVALUATE_EXPRESSION");
+ findElementWithSelector(dbg, EXPRESSION_SELECTORS.input).focus();
+ type(dbg, input);
+ pressKey(dbg, "Enter");
+ await evaluation;
+}