summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/new/test/mochitest/browser_dbg-breaking-from-console.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/debugger/new/test/mochitest/browser_dbg-breaking-from-console.js')
-rw-r--r--devtools/client/debugger/new/test/mochitest/browser_dbg-breaking-from-console.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/devtools/client/debugger/new/test/mochitest/browser_dbg-breaking-from-console.js b/devtools/client/debugger/new/test/mochitest/browser_dbg-breaking-from-console.js
new file mode 100644
index 000000000..8005b518d
--- /dev/null
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-breaking-from-console.js
@@ -0,0 +1,31 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Tests that `debugger` statements are hit before the debugger even
+// initializes and it properly highlights the right location in the
+// debugger.
+
+add_task(function* () {
+ const url = EXAMPLE_URL + "doc-script-switching.html";
+ const toolbox = yield openNewTabAndToolbox(url, "webconsole");
+
+ // Type "debugger" into console
+ let jsterm = toolbox.getPanel("webconsole").hud.jsterm;
+ jsterm.execute("debugger");
+
+ // Wait for the debugger to be selected and make sure it's paused
+ yield new Promise((resolve) => {
+ toolbox.on("jsdebugger-selected", resolve);
+ });
+ is(toolbox.threadClient.state, "paused");
+
+ // Create a dbg context
+ const dbg = createDebuggerContext(toolbox);
+ const { selectors: { getSelectedSource }, getState } = dbg;
+
+ // Make sure the thread is paused in the right source and location
+ yield waitForDispatch(dbg, "LOAD_SOURCE_TEXT");
+ is(dbg.win.cm.getValue(), "debugger");
+ const source = getSelectedSource(getState()).toJS();
+ assertPausedLocation(dbg, source, 1);
+});