Bug 1633624 - Clean up debugger mochitests r=jlast
authorDavid Walsh <dwalsh@mozilla.com>
Tue, 28 Apr 2020 15:18:30 +0000
changeset 526506 7e9d72b69b869daba591f6eddf8601b4a8636196
parent 526505 dd5820819c9ed0f53ea8c6f96a6d971e712aa6e8
child 526507 7d6135dac2f270fa13ec7cea498b3c245de62ecc
push id114308
push userdwalsh@mozilla.com
push dateTue, 28 Apr 2020 15:20:44 +0000
treeherderautoland@7e9d72b69b86 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlast
bugs1633624
milestone77.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1633624 - Clean up debugger mochitests r=jlast Differential Revision: https://phabricator.services.mozilla.com/D72785
devtools/client/debugger/test/mochitest/browser_dbg-asm.js
devtools/client/debugger/test/mochitest/browser_dbg-async-stepping.js
devtools/client/debugger/test/mochitest/browser_dbg-audiocontext.js
devtools/client/debugger/test/mochitest/browser_dbg-blackbox-all.js
devtools/client/debugger/test/mochitest/browser_dbg-blackbox-original.js
devtools/client/debugger/test/mochitest/browser_dbg-breaking-from-console.js
devtools/client/debugger/test/mochitest/browser_dbg-breakpoint-skipping.js
devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-actions.js
devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js
devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-cond-shortcut.js
devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-cond-source-maps.js
devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-cond.js
devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-duplicate-functions.js
devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-reloading.js
devtools/client/debugger/test/mochitest/browser_dbg-breakpoints.js
devtools/client/debugger/test/mochitest/browser_dbg-browser-content-toolbox.js
devtools/client/debugger/test/mochitest/browser_dbg-call-stack.js
devtools/client/debugger/test/mochitest/browser_dbg-chrome-create.js
devtools/client/debugger/test/mochitest/browser_dbg-chrome-debugging.js
devtools/client/debugger/test/mochitest/browser_dbg-console-async.js
devtools/client/debugger/test/mochitest/browser_dbg-console-eval.js
devtools/client/debugger/test/mochitest/browser_dbg-console-link.js
devtools/client/debugger/test/mochitest/browser_dbg-console-map-bindings.js
devtools/client/debugger/test/mochitest/browser_dbg-content-script-sources.js
devtools/client/debugger/test/mochitest/browser_dbg-continue-to-here-click.js
devtools/client/debugger/test/mochitest/browser_dbg-continue-to-here.js
devtools/client/debugger/test/mochitest/browser_dbg-debugger-buttons.js
devtools/client/debugger/test/mochitest/browser_dbg-editor-gutter.js
devtools/client/debugger/test/mochitest/browser_dbg-editor-mode.js
devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js
devtools/client/debugger/test/mochitest/browser_dbg-expressions-error.js
devtools/client/debugger/test/mochitest/browser_dbg-expressions-watch.js
devtools/client/debugger/test/mochitest/browser_dbg-expressions.js
devtools/client/debugger/test/mochitest/browser_dbg-go-to-line.js
devtools/client/debugger/test/mochitest/browser_dbg-iframes.js
devtools/client/debugger/test/mochitest/browser_dbg-inline-cache.js
devtools/client/debugger/test/mochitest/browser_dbg-inline-preview.js
devtools/client/debugger/test/mochitest/browser_dbg-keyboard-navigation.js
devtools/client/debugger/test/mochitest/browser_dbg-keyboard-shortcuts.js
devtools/client/debugger/test/mochitest/browser_dbg-layout-changes.js
devtools/client/debugger/test/mochitest/browser_dbg-merge-scopes.js
devtools/client/debugger/test/mochitest/browser_dbg-minified.js
devtools/client/debugger/test/mochitest/browser_dbg-navigation.js
devtools/client/debugger/test/mochitest/browser_dbg-old-breakpoint.js
devtools/client/debugger/test/mochitest/browser_dbg-outline-filter.js
devtools/client/debugger/test/mochitest/browser_dbg-outline-focus.js
devtools/client/debugger/test/mochitest/browser_dbg-outline-pretty.js
devtools/client/debugger/test/mochitest/browser_dbg-outline.js
devtools/client/debugger/test/mochitest/browser_dbg-pause-exceptions.js
devtools/client/debugger/test/mochitest/browser_dbg-pause-points.js
devtools/client/debugger/test/mochitest/browser_dbg-pause-ux.js
devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-console.js
devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-flow.js
devtools/client/debugger/test/mochitest/browser_dbg-pretty-print.js
devtools/client/debugger/test/mochitest/browser_dbg-preview-frame.js
devtools/client/debugger/test/mochitest/browser_dbg-preview-source-maps.js
devtools/client/debugger/test/mochitest/browser_dbg-preview.js
devtools/client/debugger/test/mochitest/browser_dbg-quick-open.js
devtools/client/debugger/test/mochitest/browser_dbg-react-jsx.js
devtools/client/debugger/test/mochitest/browser_dbg-reload.js
devtools/client/debugger/test/mochitest/browser_dbg-reloading.js
devtools/client/debugger/test/mochitest/browser_dbg-remember-expanded-scopes.js
devtools/client/debugger/test/mochitest/browser_dbg-returnvalues.js
devtools/client/debugger/test/mochitest/browser_dbg-scopes-duplicated.js
devtools/client/debugger/test/mochitest/browser_dbg-scopes-mutations.js
devtools/client/debugger/test/mochitest/browser_dbg-scopes-xrays.js
devtools/client/debugger/test/mochitest/browser_dbg-scopes.js
devtools/client/debugger/test/mochitest/browser_dbg-search-file-paused.js
devtools/client/debugger/test/mochitest/browser_dbg-search-file-retains-query.js
devtools/client/debugger/test/mochitest/browser_dbg-search-file.js
devtools/client/debugger/test/mochitest/browser_dbg-search-project.js
devtools/client/debugger/test/mochitest/browser_dbg-sourceURL-breakpoint.js
devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-breakpoint-console.js
devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-preview.js
devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-scopes.js
devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-stepping.js
devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-toggle.js
devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-disabled.js
devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-indexed.js
devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-reload.js
devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-reloading.js
devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js
devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps2.js
devtools/client/debugger/test/mochitest/browser_dbg-sources-arrow-keys.js
devtools/client/debugger/test/mochitest/browser_dbg-sources-named-eval.js
devtools/client/debugger/test/mochitest/browser_dbg-sources-querystring.js
devtools/client/debugger/test/mochitest/browser_dbg-state-based-panels.js
devtools/client/debugger/test/mochitest/browser_dbg-step-in-uninitialized.js
devtools/client/debugger/test/mochitest/browser_dbg-tabs-keyboard.js
devtools/client/debugger/test/mochitest/browser_dbg-tabs-pretty-print.js
devtools/client/debugger/test/mochitest/browser_dbg-tabs-without-urls-selected.js
devtools/client/debugger/test/mochitest/browser_dbg-tabs-without-urls.js
devtools/client/debugger/test/mochitest/browser_dbg-tabs.js
devtools/client/debugger/test/mochitest/browser_dbg-toggling-tools.js
devtools/client/debugger/test/mochitest/browser_dbg-watchpoints.js
devtools/client/debugger/test/mochitest/browser_dbg-windowless-service-workers.js
devtools/client/debugger/test/mochitest/browser_dbg-windowless-workers-early-breakpoint.js
devtools/client/debugger/test/mochitest/browser_dbg-windowless-workers.js
devtools/client/debugger/test/mochitest/browser_dbg-worker-scopes.js
devtools/client/debugger/test/mochitest/browser_dbg-xhr-breakpoints.js
devtools/client/debugger/test/mochitest/head.js
devtools/client/debugger/test/mochitest/helpers.js
--- a/devtools/client/debugger/test/mochitest/browser_dbg-asm.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-asm.js
@@ -1,8 +1,12 @@
+/* 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/>. */
+
 add_task(async function() {
   const dbg = await initDebugger("doc-asm.html");
   await reload(dbg);
 
   // After reload() we are getting getSources notifiction for old sources,
   // using the debugger statement to really stop are reloaded page.
   await waitForPaused(dbg);
   await resume(dbg);
--- a/devtools/client/debugger/test/mochitest/browser_dbg-async-stepping.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-async-stepping.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 async stepping will step over await statements
 add_task(async function test() {
   await pushPref("devtools.debugger.features.async-stepping", true);
   const dbg = await initDebugger("doc-async.html", "async");
 
   await selectSource(dbg, "async");
   await addBreakpoint(dbg, "async", 8);
--- a/devtools/client/debugger/test/mochitest/browser_dbg-audiocontext.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-audiocontext.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 the AudioContext are paused and resume appropriately when using the
 // debugger.
 
 add_task(async function() {
   const dbg = await initDebugger("doc-audiocontext.html");
 
   await invokeInTab("myFunction");
--- a/devtools/client/debugger/test/mochitest/browser_dbg-blackbox-all.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-blackbox-all.js
@@ -4,97 +4,97 @@
 
 // This test checks 'Blackbox' context menu in the Sources Panel.
 // Checks if submenu works correctly for options:
 // - 'Un/Blackbox files in this group'
 // - 'Un/Blackbox files outside this group'
 // - 'Un/Blackbox files in this directory'
 // - 'Un/Blackbox files outside this directory'
 
-const sourceFiles = {
+const SOURCE_FILES = {
   nestedSource: "nested-source.js",
   codeReload1: "code_reload_1.js",
 };
 
-const nodeSelectors = {
+const NODE_SELECTORS = {
   nodeBlackBoxAll: "#node-blackbox-all",
   nodeBlackBoxAllInside: "#node-blackbox-all-inside",
   nodeUnBlackBoxAllInside: "#node-unblackbox-all-inside",
   nodeBlackBoxAllOutside: "#node-blackbox-all-outside",
   nodeUnBlackBoxAllOutside: "#node-unblackbox-all-outside",
 };
 
-function waitForBlackboxCount(dbg, count) {
-  return waitForState(
-    dbg,
-    state => dbg.selectors.getBlackBoxList().length === count
-  );
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-blackbox-all.html");
 
   info("Loads the source file and sets a breakpoint at line 2.");
-  await waitForSources(dbg, sourceFiles.nestedSource, sourceFiles.codeReload1);
-  await selectSource(dbg, sourceFiles.nestedSource);
-  await addBreakpoint(dbg, sourceFiles.nestedSource, 2);
+  await waitForSources(dbg, SOURCE_FILES.nestedSource, SOURCE_FILES.codeReload1);
+  await selectSource(dbg, SOURCE_FILES.nestedSource);
+  await addBreakpoint(dbg, SOURCE_FILES.nestedSource, 2);
 
   info("Expands the whole source tree.");
   rightClickElement(dbg, "sourceTreeRootNode");
   selectContextMenuItem(dbg, "#node-menu-expand-all");
   await waitForAllElements(dbg, "sourceTreeFolderNode", 3);
 
   const sourceTreeFolderNodeEls = findAllElements(dbg, "sourceTreeFolderNode");
   const sourceTreeRootNodeEl = findElement(dbg, "sourceTreeRootNode");
 
   info("Blackbox files in this directory.");
   rightClickEl(dbg, sourceTreeFolderNodeEls[1]);
-  selectContextMenuItem(dbg, nodeSelectors.nodeBlackBoxAll);
-  await assertContextMenuLabel(dbg, nodeSelectors.nodeBlackBoxAllInside, "Blackbox files in this directory");
-  await assertContextMenuLabel(dbg, nodeSelectors.nodeBlackBoxAllOutside, "Blackbox files outside this directory");
-  selectContextMenuItem(dbg, nodeSelectors.nodeBlackBoxAllInside);
+  selectContextMenuItem(dbg, NODE_SELECTORS.nodeBlackBoxAll);
+  await assertContextMenuLabel(dbg, NODE_SELECTORS.nodeBlackBoxAllInside, "Blackbox files in this directory");
+  await assertContextMenuLabel(dbg, NODE_SELECTORS.nodeBlackBoxAllOutside, "Blackbox files outside this directory");
+  selectContextMenuItem(dbg, NODE_SELECTORS.nodeBlackBoxAllInside);
   await waitForBlackboxCount(dbg, 1);
   await waitForRequestsToSettle(dbg);
 
-  is(findSource(dbg, sourceFiles.nestedSource).isBlackBoxed, true, "nested-source.js is blackboxed");
-  is(findSource(dbg, sourceFiles.codeReload1).isBlackBoxed, false, "code_reload_1.js is not blackboxed");
+  is(findSource(dbg, SOURCE_FILES.nestedSource).isBlackBoxed, true, "nested-source.js is blackboxed");
+  is(findSource(dbg, SOURCE_FILES.codeReload1).isBlackBoxed, false, "code_reload_1.js is not blackboxed");
 
   info("The invoked function is blackboxed and the debugger does not pause.");
   invokeInTab("computeSomething");
   assertNotPaused(dbg);
 
   info("Unblackbox files outside this directory.");
   rightClickEl(dbg, sourceTreeFolderNodeEls[2]);
-  selectContextMenuItem(dbg, nodeSelectors.nodeBlackBoxAll);
-  await assertContextMenuLabel(dbg, nodeSelectors.nodeBlackBoxAllInside, "Blackbox files in this directory");
-  await assertContextMenuLabel(dbg, nodeSelectors.nodeUnBlackBoxAllOutside, "Unblackbox files outside this directory");
-  selectContextMenuItem(dbg, nodeSelectors.nodeUnBlackBoxAllOutside);
+  selectContextMenuItem(dbg, NODE_SELECTORS.nodeBlackBoxAll);
+  await assertContextMenuLabel(dbg, NODE_SELECTORS.nodeBlackBoxAllInside, "Blackbox files in this directory");
+  await assertContextMenuLabel(dbg, NODE_SELECTORS.nodeUnBlackBoxAllOutside, "Unblackbox files outside this directory");
+  selectContextMenuItem(dbg, NODE_SELECTORS.nodeUnBlackBoxAllOutside);
   await waitForBlackboxCount(dbg, 0);
   await waitForRequestsToSettle(dbg);
 
-  is(findSource(dbg, sourceFiles.nestedSource).isBlackBoxed, false, "nested-source.js is not blackboxed");
-  is(findSource(dbg, sourceFiles.codeReload1).isBlackBoxed, false, "code_reload_1.js is not blackboxed");
+  is(findSource(dbg, SOURCE_FILES.nestedSource).isBlackBoxed, false, "nested-source.js is not blackboxed");
+  is(findSource(dbg, SOURCE_FILES.codeReload1).isBlackBoxed, false, "code_reload_1.js is not blackboxed");
 
   info("All sources are unblackboxed and the debugger pauses on line 2.");
   invokeInTab("computeSomething");
   await waitForPaused(dbg);
   await resume(dbg);
 
   info("Blackbox files in this group.");
   rightClickEl(dbg, sourceTreeRootNodeEl);
-  await assertContextMenuLabel(dbg, nodeSelectors.nodeBlackBoxAllInside, "Blackbox files in this group");
-  selectContextMenuItem(dbg, nodeSelectors.nodeBlackBoxAllInside);
+  await assertContextMenuLabel(dbg, NODE_SELECTORS.nodeBlackBoxAllInside, "Blackbox files in this group");
+  selectContextMenuItem(dbg, NODE_SELECTORS.nodeBlackBoxAllInside);
   await waitForBlackboxCount(dbg, 2);
   await waitForRequestsToSettle(dbg);
 
-  is(findSource(dbg, sourceFiles.nestedSource).isBlackBoxed, true, "nested-source.js is blackboxed");
-  is(findSource(dbg, sourceFiles.codeReload1).isBlackBoxed, true, "code_reload_1.js is blackboxed");
+  is(findSource(dbg, SOURCE_FILES.nestedSource).isBlackBoxed, true, "nested-source.js is blackboxed");
+  is(findSource(dbg, SOURCE_FILES.codeReload1).isBlackBoxed, true, "code_reload_1.js is blackboxed");
  
   info("Unblackbox files in this group.");
   rightClickEl(dbg, sourceTreeRootNodeEl);
-  await assertContextMenuLabel(dbg, nodeSelectors.nodeUnBlackBoxAllInside, "Unblackbox files in this group");
-  selectContextMenuItem(dbg, nodeSelectors.nodeUnBlackBoxAllInside);
+  await assertContextMenuLabel(dbg, NODE_SELECTORS.nodeUnBlackBoxAllInside, "Unblackbox files in this group");
+  selectContextMenuItem(dbg, NODE_SELECTORS.nodeUnBlackBoxAllInside);
   await waitForBlackboxCount(dbg, 0);
   await waitForRequestsToSettle(dbg);
 
-  is(findSource(dbg, sourceFiles.nestedSource).isBlackBoxed, false, "nested-source.js is not blackboxed");
-  is(findSource(dbg, sourceFiles.codeReload1).isBlackBoxed, false, "code_reload_1.js is not blackboxed");
-});
\ No newline at end of file
+  is(findSource(dbg, SOURCE_FILES.nestedSource).isBlackBoxed, false, "nested-source.js is not blackboxed");
+  is(findSource(dbg, SOURCE_FILES.codeReload1).isBlackBoxed, false, "code_reload_1.js is not blackboxed");
+});
+
+function waitForBlackboxCount(dbg, count) {
+  return waitForState(
+    dbg,
+    state => dbg.selectors.getBlackBoxList().length === count
+  );
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-blackbox-original.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-blackbox-original.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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/>. */
 
 // This source map does not have source contents, so it's fetched separately
 add_task(async function() {
   // NOTE: the CORS call makes the test run times inconsistent
   const dbg = await initDebugger("doc-sourcemaps3.html");
   dbg.actions.toggleMapScopes();
 
   const {
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breaking-from-console.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breaking-from-console.js
@@ -1,19 +1,16 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 `debugger` statements are hit before the debugger even
 // initializes and it properly highlights the right location in the
 // debugger.
 
-async function waitOnToolbox(toolbox, event) {
-  return new Promise(resolve => toolbox.on(event, resolve));
-}
-
 add_task(async function() {
   const url = EXAMPLE_URL + "doc-script-switching.html";
   const toolbox = await openNewTabAndToolbox(url, "webconsole");
 
   // Type "debugger" into console
   let wrapper = toolbox.getPanel("webconsole").hud.ui.wrapper;
   wrapper.dispatchEvaluateExpression("debugger");
 
@@ -24,8 +21,12 @@ add_task(async function() {
   // Create a dbg context
   const dbg = createDebuggerContext(toolbox);
 
   // Make sure the thread is paused in the right source and location
   await waitForPaused(dbg);
   is(getCM(dbg).getValue(), "debugger");
   assertPausedLocation(dbg);
 });
+
+async function waitOnToolbox(toolbox, event) {
+  return new Promise(resolve => toolbox.on(event, resolve));
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoint-skipping.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoint-skipping.js
@@ -1,30 +1,12 @@
 /* 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/>. */
 
-function skipPausing(dbg) {
-  clickElementWithSelector(dbg, ".command-bar-skip-pausing");
-  return waitForState(dbg, state => dbg.selectors.getSkipPausing());
-}
-
-function toggleBreakpoint(dbg, index) {
-  const breakpoints = findAllElements(dbg, "breakpointItems");
-  const bp = breakpoints[index];
-  const input = bp.querySelector("input");
-  input.click();
-}
-
-async function disableBreakpoint(dbg, index) {
-  const disabled = waitForDispatch(dbg, "SET_BREAKPOINT");
-  toggleBreakpoint(dbg, index);
-  await disabled;
-}
-
 /*
  * Tests toggling the skip pausing button and
  * invoking functions without pausing.
  */
 
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html");
   await selectSource(dbg, "simple3");
@@ -78,8 +60,26 @@ add_task(async function() {
   invokeInTab("simple");
   await waitForPaused(dbg);
   // Unfortunately required as the test harness throws if preview doesn't
   // complete before the end of the test.
   await waitForDispatch(dbg, "ADD_INLINE_PREVIEW");
   resume(dbg);
   ok(true, "Breakpoint is hit after a breakpoint was removed");
 });
+
+function skipPausing(dbg) {
+  clickElementWithSelector(dbg, ".command-bar-skip-pausing");
+  return waitForState(dbg, state => dbg.selectors.getSkipPausing());
+}
+
+function toggleBreakpoint(dbg, index) {
+  const breakpoints = findAllElements(dbg, "breakpointItems");
+  const bp = breakpoints[index];
+  const input = bp.querySelector("input");
+  input.click();
+}
+
+async function disableBreakpoint(dbg, index) {
+  const disabled = waitForDispatch(dbg, "SET_BREAKPOINT");
+  toggleBreakpoint(dbg, index);
+  await disabled;
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-actions.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-actions.js
@@ -1,16 +1,12 @@
 /* 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/>. */
 
-function openFirstBreakpointContextMenu(dbg) {
-  rightClickElement(dbg, "breakpointItem", 2);
-}
-
 // Tests to see if we can trigger a breakpoint action via the context menu
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple2");
   await selectSource(dbg, "simple2");
   await waitForSelectedSource(dbg, "simple2");
 
   await addBreakpoint(dbg, "simple2", 3);
 
@@ -79,8 +75,12 @@ add_task(async function() {
     dbg,
     state =>
       dbg.selectors.getBreakpointsList().length === 1 &&
       dbg.selectors.getBreakpointsList()[0].location.line === 4
   );
   await dispatched;
   ok(true, "remaining breakpoint should be on line 4");
 });
+
+function openFirstBreakpointContextMenu(dbg) {
+  rightClickElement(dbg, "breakpointItem", 2);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js
@@ -1,12 +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/>. */
 
+add_task(async function() {
+  const dbg = await initDebugger("doc-scripts.html", "simple1");
+  await selectSource(dbg, "long");
+
+  info("1. Add a column breakpoint on line 32");
+  await enableFirstBreakpoint(dbg);
+
+  info("2. Click on the second breakpoint on line 32");
+  await enableSecondBreakpoint(dbg);
+
+  info("3. Disable second breakpoint using shift-click");
+  await shiftClickDisable(dbg);
+
+  info("4. Re-enable second breakpoint using shift-click");
+  await shiftClickEnable(dbg);
+
+  info("5. Add a condition to the first breakpoint");
+  await setConditionalBreakpoint(dbg, 0, "foo");
+
+  info("6. Add a log to the first breakpoint");
+  await setLogPoint(dbg, 0, "bar");
+
+  info("7. Disable the first breakpoint");
+  await disableBreakpoint(dbg, 0);
+
+  info("8. Remove the first breakpoint");
+  await removeFirstBreakpoint(dbg);
+
+  info("9. Add a condition to the second breakpoint");
+  await setConditionalBreakpoint(dbg, 1, "foo2");
+
+  info("10. Test removing the breakpoints by clicking in the gutter");
+  await removeAllBreakpoints(dbg, 32, 0);
+});
+
 async function enableFirstBreakpoint(dbg) {
   getCM(dbg).setCursor({ line: 32, ch: 0 });
   await addBreakpoint(dbg, "long", 32);
   const bpMarkers = await waitForAllElements(dbg, "columnBreakpoints");
 
   ok(bpMarkers.length === 2, "2 column breakpoints");
   assertClass(bpMarkers[0], "active");
   assertClass(bpMarkers[1], "active", false);
@@ -84,43 +119,8 @@ async function removeFirstBreakpoint(dbg
 }
 
 async function removeAllBreakpoints(dbg, line, count) {
   clickGutter(dbg, 32);
   await waitForBreakpointCount(dbg, 0);
 
   ok(findAllElements(dbg, "columnBreakpoints").length == 0);
 }
-
-add_task(async function() {
-  const dbg = await initDebugger("doc-scripts.html", "simple1");
-  await selectSource(dbg, "long");
-
-  info("1. Add a column breakpoint on line 32");
-  await enableFirstBreakpoint(dbg);
-
-  info("2. Click on the second breakpoint on line 32");
-  await enableSecondBreakpoint(dbg);
-
-  info("3. Disable second breakpoint using shift-click");
-  await shiftClickDisable(dbg);
-
-  info("4. Re-enable second breakpoint using shift-click");
-  await shiftClickEnable(dbg);
-
-  info("5. Add a condition to the first breakpoint");
-  await setConditionalBreakpoint(dbg, 0, "foo");
-
-  info("6. Add a log to the first breakpoint");
-  await setLogPoint(dbg, 0, "bar");
-
-  info("7. Disable the first breakpoint");
-  await disableBreakpoint(dbg, 0);
-
-  info("8. Remove the first breakpoint");
-  await removeFirstBreakpoint(dbg);
-
-  info("9. Add a condition to the second breakpoint");
-  await setConditionalBreakpoint(dbg, 1, "foo2");
-
-  info("10. Test removing the breakpoints by clicking in the gutter");
-  await removeAllBreakpoints(dbg, 32, 0);
-});
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-cond-shortcut.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-cond-shortcut.js
@@ -1,54 +1,15 @@
 /* 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 opening conditional panel using keyboard shortcut.
 // Should access the closest breakpoint to a passed in cursorPosition.
 
-// from test/mochitest/browser_dbg-breakpoints-cond-source-maps.js
-function getConditionalPanel(dbg, line) {
-  return getCM(dbg).doc.getLineHandle(line - 1).widgets[0];
-}
-
-// from devtools browser_dbg-breakpoints-cond-source-maps.js
-async function waitForConditionalPanelFocus(dbg) {
-  await waitFor(() => dbg.win.document.activeElement.tagName === "TEXTAREA");
-}
-
-// from browser_dbg-breakpoints-columns.js
-async function enableFirstBreakpoint(dbg) {
-  getCM(dbg).setCursor({ line: 32, ch: 0 });
-  await addBreakpoint(dbg, "long", 32);
-  const bpMarkers = await waitForAllElements(dbg, "columnBreakpoints");
-
-  ok(bpMarkers.length === 2, "2 column breakpoints");
-  assertClass(bpMarkers[0], "active");
-  assertClass(bpMarkers[1], "active", false);
-}
-
-async function enableSecondBreakpoint(dbg) {
-  let bpMarkers = await waitForAllElements(dbg, "columnBreakpoints");
-
-  bpMarkers[1].click();
-  await waitForBreakpointCount(dbg, 2);
-
-  bpMarkers = findAllElements(dbg, "columnBreakpoints");
-  assertClass(bpMarkers[1], "active");
-  await waitForAllElements(dbg, "breakpointItems", 2);
-}
-
-// modified method from browser_dbg-breakpoints-columns.js
-// use shortcut to open conditional panel.
-function setConditionalBreakpoint(dbg, condition) {
-  pressKey(dbg, "toggleCondPanel");
-  typeInPanel(dbg, condition);
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "long");
 
   let cursorPosition = { line: undefined, column: undefined };
 
   await selectSource(dbg, "long");
   await waitForSelectedSource(dbg, "long");
 
@@ -119,10 +80,48 @@ add_task(async function() {
   info("set cursor position near second breakpoint, toggle conditional panel and edit breakpoint");
   getCM(dbg).setCursor({ line: 31, ch: 21 });
   info("toggle conditional panel and edit condition using shortcut");
   setConditionalBreakpoint(dbg, "3");
   ok(
     !! waitForCondition(dbg, "13"),
     "breakpoint closest to cursor position has been edited"
   );
+});
 
-});
+// from test/mochitest/browser_dbg-breakpoints-cond-source-maps.js
+function getConditionalPanel(dbg, line) {
+  return getCM(dbg).doc.getLineHandle(line - 1).widgets[0];
+}
+
+// from devtools browser_dbg-breakpoints-cond-source-maps.js
+async function waitForConditionalPanelFocus(dbg) {
+  await waitFor(() => dbg.win.document.activeElement.tagName === "TEXTAREA");
+}
+
+// from browser_dbg-breakpoints-columns.js
+async function enableFirstBreakpoint(dbg) {
+  getCM(dbg).setCursor({ line: 32, ch: 0 });
+  await addBreakpoint(dbg, "long", 32);
+  const bpMarkers = await waitForAllElements(dbg, "columnBreakpoints");
+
+  ok(bpMarkers.length === 2, "2 column breakpoints");
+  assertClass(bpMarkers[0], "active");
+  assertClass(bpMarkers[1], "active", false);
+}
+
+async function enableSecondBreakpoint(dbg) {
+  let bpMarkers = await waitForAllElements(dbg, "columnBreakpoints");
+
+  bpMarkers[1].click();
+  await waitForBreakpointCount(dbg, 2);
+
+  bpMarkers = findAllElements(dbg, "columnBreakpoints");
+  assertClass(bpMarkers[1], "active");
+  await waitForAllElements(dbg, "breakpointItems", 2);
+}
+
+// modified method from browser_dbg-breakpoints-columns.js
+// use shortcut to open conditional panel.
+function setConditionalBreakpoint(dbg, condition) {
+  pressKey(dbg, "toggleCondPanel");
+  typeInPanel(dbg, condition);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-cond-source-maps.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-cond-source-maps.js
@@ -1,29 +1,12 @@
 /* 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/>. */
 
-async function setLogPoint(dbg, index) {
-  const gutterEl = await getEditorLineGutter(dbg, index);
-  rightClickEl(dbg, gutterEl);
-  selectContextMenuItem(
-    dbg,
-    `${selectors.addLogItem},${selectors.editLogItem}`
-  );
-}
-
-async function waitForConditionalPanelFocus(dbg) {
-  await waitFor(() => dbg.win.document.activeElement.tagName === "TEXTAREA");
-}
-
-function getConditionalPanel(dbg, line) {
-  return getCM(dbg).doc.getLineHandle(line - 1).widgets[0];
-}
-
 // Confirms that a conditional panel is opened at the
 // correct location in generated files.
 add_task(async function() {
   const dbg = await initDebugger("doc-sourcemaps.html", "entry.js");
 
   await selectSource(dbg, "bundle.js");
   getCM(dbg).scrollIntoView({ line: 55, ch: 0 });
 
@@ -34,8 +17,25 @@ add_task(async function() {
     "conditional panel panel is open on line 55"
   );
   is(
     dbg.selectors.getConditionalPanelLocation().line,
     55,
     "conditional panel location is line 55"
   );
 });
+
+async function setLogPoint(dbg, index) {
+  const gutterEl = await getEditorLineGutter(dbg, index);
+  rightClickEl(dbg, gutterEl);
+  selectContextMenuItem(
+    dbg,
+    `${selectors.addLogItem},${selectors.editLogItem}`
+  );
+}
+
+async function waitForConditionalPanelFocus(dbg) {
+  await waitFor(() => dbg.win.document.activeElement.tagName === "TEXTAREA");
+}
+
+function getConditionalPanel(dbg, line) {
+  return getCM(dbg).doc.getLineHandle(line - 1).widgets[0];
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-cond.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-cond.js
@@ -1,70 +1,12 @@
 /* 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/>. */
 
-function getLineEl(dbg, line) {
-  const lines = dbg.win.document.querySelectorAll(".CodeMirror-code > div");
-  return lines[line - 1];
-}
-
-function assertEditorBreakpoint(
-  dbg,
-  line,
-  { hasCondition = false, hasLog = false } = {}
-) {
-  const hasConditionClass = getLineEl(dbg, line).classList.contains(
-    "has-condition"
-  );
-
-  ok(
-    hasConditionClass === hasCondition,
-    `Breakpoint condition ${
-      hasCondition ? "exists" : "does not exist"
-    } on line ${line}`
-  );
-
-  const hasLogClass = getLineEl(dbg, line).classList.contains("has-log");
-
-  ok(
-    hasLogClass === hasLog,
-    `Breakpoint log ${hasLog ? "exists" : "does not exist"} on line ${line}`
-  );
-}
-
-function waitForBreakpointWithoutCondition(dbg, url, line) {
-  return waitForState(dbg, () => {
-    const bp = findBreakpoint(dbg, url, line);
-    return bp && !bp.options.condition;
-  });
-}
-
-async function setConditionalBreakpoint(dbg, index, condition) {
-  // Make this work with either add or edit menu items
-  const { addConditionItem, editConditionItem } = selectors;
-  const selector = `${addConditionItem},${editConditionItem}`;
-  rightClickElement(dbg, "gutter", index);
-  selectContextMenuItem(dbg, selector);
-  typeInPanel(dbg, condition);
-}
-
-async function setLogPoint(dbg, index, value) {
-  rightClickElement(dbg, "gutter", index);
-  selectContextMenuItem(
-    dbg,
-    `${selectors.addLogItem},${selectors.editLogItem}`
-  );
-  await typeInPanel(dbg, value);
-}
-
-async function waitForConditionalPanelFocus(dbg) {
-  await waitFor(() => dbg.win.document.activeElement.tagName === "TEXTAREA");
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple2");
   await pushPref("devtools.debugger.features.column-breakpoints", true);
 
   await selectSource(dbg, "simple2");
   await waitForSelectedSource(dbg, "simple2");
 
   info("Set condition `1`");
@@ -162,8 +104,66 @@ add_task(async function() {
     "The textarea of logpoint panel is focused"
   );
 
   info("Click the logpoint in secondary pane");
   await clickElement(dbg, "logPointInSecPane");
   const logPointPanel = findElement(dbg, "logPointPanel");
   is(logPointPanel, null, "The logpoint panel is closed");
 });
+
+function getLineEl(dbg, line) {
+  const lines = dbg.win.document.querySelectorAll(".CodeMirror-code > div");
+  return lines[line - 1];
+}
+
+function assertEditorBreakpoint(
+  dbg,
+  line,
+  { hasCondition = false, hasLog = false } = {}
+) {
+  const hasConditionClass = getLineEl(dbg, line).classList.contains(
+    "has-condition"
+  );
+
+  ok(
+    hasConditionClass === hasCondition,
+    `Breakpoint condition ${
+      hasCondition ? "exists" : "does not exist"
+    } on line ${line}`
+  );
+
+  const hasLogClass = getLineEl(dbg, line).classList.contains("has-log");
+
+  ok(
+    hasLogClass === hasLog,
+    `Breakpoint log ${hasLog ? "exists" : "does not exist"} on line ${line}`
+  );
+}
+
+function waitForBreakpointWithoutCondition(dbg, url, line) {
+  return waitForState(dbg, () => {
+    const bp = findBreakpoint(dbg, url, line);
+    return bp && !bp.options.condition;
+  });
+}
+
+async function setConditionalBreakpoint(dbg, index, condition) {
+  // Make this work with either add or edit menu items
+  const { addConditionItem, editConditionItem } = selectors;
+  const selector = `${addConditionItem},${editConditionItem}`;
+  rightClickElement(dbg, "gutter", index);
+  selectContextMenuItem(dbg, selector);
+  typeInPanel(dbg, condition);
+}
+
+async function setLogPoint(dbg, index, value) {
+  rightClickElement(dbg, "gutter", index);
+  selectContextMenuItem(
+    dbg,
+    `${selectors.addLogItem},${selectors.editLogItem}`
+  );
+  await typeInPanel(dbg, value);
+}
+
+async function waitForConditionalPanelFocus(dbg) {
+  await waitFor(() => dbg.win.document.activeElement.tagName === "TEXTAREA");
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-duplicate-functions.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-duplicate-functions.js
@@ -1,24 +1,22 @@
 /* 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/>. */
 
-function firstBreakpoint(dbg) {
-  return dbg.selectors.getBreakpointsList()[0];
-}
-
 // tests to make sure we do not accidentally slide the breakpoint up to the first
 // function with the same name in the file.
 add_task(async function() {
   const dbg = await initDebugger(
     "doc-duplicate-functions.html",
     "doc-duplicate-functions"
   );
   const source = findSource(dbg, "doc-duplicate-functions");
 
   await selectSource(dbg, source.url);
   await addBreakpoint(dbg, source.url, 19);
 
   await reload(dbg, source.url);
   await waitForState(dbg, state => dbg.selectors.getBreakpointCount() == 1);
-  is(firstBreakpoint(dbg).location.line, 19, "Breakpoint is on line 19");
+
+  const firstBreakpoint = dbg.selectors.getBreakpointsList()[0];
+  is(firstBreakpoint.location.line, 19, "Breakpoint is on line 19");
 });
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-reloading.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-reloading.js
@@ -1,38 +1,15 @@
 /* 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 pending breakpoints when reloading
 requestLongerTimeout(3);
 
-// Utilities for interacting with the editor
-function clickGutter(dbg, line) {
-  clickElement(dbg, "gutter", line);
-}
-
-function getLineEl(dbg, line) {
-  const lines = dbg.win.document.querySelectorAll(".CodeMirror-code > div");
-  return lines[line - 1];
-}
-
-function addBreakpointViaGutter(dbg, line) {
-  clickGutter(dbg, line);
-  return waitForDispatch(dbg, "SET_BREAKPOINT");
-}
-
-async function assertEditorBreakpoint(dbg, line) {
-  await waitUntil(() => {
-    const lineEl = getLineEl(dbg, line);
-    return lineEl.classList.contains("new-breakpoint");
-  });
-  ok(true, `Breakpoint exists on line ${line}`);
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple1.js");
   const source = findSource(dbg, "simple1.js");
 
   await selectSource(dbg, source.url);
   await addBreakpointViaGutter(dbg, 5);
   await addBreakpointViaGutter(dbg, 4);
 
@@ -65,8 +42,31 @@ add_task(async function() {
   // The second breakpoint we added is in a later inline script, and won't
   // appear until after we have resumed from the first breakpoint and the
   // second inline script has been created.
   await resume(dbg);
   await waitForPaused(dbg);
   assertPausedAtSourceAndLine(dbg, source.id, 27);
   await assertEditorBreakpoint(dbg, 27);
 });
+
+// Utilities for interacting with the editor
+function clickGutter(dbg, line) {
+  clickElement(dbg, "gutter", line);
+}
+
+function getLineEl(dbg, line) {
+  const lines = dbg.win.document.querySelectorAll(".CodeMirror-code > div");
+  return lines[line - 1];
+}
+
+function addBreakpointViaGutter(dbg, line) {
+  clickGutter(dbg, line);
+  return waitForDispatch(dbg, "SET_BREAKPOINT");
+}
+
+async function assertEditorBreakpoint(dbg, line) {
+  await waitUntil(() => {
+    const lineEl = getLineEl(dbg, line);
+    return lineEl.classList.contains("new-breakpoint");
+  });
+  ok(true, `Breakpoint exists on line ${line}`);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints.js
@@ -1,37 +1,12 @@
 /* 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/>. */
 
-function toggleBreakpoint(dbg, index) {
-  const bp = findAllElements(dbg, "breakpointItems")[index];
-  const input = bp.querySelector("input");
-  input.click();
-}
-
-async function disableBreakpoint(dbg, index) {
-  const disabled = waitForDispatch(dbg, "SET_BREAKPOINT");
-  toggleBreakpoint(dbg, index);
-  await disabled;
-}
-
-async function enableBreakpoint(dbg, index) {
-  const enabled = waitForDispatch(dbg, "SET_BREAKPOINT");
-  toggleBreakpoint(dbg, index);
-  await enabled;
-}
-
-async function cleanupBreakpoints(dbg) {
-  clickElement(dbg, "gutter", 3);
-  clickElement(dbg, "gutter", 5);
-  await waitForBreakpointRemoved(dbg, "simple2", 3);
-  await waitForBreakpointRemoved(dbg, "simple2", 5);
-}
-
 // Test enabling and disabling a breakpoint using the check boxes
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple2");
 
   // Create two breakpoints
   await selectSource(dbg, "simple2");
   await addBreakpoint(dbg, "simple2", 3);
   await addBreakpoint(dbg, "simple2", 5);
@@ -88,8 +63,33 @@ add_task(async function() {
   await waitForBreakpoint(dbg, "simple2", 3);
 
   const bp = findBreakpoint(dbg, "simple2", 3);
   is(bp.disabled, true, "breakpoint is disabled");
 
   // Cleanup
   await cleanupBreakpoints(dbg);
 });
+
+function toggleBreakpoint(dbg, index) {
+  const bp = findAllElements(dbg, "breakpointItems")[index];
+  const input = bp.querySelector("input");
+  input.click();
+}
+
+async function disableBreakpoint(dbg, index) {
+  const disabled = waitForDispatch(dbg, "SET_BREAKPOINT");
+  toggleBreakpoint(dbg, index);
+  await disabled;
+}
+
+async function enableBreakpoint(dbg, index) {
+  const enabled = waitForDispatch(dbg, "SET_BREAKPOINT");
+  toggleBreakpoint(dbg, index);
+  await enabled;
+}
+
+async function cleanupBreakpoints(dbg) {
+  clickElement(dbg, "gutter", 3);
+  clickElement(dbg, "gutter", 5);
+  await waitForBreakpointRemoved(dbg, "simple2", 3);
+  await waitForBreakpointRemoved(dbg, "simple2", 5);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-browser-content-toolbox.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-browser-content-toolbox.js
@@ -1,39 +1,22 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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";
 
 /**
  * Tests that the debugger is succesfully loaded in the Browser Content Toolbox.
  */
 
 const {
   gDevToolsBrowser
 } = require("devtools/client/framework/devtools-browser");
 
-function toggleBreakpoint(dbg, index) {
-  const bp = findAllElements(dbg, "breakpointItems")[index];
-  const input = bp.querySelector("input");
-  input.click();
-}
-
-async function disableBreakpoint(dbg, index) {
-  const disabled = waitForDispatch(dbg, "SET_BREAKPOINT");
-  toggleBreakpoint(dbg, index);
-  await disabled;
-}
-
-async function enableBreakpoint(dbg, index) {
-  const enabled = waitForDispatch(dbg, "SET_BREAKPOINT");
-  toggleBreakpoint(dbg, index);
-  await enabled;
-}
-
 add_task(async function() {
   clearDebuggerPreferences();
 
   info("Open a tab pointing to doc-scripts.html");
   await addTab(EXAMPLE_URL + "doc-scripts.html");
 
   info("Open the Browser Content Toolbox");
   let toolbox = await gDevToolsBrowser.openContentProcessToolbox(gBrowser);
@@ -60,8 +43,26 @@ add_task(async function() {
 
   info("Close the browser toolbox window");
   let onToolboxDestroyed = toolbox.once("destroyed");
   toolbox.win.top.close();
   await onToolboxDestroyed;
 
   info("Toolbox is destroyed");
 });
+
+function toggleBreakpoint(dbg, index) {
+  const bp = findAllElements(dbg, "breakpointItems")[index];
+  const input = bp.querySelector("input");
+  input.click();
+}
+
+async function disableBreakpoint(dbg, index) {
+  const disabled = waitForDispatch(dbg, "SET_BREAKPOINT");
+  toggleBreakpoint(dbg, index);
+  await disabled;
+}
+
+async function enableBreakpoint(dbg, index) {
+  const enabled = waitForDispatch(dbg, "SET_BREAKPOINT");
+  toggleBreakpoint(dbg, index);
+  await enabled;
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-call-stack.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-call-stack.js
@@ -1,75 +1,15 @@
 /* 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/>. */
 
 // Ignore strange errors when shutting down.
 PromiseTestUtils.whitelistRejectionsGlobally(/No such actor/);
 
-// checks to see if the frame is selected and the title is correct
-function isFrameSelected(dbg, index, title) {
-  const $frame = findElement(dbg, "frame", index);
-
-  const {
-    selectors: { getSelectedFrame, getCurrentThread },
-    getState,
-  } = dbg;
-
-  const frame = getSelectedFrame(getCurrentThread());
-
-  const elSelected = $frame.classList.contains("selected");
-  const titleSelected = frame.displayName == title;
-
-  return elSelected && titleSelected;
-}
-
-function toggleButton(dbg) {
-  const callStackBody = findElement(dbg, "callStackBody");
-  return callStackBody.querySelector(".show-more");
-}
-
-// Create an HTTP server to simulate an angular app with anonymous functions
-// and return the URL.
-function createMockAngularPage() {
-  const httpServer = createTestHTTPServer();
-
-  httpServer.registerContentType("html", "text/html");
-  httpServer.registerContentType("js", "application/javascript");
-
-  const htmlFilename = "angular-mock.html";
-  httpServer.registerPathHandler(`/${htmlFilename}`, function(
-    request,
-    response
-  ) {
-    response.setStatusLine(request.httpVersion, 200, "OK");
-    response.write(`
-        <html>
-            <button class="pause">Click me</button>
-            <script type="text/javascript" src="angular.js"></script>
-        </html>`);
-  });
-
-  // Register an angular.js file in order to create a Group with anonymous functions in
-  // the callstack panel.
-  httpServer.registerPathHandler("/angular.js", function(request, response) {
-    response.setHeader("Content-Type", "application/javascript");
-    response.write(`
-      document.querySelector("button.pause").addEventListener("click", () => {
-        (function() {
-          debugger;
-        })();
-      })
-    `);
-  });
-
-  const port = httpServer.identity.primaryPort;
-  return `http://localhost:${port}/${htmlFilename}`;
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-script-switching.html");
 
   const found = findElement(dbg, "callStackBody");
   is(found, null, "Call stack is hidden");
 
   invokeInTab("firstCall");
   await waitForPaused(dbg);
@@ -123,8 +63,68 @@ add_task(async function() {
     "Group has expected badge"
   );
   is(
     $group.querySelector(".group-description-name").textContent,
     "Angular",
     "Group has expected location"
   );
 });
+
+// checks to see if the frame is selected and the title is correct
+function isFrameSelected(dbg, index, title) {
+  const $frame = findElement(dbg, "frame", index);
+
+  const {
+    selectors: { getSelectedFrame, getCurrentThread },
+    getState,
+  } = dbg;
+
+  const frame = getSelectedFrame(getCurrentThread());
+
+  const elSelected = $frame.classList.contains("selected");
+  const titleSelected = frame.displayName == title;
+
+  return elSelected && titleSelected;
+}
+
+function toggleButton(dbg) {
+  const callStackBody = findElement(dbg, "callStackBody");
+  return callStackBody.querySelector(".show-more");
+}
+
+// Create an HTTP server to simulate an angular app with anonymous functions
+// and return the URL.
+function createMockAngularPage() {
+  const httpServer = createTestHTTPServer();
+
+  httpServer.registerContentType("html", "text/html");
+  httpServer.registerContentType("js", "application/javascript");
+
+  const htmlFilename = "angular-mock.html";
+  httpServer.registerPathHandler(`/${htmlFilename}`, function(
+    request,
+    response
+  ) {
+    response.setStatusLine(request.httpVersion, 200, "OK");
+    response.write(`
+        <html>
+            <button class="pause">Click me</button>
+            <script type="text/javascript" src="angular.js"></script>
+        </html>`);
+  });
+
+  // Register an angular.js file in order to create a Group with anonymous functions in
+  // the callstack panel.
+  httpServer.registerPathHandler("/angular.js", function(request, response) {
+    response.setHeader("Content-Type", "application/javascript");
+    response.write(`
+      document.querySelector("button.pause").addEventListener("click", () => {
+        (function() {
+          debugger;
+        })();
+      })
+    `);
+  });
+
+  const port = httpServer.identity.primaryPort;
+  return `http://localhost:${port}/${htmlFilename}`;
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-chrome-create.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-chrome-create.js
@@ -1,53 +1,27 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 a chrome debugger can be created in a new process.
  */
 
 // There are shutdown issues for which multiple rejections are left uncaught.
 // See bug 1018184 for resolving these issues.
 PromiseTestUtils.whitelistRejectionsGlobally(/File closed/);
 PromiseTestUtils.whitelistRejectionsGlobally(/NS_ERROR_FAILURE/);
 
 requestLongerTimeout(5);
 
 const { BrowserToolboxLauncher } = ChromeUtils.import("resource://devtools/client/framework/browser-toolbox/Launcher.jsm");
 let gProcess = undefined;
 
-function initChromeDebugger() {
-  info("Initializing a chrome debugger process.");
-  return new Promise(resolve => {
-    BrowserToolboxLauncher.init(onClose, _process => {
-      info("Browser toolbox process started successfully.");
-      resolve(_process);
-    });
-  });
-}
-
-function onClose() {
-  is(
-    gProcess._dbgProcess.exitCode,
-    Services.appinfo.OS == "WINNT" ? -9 : -15,
-    "The remote debugger process didn't die cleanly."
-  );
-
-  info("process exit value: " + gProcess._dbgProcess.exitCode);
-
-  info("profile path: " + gProcess._dbgProfilePath);
-
-  finish();
-}
-
-registerCleanupFunction(function() {
-  gProcess = null;
-});
-
 add_task(async function() {
   // Windows XP and 8.1 test slaves are terribly slow at this test.
   await pushPref("devtools.chrome.enabled", true);
   await pushPref("devtools.debugger.remote-enabled", true);
 
   gProcess = await initChromeDebugger();
 
   ok(
@@ -79,8 +53,36 @@ add_task(async function() {
     OS.Path.join(OS.Constants.Path.profileDir, "chrome_debugger_profile"),
     "The remote debugger profile isn't where we expect it!"
   );
 
   info("profile path: " + gProcess._dbgProfilePath);
 
   await gProcess.close();
 });
+
+function initChromeDebugger() {
+  info("Initializing a chrome debugger process.");
+  return new Promise(resolve => {
+    BrowserToolboxLauncher.init(onClose, _process => {
+      info("Browser toolbox process started successfully.");
+      resolve(_process);
+    });
+  });
+}
+
+function onClose() {
+  is(
+    gProcess._dbgProcess.exitCode,
+    Services.appinfo.OS == "WINNT" ? -9 : -15,
+    "The remote debugger process didn't die cleanly."
+  );
+
+  info("process exit value: " + gProcess._dbgProcess.exitCode);
+
+  info("profile path: " + gProcess._dbgProfilePath);
+
+  finish();
+}
+
+registerCleanupFunction(function() {
+  gProcess = null;
+});
--- a/devtools/client/debugger/test/mochitest/browser_dbg-chrome-debugging.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-chrome-debugging.js
@@ -1,24 +1,53 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 chrome debugging works.
  */
 
-var gClient, gThreadFront;
-var gNewChromeSource = promise.defer();
+let gClient, gThreadFront;
+let gNewChromeSource = promise.defer();
 
-var { DevToolsLoader } = ChromeUtils.import("resource://devtools/shared/Loader.jsm");
-var customLoader = new DevToolsLoader({
+let { DevToolsLoader } = ChromeUtils.import("resource://devtools/shared/Loader.jsm");
+let customLoader = new DevToolsLoader({
   invisibleToDebugger: true,
 });
-var { DevToolsServer } = customLoader.require("devtools/server/devtools-server");
-var { DevToolsClient } = require("devtools/client/devtools-client");
+let { DevToolsServer } = customLoader.require("devtools/server/devtools-server");
+let { DevToolsClient } = require("devtools/client/devtools-client");
+
+add_task(async function() {
+  gClient = initDevToolsClient();
+
+  const [type] = await gClient.connect();
+  is(type, "browser", "Root actor should identify itself as a browser.");
+
+  const descriptorFront = await gClient.mainRoot.getMainProcess();
+  const front = await descriptorFront.getTarget();
+  await front.attach();
+  const threadFront = await front.attachThread();
+  gThreadFront = threadFront;
+  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:mozilla");
+
+  // listen for a new source and global
+  gThreadFront.on("newSource", onNewSource);
+
+  // Force the creation of a new privileged source
+  const systemPrincipal = Cc["@mozilla.org/systemprincipal;1"].createInstance(
+      Ci.nsIPrincipal
+    );
+  const sandbox = Cu.Sandbox(systemPrincipal);
+  Cu.evalInSandbox("function foo() {}", sandbox, null, "http://foo.com");
+
+  await gNewChromeSource.promise;
+
+  await resumeAndCloseConnection();
+});
 
 function initDevToolsClient() {
   DevToolsServer.init();
   DevToolsServer.registerAllActors();
   DevToolsServer.allowChromeProcess = true;
 
   let transport = DevToolsServer.connectPipe();
   return new DevToolsClient(transport);
@@ -40,36 +69,8 @@ async function resumeAndCloseConnection(
 registerCleanupFunction(function() {
   gClient = null;
   gThreadFront = null;
   gNewChromeSource = null;
 
   customLoader = null;
   DevToolsServer = null;
 });
-
-add_task(async function() {
-  gClient = initDevToolsClient();
-
-  const [type] = await gClient.connect();
-  is(type, "browser", "Root actor should identify itself as a browser.");
-
-  const descriptorFront = await gClient.mainRoot.getMainProcess();
-  const front = await descriptorFront.getTarget();
-  await front.attach();
-  const threadFront = await front.attachThread();
-  gThreadFront = threadFront;
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:mozilla");
-
-  // listen for a new source and global
-  gThreadFront.on("newSource", onNewSource);
-
-  // Force the creation of a new privileged source
-  const systemPrincipal = Cc["@mozilla.org/systemprincipal;1"].createInstance(
-      Ci.nsIPrincipal
-    );
-  const sandbox = Cu.Sandbox(systemPrincipal);
-  Cu.evalInSandbox("function foo() {}", sandbox, null, "http://foo.com");
-
-  await gNewChromeSource.promise;
-
-  await resumeAndCloseConnection();
-});
--- a/devtools/client/debugger/test/mochitest/browser_dbg-console-async.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-console-async.js
@@ -1,26 +1,12 @@
 // 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 findMessages(win, query) {
-  return Array.prototype.filter.call(
-    win.document.querySelectorAll(".message"),
-    e => e.innerText.includes(query)
-  );
-}
-
-async function hasMessage(dbg, msg) {
-  const webConsole = await dbg.toolbox.getPanel("webconsole");
-  return waitFor(
-    async () => findMessages(webConsole._frameWindow, msg).length > 0
-  );
-}
-
 add_task(async function() {
   Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
   Services.prefs.setBoolPref(
     "devtools.debugger.features.map-await-expression",
     true
   );
 
   const dbg = await initDebugger("doc-script-switching.html", "switching-01");
@@ -40,8 +26,22 @@ add_task(async function() {
     )
   `);
 
   await hasMessage(dbg, "sleep");
 
   wrapper.dispatchEvaluateExpression(`await sleep(200, "DONE")`);
   await hasMessage(dbg, "DONE!!!");
 });
+
+function findMessages(win, query) {
+  return Array.prototype.filter.call(
+    win.document.querySelectorAll(".message"),
+    e => e.innerText.includes(query)
+  );
+}
+
+async function hasMessage(dbg, msg) {
+  const webConsole = await dbg.toolbox.getPanel("webconsole");
+  return waitFor(
+    async () => findMessages(webConsole._frameWindow, msg).length > 0
+  );
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-console-eval.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-console-eval.js
@@ -1,34 +1,34 @@
 /* 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 clicking the DOM node button in any ObjectInspect
 // opens the Inspector panel
 
-function waitForConsolePanelChange(dbg) {
-  const { toolbox } = dbg;
-
-  return new Promise(resolve => {
-    toolbox.getPanelWhenReady("webconsole").then(() => {
-      ok(toolbox.webconsolePanel, "Console is shown.");
-      resolve(toolbox.webconsolePanel);
-    });
-  });
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple2");
 
   await selectSource(dbg, "simple2", 1);
 
   clickElement(dbg, "CodeMirrorLines");
   await waitForElementWithSelector(dbg, ".CodeMirror-code");
 
   getCM(dbg).setSelection({ line: 0, ch: 0 }, { line: 8, ch: 0 });
 
   rightClickElement(dbg, "CodeMirrorLines");
   selectContextMenuItem(dbg, "#node-menu-evaluate-in-console");
 
   await waitForConsolePanelChange(dbg);
   await hasConsoleMessage(dbg, "undefined");
 });
+
+function waitForConsolePanelChange(dbg) {
+  const { toolbox } = dbg;
+
+  return new Promise(resolve => {
+    toolbox.getPanelWhenReady("webconsole").then(() => {
+      ok(toolbox.webconsolePanel, "Console is shown.");
+      resolve(toolbox.webconsolePanel);
+    });
+  });
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-console-link.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-console-link.js
@@ -1,24 +1,25 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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";
 
 // Tests opening the console first, clicking a link
 // opens the editor at the correct location.
 
-async function waitForLink(toolbox) {
-  const { hud } = toolbox.getPanel("webconsole");
-
-  return waitFor(() => hud.ui.outputNode.querySelector(".frame-link-source"));
-}
-
 add_task(async function() {
   const toolbox = await initPane("doc-script-switching.html", "webconsole");
   const node = await waitForLink(toolbox);
   node.click();
 
   await waitFor(() => toolbox.getPanel("jsdebugger"));
   const dbg = createDebuggerContext(toolbox);
   await waitForElementWithSelector(dbg, ".CodeMirror-code > .highlight-line");
   assertHighlightLocation(dbg, "script-switching-02", 14);
 });
+
+async function waitForLink(toolbox) {
+  const { hud } = toolbox.getPanel("webconsole");
+
+  return waitFor(() => hud.ui.outputNode.querySelector(".frame-link-source"));
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-console-map-bindings.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-console-map-bindings.js
@@ -1,8 +1,28 @@
+/* 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/>. */
+
+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, win } = dbg;
 
   if (!win) {
     win = toolbox.win;
@@ -21,25 +41,9 @@ function getSplitConsole(dbg) {
   });
 }
 
 async function evaluate(dbg, expression) {
   const { toolbox } = dbg;
   const { hud } = toolbox.getPanel("webconsole");
   const msg = await evaluateExpressionInConsole(hud, expression);
   return msg.innerText;
-}
-
-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");
-});
+}
\ No newline at end of file
--- a/devtools/client/debugger/test/mochitest/browser_dbg-content-script-sources.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-content-script-sources.js
@@ -1,54 +1,16 @@
+/* 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";
 
 // Tests that the content scripts are listed in the source tree.
 
-async function selectContentScriptSources(dbg) {
-  await waitForSources(dbg, "content_script.js");
-
-  // Select a source.
-  await selectSource(dbg, "content_script.js");
-
-  ok(
-    findElementWithSelector(dbg, ".sources-list .focused"),
-    "Source is focused"
-  );
-}
-
-async function installAndStartExtension() {
-  function contentScript() {
-    console.log("content script loads");
-
-    // This listener prevents the source from being garbage collected
-    // and be missing from the scripts returned by `dbg.findScripts()`
-    // in `ThreadActor._discoverSources`.
-    window.onload = () => {};
-  }
-
-  let extension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      content_scripts: [
-        {
-          js: ["content_script.js"],
-          matches: ["http://example.com/*"],
-          run_at: "document_start"
-        }
-      ]
-    },
-    files: {
-      "content_script.js": contentScript
-    }
-  });
-
-  await extension.startup();
-
-  return extension;
-}
-
 add_task(async function() {
   await pushPref("devtools.chrome.enabled", true);
   const extension = await installAndStartExtension();
 
   let dbg = await initDebugger("doc-content-script-sources.html");
   await clickElement(dbg, "sourceDirectoryLabel", 2);
 
 
@@ -81,8 +43,50 @@ add_task(async function() {
     assertDebugLine(dbg, 2);
     await resume(dbg);
   }
 
   await closeTab(dbg, "content_script.js");
 
   await extension.unload();
 });
+
+async function selectContentScriptSources(dbg) {
+  await waitForSources(dbg, "content_script.js");
+
+  // Select a source.
+  await selectSource(dbg, "content_script.js");
+
+  ok(
+    findElementWithSelector(dbg, ".sources-list .focused"),
+    "Source is focused"
+  );
+}
+
+async function installAndStartExtension() {
+  function contentScript() {
+    console.log("content script loads");
+
+    // This listener prevents the source from being garbage collected
+    // and be missing from the scripts returned by `dbg.findScripts()`
+    // in `ThreadActor._discoverSources`.
+    window.onload = () => {};
+  }
+
+  let extension = ExtensionTestUtils.loadExtension({
+    manifest: {
+      content_scripts: [
+        {
+          js: ["content_script.js"],
+          matches: ["http://example.com/*"],
+          run_at: "document_start"
+        }
+      ]
+    },
+    files: {
+      "content_script.js": contentScript
+    }
+  });
+
+  await extension.startup();
+
+  return extension;
+}
\ No newline at end of file
--- a/devtools/client/debugger/test/mochitest/browser_dbg-continue-to-here-click.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-continue-to-here-click.js
@@ -1,23 +1,23 @@
 /* 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/>. */
 
-async function cmdClickLine(dbg, line) {
-  await cmdClickGutter(dbg, line);
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-pause-points.html", "pause-points.js");
   await selectSource(dbg, "pause-points.js");
   await waitForSelectedSource(dbg, "pause-points.js");
 
   info("Test cmd+click continueing to a line");
   clickElementInTab("#sequences");
   await waitForPaused(dbg);
   await waitForInlinePreviews(dbg);
   await cmdClickLine(dbg, 31);
   await waitForPausedLine(dbg, 31);
   assertDebugLine(dbg, 31, 4);
   await resume(dbg);
   await waitForRequestsToSettle(dbg);
 });
+
+async function cmdClickLine(dbg, line) {
+  await cmdClickGutter(dbg, line);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-continue-to-here.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-continue-to-here.js
@@ -1,29 +1,12 @@
 /* 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/>. */
 
-async function continueToLine(dbg, line) {
-  rightClickElement(dbg, "gutter", line);
-  selectContextMenuItem(dbg, selectors.editorContextMenu.continueToHere);
-  await waitForDispatch(dbg, "RESUME");
-  await waitForPaused(dbg);
-  await waitForInlinePreviews(dbg);
-}
-
-async function continueToColumn(dbg, pos) {
-  await rightClickAtPos(dbg, pos);
-
-  selectContextMenuItem(dbg, selectors.editorContextMenu.continueToHere);
-  await waitForDispatch(dbg, "RESUME");
-  await waitForPaused(dbg);
-  await waitForInlinePreviews(dbg);
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-pause-points.html", "pause-points.js");
   await selectSource(dbg, "pause-points.js");
   await waitForSelectedSource(dbg, "pause-points.js");
 
   info("Test continuing to a line");
   clickElementInTab("#sequences");
   await waitForPaused(dbg);
@@ -37,8 +20,25 @@ add_task(async function() {
   clickElementInTab("#sequences");
   await waitForPaused(dbg);
   await waitForInlinePreviews(dbg);
 
   await continueToColumn(dbg, { line: 31, ch: 7 });
   assertDebugLine(dbg, 31, 4);
   await resume(dbg);
 });
+
+async function continueToLine(dbg, line) {
+  rightClickElement(dbg, "gutter", line);
+  selectContextMenuItem(dbg, selectors.editorContextMenu.continueToHere);
+  await waitForDispatch(dbg, "RESUME");
+  await waitForPaused(dbg);
+  await waitForInlinePreviews(dbg);
+}
+
+async function continueToColumn(dbg, pos) {
+  await rightClickAtPos(dbg, pos);
+
+  selectContextMenuItem(dbg, selectors.editorContextMenu.continueToHere);
+  await waitForDispatch(dbg, "RESUME");
+  await waitForPaused(dbg);
+  await waitForInlinePreviews(dbg);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-debugger-buttons.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-debugger-buttons.js
@@ -1,37 +1,12 @@
 /* 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/>. */
 
-function clickButton(dbg, button) {
-  const resumeFired = waitForDispatch(dbg, "COMMAND");
-  clickElement(dbg, button);
-  return resumeFired;
-}
-
-async function clickStepOver(dbg) {
-  await clickButton(dbg, "stepOver");
-  return waitForPaused(dbg);
-}
-
-async function clickStepIn(dbg) {
-  await clickButton(dbg, "stepIn");
-  return waitForPaused(dbg);
-}
-
-async function clickStepOut(dbg) {
-  await clickButton(dbg, "stepOut");
-  return waitForPaused(dbg);
-}
-
-async function clickResume(dbg) {
-  return clickButton(dbg, "resume");
-}
-
 /**
  * Test debugger buttons
  *  1. resume
  *  2. stepOver
  *  3. stepIn
  *  4. stepOver to the end of a function
  *  5. stepUp at the end of a function
  */
@@ -59,8 +34,33 @@ add_task(async function() {
   info("step over");
   await clickStepOver(dbg);
   assertPausedLocation(dbg);
 
   info("step out");
   await clickStepOut(dbg);
   assertPausedLocation(dbg);
 });
+
+function clickButton(dbg, button) {
+  const resumeFired = waitForDispatch(dbg, "COMMAND");
+  clickElement(dbg, button);
+  return resumeFired;
+}
+
+async function clickStepOver(dbg) {
+  await clickButton(dbg, "stepOver");
+  return waitForPaused(dbg);
+}
+
+async function clickStepIn(dbg) {
+  await clickButton(dbg, "stepIn");
+  return waitForPaused(dbg);
+}
+
+async function clickStepOut(dbg) {
+  await clickButton(dbg, "stepOut");
+  return waitForPaused(dbg);
+}
+
+async function clickResume(dbg) {
+  return clickButton(dbg, "resume");
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-editor-gutter.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-editor-gutter.js
@@ -4,21 +4,16 @@
 
 // Tests the breakpoint gutter and making sure breakpoint icons exist
 // correctly
 
 // FIXME bug 1524374 removing breakpoints in this test can cause uncaught
 // rejections and make bug 1512742 permafail.
 PromiseTestUtils.whitelistRejectionsGlobally(/NS_ERROR_NOT_INITIALIZED/);
 
-// Utilities for interacting with the editor
-function clickGutter(dbg, line) {
-  clickElement(dbg, "gutter", line);
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple1.js");
   const { getState } = dbg;
   const source = findSource(dbg, "simple1.js");
 
   await selectSource(dbg, source.url);
 
   // Make sure that clicking the gutter creates a breakpoint icon.
@@ -62,8 +57,13 @@ add_task(async function() {
   await assertEditorBreakpoint(dbg, 4, true);
 
   // click on test
   invokeInTab("test");
   // verify pause at breakpoint.
   await waitForPaused(dbg);
   ok(true, "source is un-blackboxed");
 });
+
+// Utilities for interacting with the editor
+function clickGutter(dbg, line) {
+  clickElement(dbg, "gutter", line);
+}
\ No newline at end of file
--- a/devtools/client/debugger/test/mochitest/browser_dbg-editor-mode.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-editor-mode.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 editor sets the correct mode for different file
 // types
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple1.js");
 
   await selectSource(dbg, "simple1.js");
   is(dbg.getCM().getOption("mode").name, "javascript", "Mode is correct");
--- a/devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js
@@ -1,23 +1,12 @@
 /* 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/>. */
 
-function assertPauseLocation(dbg, line) {
-  const { location } = dbg.selectors.getVisibleSelectedFrame();
-
-  const source = findSource(dbg, "event-breakpoints.js");
-
-  is(location.sourceId, source.id, `correct sourceId`);
-  is(location.line, line, `correct line`);
-
-  assertPausedLocation(dbg);
-}
-
 add_task(async function() {
   await pushPref(
     "devtools.debugger.features.event-listeners-breakpoints",
     true
   );
 
   const dbg = await initDebugger(
     "doc-event-breakpoints.html",
@@ -64,8 +53,19 @@ add_task(async function() {
 
   invokeInTab("timerHandler");
   is(isPaused(dbg), false);
 
   // Cleanup - unblackbox the source
   await clickElement(dbg, "blackbox");
   await waitForDispatch(dbg, "BLACKBOX");
 });
+
+function assertPauseLocation(dbg, line) {
+  const { location } = dbg.selectors.getVisibleSelectedFrame();
+
+  const source = findSource(dbg, "event-breakpoints.js");
+
+  is(location.sourceId, source.id, `correct sourceId`);
+  is(location.line, line, `correct line`);
+
+  assertPausedLocation(dbg);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-expressions-error.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-expressions-error.js
@@ -1,45 +1,25 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 expressionSelectors = {
+const EXPRESSION_SELECTORS = {
   plusIcon: ".watch-expressions-pane button.plus",
   input: "input.input-expression"
 };
 
-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, expressionSelectors.plusIcon);
-  if (plusIcon) {
-    plusIcon.click();
-  }
-
-  const evaluation = waitForDispatch(dbg, "EVALUATE_EXPRESSION");
-  findElementWithSelector(dbg, expressionSelectors.input).focus();
-  type(dbg, input);
-  pressKey(dbg, "Enter");
-  await evaluation;
-}
-
 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");
@@ -49,8 +29,29 @@ add_task(async function() {
   // 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;
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-expressions-watch.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-expressions-watch.js
@@ -5,28 +5,16 @@
 /**
  * Test the watch expressions "refresh" button:
  * - hidden when no expression is available
  * - visible with one or more expressions
  * - updates expressions values after clicking on it
  * - disappears when all expressions are removed
  */
 
-function getLabel(dbg, index) {
-  return findElement(dbg, "expressionNode", index).innerText;
-}
-
-function getValue(dbg, index) {
-  return findElement(dbg, "expressionValue", index).innerText;
-}
-
-function getRefreshExpressionsElement(dbg) {
-  return findElement(dbg, "expressionRefresh", 1);
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-script-switching.html");
 
   invokeInTab("firstCall");
   await waitForPaused(dbg);
 
   ok(
     !getRefreshExpressionsElement(dbg),
@@ -66,8 +54,20 @@ add_task(async function() {
 
   await deleteExpression(dbg, "someVariable");
 
   ok(
     !getRefreshExpressionsElement(dbg),
     "The refresh button is no longer displayed after removing watch expressions"
   );
 });
+
+function getLabel(dbg, index) {
+  return findElement(dbg, "expressionNode", index).innerText;
+}
+
+function getValue(dbg, index) {
+  return findElement(dbg, "expressionValue", index).innerText;
+}
+
+function getRefreshExpressionsElement(dbg) {
+  return findElement(dbg, "expressionRefresh", 1);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-expressions.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-expressions.js
@@ -5,34 +5,16 @@
 /**
  * tests the watch expressions component
  * 1. add watch expressions
  * 2. edit watch expressions
  * 3. delete watch expressions
  * 4. expanding properties when not paused
  */
 
-function getLabel(dbg, index) {
-  return findElement(dbg, "expressionNode", index).innerText;
-}
-
-function getValue(dbg, index) {
-  return findElement(dbg, "expressionValue", index).innerText;
-}
-
-function assertEmptyValue(dbg, index) {
-  const value = findElement(dbg, "expressionValue", index);
-  if (value) {
-    is(value.innerText, "");
-    return;
-  }
-
-  is(value, null);
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-script-switching.html");
 
   invokeInTab("firstCall");
   await waitForPaused(dbg);
 
   await addExpression(dbg, "f");
   is(getLabel(dbg, 1), "f");
@@ -62,8 +44,26 @@ add_task(async function() {
   is(findAllElements(dbg, "expressionNodes").length, 1);
 
   await toggleExpressionNode(dbg, 1);
   is(findAllElements(dbg, "expressionNodes").length, 34);
 
   await deleteExpression(dbg, "location");
   is(findAllElements(dbg, "expressionNodes").length, 0);
 });
+
+function getLabel(dbg, index) {
+  return findElement(dbg, "expressionNode", index).innerText;
+}
+
+function getValue(dbg, index) {
+  return findElement(dbg, "expressionValue", index).innerText;
+}
+
+function assertEmptyValue(dbg, index) {
+  const value = findElement(dbg, "expressionValue", index);
+  if (value) {
+    is(value.innerText, "");
+    return;
+  }
+
+  is(value, null);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-go-to-line.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-go-to-line.js
@@ -1,34 +1,14 @@
 /* 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 the "go to line" feature correctly responses to keyboard shortcuts.
 
-function assertEnabled(dbg) {
-  is(dbg.selectors.getQuickOpenEnabled(), true, "quickOpen enabled");
-}
-
-function assertDisabled(dbg) {
-  is(dbg.selectors.getQuickOpenEnabled(), false, "quickOpen disabled");
-}
-
-async function waitForGoToLineBoxFocus(dbg) {
-  await waitFor(() => dbg.win.document.activeElement.tagName === "INPUT");
-}
-
-function assertLine(dbg, lineNumber) {
-  is(
-    dbg.selectors.getSelectedLocation().line,
-    lineNumber,
-    `goto line is ${lineNumber}`
-  );
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "long.js");
   await selectSource(dbg, "long");
   await waitForSelectedSource(dbg, "long");
 
   info('Test opening');
   pressKey(dbg, "goToLine");
   assertEnabled(dbg);
@@ -53,8 +33,28 @@ add_task(async function() {
 
   info('Test going to the correct line');
   pressKey(dbg, "goToLine");
   await waitForGoToLineBoxFocus(dbg);
   type(dbg, "66");
   pressKey(dbg, "Enter");
   assertLine(dbg, 66);
 });
+
+function assertEnabled(dbg) {
+  is(dbg.selectors.getQuickOpenEnabled(), true, "quickOpen enabled");
+}
+
+function assertDisabled(dbg) {
+  is(dbg.selectors.getQuickOpenEnabled(), false, "quickOpen disabled");
+}
+
+async function waitForGoToLineBoxFocus(dbg) {
+  await waitFor(() => dbg.win.document.activeElement.tagName === "INPUT");
+}
+
+function assertLine(dbg, lineNumber) {
+  is(
+    dbg.selectors.getSelectedLocation().line,
+    lineNumber,
+    `goto line is ${lineNumber}`
+  );
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-iframes.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-iframes.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 is taking too much time to complete on some hardware since
 // release at https://bugzilla.mozilla.org/show_bug.cgi?id=1423158
 requestLongerTimeout(3);
 
 /**
  * Test debugging a page with iframes
  *  1. pause in the main thread
--- a/devtools/client/debugger/test/mochitest/browser_dbg-inline-cache.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-inline-cache.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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";
 
 /*
  * Test loading inline scripts from cache:
  *   - Load document with inline script
  *   - Reload inside debugger with toolbox caching disabled
  *   - Reload inside debugger with toolbox caching enabled
@@ -31,37 +32,16 @@ server.registerPathHandler("/inline-cach
     </html>
   `);
 });
 
 const SOURCE_URL = `http://localhost:${
   server.identity.primaryPort
 }/inline-cache.html`;
 
-/**
- * This is meant to simulate the developer editing the inline source and saving.
- * Effectively, we change the source during the test at specific controlled points.
- */
-function makeChanges() {
-  docValue++;
-}
-
-function getPageValue(tab) {
-  return SpecialPowers.spawn(tab.linkedBrowser, [], function() {
-    return content.document.querySelector("script").textContent.trim();
-  });
-}
-
-async function reloadTabAndDebugger(tab, dbg) {
-  let navigated = waitForDispatch(dbg, "NAVIGATE");
-  let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
-  await reload(dbg, "inline-cache.html");
-  return Promise.all([navigated, loaded]);
-}
-
 add_task(async function() {
   info("Load document with inline script");
   const tab = await addTab(SOURCE_URL);
   info("Open debugger");
   clearDebuggerPreferences();
   const toolbox = await openToolboxForTab(tab, "jsdebugger");
   const dbg = createDebuggerContext(toolbox);
   info("Reload tab to ensure debugger finds script");
@@ -142,8 +122,29 @@ add_task(async function() {
   ok(
     dbgValue.value.includes(pageValue),
     "Debugger loads from cache, gets value 5 like page"
   );
 
   await toolbox.destroy();
   await removeTab(tab);
 });
+
+/**
+ * This is meant to simulate the developer editing the inline source and saving.
+ * Effectively, we change the source during the test at specific controlled points.
+ */
+function makeChanges() {
+  docValue++;
+}
+
+function getPageValue(tab) {
+  return SpecialPowers.spawn(tab.linkedBrowser, [], function() {
+    return content.document.querySelector("script").textContent.trim();
+  });
+}
+
+async function reloadTabAndDebugger(tab, dbg) {
+  let navigated = waitForDispatch(dbg, "NAVIGATE");
+  let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
+  await reload(dbg, "inline-cache.html");
+  return Promise.all([navigated, loaded]);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-inline-preview.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-inline-preview.js
@@ -1,12 +1,56 @@
 /* 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 checking inline preview feature
+add_task(async function() {
+  await pushPref("devtools.debugger.features.inline-preview", true);
+
+  const dbg = await initDebugger(
+    "doc-inline-preview.html",
+    "inline-preview.js"
+  );
+  await selectSource(dbg, "inline-preview.js");
+
+  await checkInlinePreview(dbg, "checkValues", [
+    { identifier: "a:", value: '""' },
+    { identifier: "b:", value: "false" },
+    { identifier: "c:", value: "undefined" },
+    { identifier: "d:", value: "null" },
+    { identifier: "e:", value: "Array []" },
+    { identifier: "f:", value: "Object { }" },
+    { identifier: "obj:", value: "Object { foo: 1 }" },
+    {
+      identifier: "bs:",
+      value: "Array(101) [ {…}, {…}, {…}, … ]",
+    },
+  ]);
+
+  await checkInlinePreview(dbg, "columnWise", [
+    { identifier: "c:", value: '"c"' },
+    { identifier: "a:", value: '"a"' },
+    { identifier: "b:", value: '"b"' },
+  ]);
+
+  // Checks that open in inspector button works in inline preview
+  invokeInTab("btnClick");
+  await checkInspectorIcon(dbg);
+
+  const { toolbox } = dbg;
+  await toolbox.selectTool("jsdebugger");
+
+  await waitForPaused(dbg);
+
+  // Check preview of event ( event.target should be clickable )
+  // onBtnClick function in inline-preview.js
+  await checkInspectorIcon(dbg);
+});
+
 async function checkInlinePreview(dbg, fnName, inlinePreviews) {
   invokeInTab(fnName);
 
   await waitForAllElements(dbg, "inlinePreviewLabels", inlinePreviews.length);
 
   const labels = findAllElements(dbg, "inlinePreviewLabels");
   const values = findAllElements(dbg, "inlinePreviewValues");
 
@@ -44,52 +88,8 @@ async function checkInspectorIcon(dbg) {
   is(nodeFront.displayName, "button", "The correct node was highlighted");
 
   // Ensure panel changes when button is clicked
   node.click();
   await waitForInspectorPanelChange(dbg);
 
   await resume(dbg);
 }
-
-// Test checking inline preview feature
-add_task(async function() {
-  await pushPref("devtools.debugger.features.inline-preview", true);
-
-  const dbg = await initDebugger(
-    "doc-inline-preview.html",
-    "inline-preview.js"
-  );
-  await selectSource(dbg, "inline-preview.js");
-
-  await checkInlinePreview(dbg, "checkValues", [
-    { identifier: "a:", value: '""' },
-    { identifier: "b:", value: "false" },
-    { identifier: "c:", value: "undefined" },
-    { identifier: "d:", value: "null" },
-    { identifier: "e:", value: "Array []" },
-    { identifier: "f:", value: "Object { }" },
-    { identifier: "obj:", value: "Object { foo: 1 }" },
-    {
-      identifier: "bs:",
-      value: "Array(101) [ {…}, {…}, {…}, … ]",
-    },
-  ]);
-
-  await checkInlinePreview(dbg, "columnWise", [
-    { identifier: "c:", value: '"c"' },
-    { identifier: "a:", value: '"a"' },
-    { identifier: "b:", value: '"b"' },
-  ]);
-
-  // Checks that open in inspector button works in inline preview
-  invokeInTab("btnClick");
-  await checkInspectorIcon(dbg);
-
-  const { toolbox } = dbg;
-  await toolbox.selectTool("jsdebugger");
-
-  await waitForPaused(dbg);
-
-  // Check preview of event ( event.target should be clickable )
-  // onBtnClick function in inline-preview.js
-  await checkInspectorIcon(dbg);
-});
--- a/devtools/client/debugger/test/mochitest/browser_dbg-keyboard-navigation.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-keyboard-navigation.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 keyboard navigation into and out of debugger code editor
 
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple2");
   let doc = dbg.win.document;
 
   await selectSource(dbg, "simple2");
--- a/devtools/client/debugger/test/mochitest/browser_dbg-keyboard-shortcuts.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-keyboard-shortcuts.js
@@ -1,35 +1,16 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 keyboard shortcuts.
  */
 
-function pressResume(dbg) {
-  pressKey(dbg, "resumeKey");
-  return waitForPaused(dbg);
-}
-
-function pressStepOver(dbg) {
-  pressKey(dbg, "stepOverKey");
-  return waitForPaused(dbg);
-}
-
-function pressStepIn(dbg) {
-  pressKey(dbg, "stepInKey");
-  return waitForPaused(dbg);
-}
-
-function pressStepOut(dbg) {
-  pressKey(dbg, "stepOutKey");
-  return waitForPaused(dbg);
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-debugger-statements.html");
 
   await reload(dbg);
   await waitForPaused(dbg);
   await waitForLoadedSource(dbg, "doc-debugger-statements.html");
   assertPausedLocation(dbg, "doc-debugger-statements");
 
@@ -43,8 +24,28 @@ add_task(async function() {
   assertPausedLocation(dbg);
 
   await pressStepOut(dbg);
   assertPausedLocation(dbg);
 
   await pressStepOver(dbg);
   assertPausedLocation(dbg);
 });
+
+function pressResume(dbg) {
+  pressKey(dbg, "resumeKey");
+  return waitForPaused(dbg);
+}
+
+function pressStepOver(dbg) {
+  pressKey(dbg, "stepOverKey");
+  return waitForPaused(dbg);
+}
+
+function pressStepIn(dbg) {
+  pressKey(dbg, "stepInKey");
+  return waitForPaused(dbg);
+}
+
+function pressStepOut(dbg) {
+  pressKey(dbg, "stepOutKey");
+  return waitForPaused(dbg);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-layout-changes.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-layout-changes.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
 
 /**
  * This if the debugger's layout is correctly modified when the toolbox's
  * host changes.
  */
 requestLongerTimeout(2);
 
-var gDefaultHostType = Services.prefs.getCharPref("devtools.toolbox.host");
+let gDefaultHostType = Services.prefs.getCharPref("devtools.toolbox.host");
 
 add_task(async function() {
   // test is too slow on some platforms due to the number of test cases
   const dbg = await initDebugger("doc-iframes.html");
 
   const layouts = [
     ["vertical", "window:small"],
     ["horizontal", "bottom"],
--- a/devtools/client/debugger/test/mochitest/browser_dbg-merge-scopes.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-merge-scopes.js
@@ -1,20 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function getLabel(dbg, index) {
-  return findElement(dbg, "scopeNode", index).innerText;
-}
-
-function expectLabels(dbg, array) {
-  for (let i = 0; i < array.length; i++) {
-    is(getLabel(dbg, i + 1), array[i], `Correct label ${array[i]} for index ${i + 1}`);
-  }
-}
+/* 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 that adjacent scopes are merged together as expected.
 add_task(async function() {
   const dbg = await initDebugger("doc-merge-scopes.html");
 
   invokeInTab("run");
   await waitForPaused(dbg, "doc-merge-scopes.html");
 
@@ -31,8 +22,18 @@ add_task(async function() {
   await resume(dbg);
   await waitForPaused(dbg);
 
   // When there is a function body, function lexical, and inner lexical scope,
   // the first two are merged together.
   await toggleScopeNode(dbg, 4);
   expectLabels(dbg, ["Block", "<this>", "z", "third", "arguments", "v", "x", "y"]);
 });
+
+function getLabel(dbg, index) {
+  return findElement(dbg, "scopeNode", index).innerText;
+}
+
+function expectLabels(dbg, array) {
+  for (let i = 0; i < array.length; i++) {
+    is(getLabel(dbg, i + 1), array[i], `Correct label ${array[i]} for index ${i + 1}`);
+  }
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-minified.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-minified.js
@@ -1,21 +1,14 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 minfied + source maps.
 
-function getScopeNodeLabel(dbg, index) {
-  return findElement(dbg, "scopeNode", index).innerText;
-}
-
-function getScopeNodeValue(dbg, index) {
-  return findElement(dbg, "scopeValue", index).innerText;
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-minified2.html", "sum.js");
   dbg.actions.toggleMapScopes();
 
   await selectSource(dbg, "sum.js");
   await addBreakpoint(dbg, "sum.js", 2);
 
   invokeInTab("test");
@@ -23,8 +16,16 @@ add_task(async function() {
 
   is(getScopeNodeLabel(dbg, 1), "sum", "check scope label");
   is(getScopeNodeLabel(dbg, 2), "first", "check scope label");
   is(getScopeNodeValue(dbg, 2), "40", "check scope value");
   is(getScopeNodeLabel(dbg, 3), "second", "check scope label");
   is(getScopeNodeValue(dbg, 3), "2", "check scope value");
   is(getScopeNodeLabel(dbg, 4), "Window", "check scope label");
 });
+
+function getScopeNodeLabel(dbg, index) {
+  return findElement(dbg, "scopeNode", index).innerText;
+}
+
+function getScopeNodeValue(dbg, index) {
+  return findElement(dbg, "scopeValue", index).innerText;
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-navigation.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-navigation.js
@@ -1,17 +1,13 @@
 /* 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/>. */
 
-function countSources(dbg) {
-  return dbg.selectors.getSourceCount();
-}
-
-const sources = [
+const SOURCES = [
   "simple1.js",
   "simple2.js",
   "simple3.js",
   "long.js",
   "scripts.html"
 ];
 
 /**
@@ -38,33 +34,37 @@ add_task(async function() {
   toggleScopes(dbg);
 
   assertPausedLocation(dbg);
   is(countSources(dbg), 5, "5 sources are loaded.");
 
   await waitForRequestsToSettle(dbg);
   // this test is intermittent without this
   let onBreakpoint = waitForDispatch(dbg, "SET_BREAKPOINT");
-  await navigate(dbg, "doc-scripts.html", ...sources);
+  await navigate(dbg, "doc-scripts.html", ...SOURCES);
   await onBreakpoint
   is(countSources(dbg), 5, "5 sources are loaded.");
   ok(!getIsPaused(getCurrentThread()), "Is not paused");
 
   await waitForRequestsToSettle(dbg);
   // this test is intermittent without this
   onBreakpoint = waitForDispatch(dbg, "SET_BREAKPOINT");
-  await navigate(dbg, "doc-scripts.html", ...sources);
+  await navigate(dbg, "doc-scripts.html", ...SOURCES);
   await onBreakpoint
   is(countSources(dbg), 5, "5 sources are loaded.");
 
   // Test that the current select source persists across reloads
   await selectSource(dbg, "long.js");
 
   await waitForRequestsToSettle(dbg);
   // this test is intermittent without this
   onBreakpoint = waitForDispatch(dbg, "SET_BREAKPOINT");
   await reload(dbg, "long.js");
   await onBreakpoint
   await waitForSelectedSource(dbg, "long.js");
 
   await waitForRequestsToSettle(dbg);
   ok(getSelectedSource().url.includes("long.js"), "Selected source is long.js");
 });
+
+function countSources(dbg) {
+  return dbg.selectors.getSourceCount();
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-old-breakpoint.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-old-breakpoint.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 that we show a breakpoint in the UI when there is an old pending
 // breakpoint with an invalid original location.
 add_task(async function() {
   clearDebuggerPreferences();
 
   const pending = {
     bp1: {
--- a/devtools/client/debugger/test/mochitest/browser_dbg-outline-filter.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-outline-filter.js
@@ -1,18 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function getItems(dbg) {
-  return findAllElements(dbg, "outlineItems");
-}
-
-function getNthItem(dbg, index) {
-  return findElement(dbg, "outlineItem", index);
-}
+/* 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 the outline pane fuzzy filtering of outline items
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "long");
   await selectSource(dbg, "long", 1);
   findElementWithSelector(dbg, ".outline-tab").click();
 
   // turn off alphetical sort if active
@@ -75,8 +68,16 @@ add_task(async function() {
   is(getItems(dbg).length, 9, "9 items in the list after enter pressed");
 
   // check that the term 'todo' includes items with todo
   type(dbg, "todo");
   is(getItems(dbg).length, 2, "2 items in the list after 'todo' filter");
   ok(getItems(dbg)[0].textContent.includes("TodoModel(key)"), "item TodoModel");
   ok(getItems(dbg)[1].textContent.includes("addTodo(title)"), "item addTodo");
 });
+
+function getItems(dbg) {
+  return findAllElements(dbg, "outlineItems");
+}
+
+function getNthItem(dbg, index) {
+  return findElement(dbg, "outlineItem", index);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-outline-focus.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-outline-focus.js
@@ -1,26 +1,14 @@
 /* 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 after clicking a function in edtior, outline focuses that function
 
-function getItems(dbg) {
-  return findAllElements(dbg, "outlineItems");
-}
-
-function getFocusedNode(dbg) {
-  return findElementWithSelector(dbg, ".outline-list__element.focused");
-}
-
-function getFocusedFunction(dbg) {
-  return getFocusedNode(dbg).innerText;
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-sources.html", "long");
 
   await selectSource(dbg, "long", 1);
   findElementWithSelector(dbg, ".outline-tab").click();
   is(getItems(dbg).length, 9, "9 items in the outline list");
 
   info("Clicking inside a function in editor should focus the outline");
@@ -30,8 +18,20 @@ add_task(async function() {
     getFocusedFunction(dbg).includes("addTodo"),
     "The right function is focused"
   );
 
   info("Clicking an empty line in the editor should unfocus the outline");
   await clickAtPos(dbg, { line: 13, ch: 2 });
   is(getFocusedNode(dbg), null, "should not exist");
 });
+
+function getItems(dbg) {
+  return findAllElements(dbg, "outlineItems");
+}
+
+function getFocusedNode(dbg) {
+  return findElementWithSelector(dbg, ".outline-list__element.focused");
+}
+
+function getFocusedFunction(dbg) {
+  return getFocusedNode(dbg).innerText;
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-outline-pretty.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-outline-pretty.js
@@ -1,18 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function getItems(dbg) {
-  return findAllElements(dbg, "outlineItems");
-}
-
-function getNthItem(dbg, index) {
-  return findElement(dbg, "outlineItem", index);
-}
+/* 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 length of outline functions for original and pretty printed source matches
 add_task(async function () {
   const dbg = await initDebugger("doc-scripts.html", "simple1");
   const {
     selectors: { getSelectedSource },
     getState
   } = dbg;
@@ -23,8 +16,16 @@ add_task(async function () {
 
   clickElement(dbg, "prettyPrintButton");
   await waitForSource(dbg, "simple1.js:formatted");
   await waitForElementWithSelector(dbg, ".outline-list");
   const prettySource = getItems(dbg);
 
   is(originalSource.length, prettySource.length, "Length of outline functions for both prettyPrint and originalSource same");
 });
+
+function getItems(dbg) {
+  return findAllElements(dbg, "outlineItems");
+}
+
+function getNthItem(dbg, index) {
+  return findElement(dbg, "outlineItem", index);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-outline.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-outline.js
@@ -1,18 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function getItems(dbg) {
-  return findAllElements(dbg, "outlineItems");
-}
-
-function getNthItem(dbg, index) {
-  return findElement(dbg, "outlineItem", index);
-}
+/* 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 clicking a function in outline panel, the editor highlights the correct location.
 // Tests that outline panel can sort functions alphabetically.
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple1");
   const {
     selectors: { getSelectedSource },
     getState,
@@ -59,8 +52,16 @@ add_task(async function() {
     ".outline-list__element .function-signature"
   );
   is(
     firstAlphaFunction.innerText,
     "doEval()",
     "Alphabetized first function is correct"
   );
 });
+
+function getItems(dbg) {
+  return findAllElements(dbg, "outlineItems");
+}
+
+function getNthItem(dbg, index) {
+  return findElement(dbg, "outlineItem", index);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-pause-exceptions.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-pause-exceptions.js
@@ -1,18 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function uncaughtException() {
-  return invokeInTab("uncaughtException").catch(() => {});
-}
-
-function caughtException() {
-  return invokeInTab("caughtException");
-}
+/* 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 Pausing on exception
   1. skip an uncaught exception
   2. pause on an uncaught exception
   3. pause on a caught error
   4. skip a caught error
 */
@@ -102,8 +95,16 @@ add_task(async function() {
   await resume(dbg);
   await waitForPaused(dbg);
   assertPausedAtSourceAndLine(dbg, source.id, 68);
   await resume(dbg);
   await waitForPaused(dbg);
   assertPausedAtSourceAndLine(dbg, source.id, 77);
   await resume(dbg);
 });
+
+function uncaughtException() {
+  return invokeInTab("uncaughtException").catch(() => {});
+}
+
+function caughtException() {
+  return invokeInTab("caughtException");
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-pause-points.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-pause-points.js
@@ -1,25 +1,14 @@
 /* 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/>. */
 
 requestLongerTimeout(2);
 
-async function stepOvers(dbg, count, onStep = () => {}) {
-  for (let i = 0; i < count; i++) {
-    await dbg.actions.stepOver(getThreadContext(dbg));
-    await waitForPaused(dbg);
-    onStep();
-  }
-}
-function formatSteps(steps) {
-  return steps.map(loc => `(${loc.join(",")})`).join(", ");
-}
-
 async function testCase(dbg, { name, steps }) {
   invokeInTab(name);
   const locations = [];
 
   const {
     selectors: { getTopFrame, getCurrentThread }
   } = dbg;
 
@@ -69,8 +58,20 @@ add_task(async function test() {
       [19, 8],
       [19, 17],
       [19, 8],
       [19, 17],
       [19, 8]
     ]
   });
 });
+
+async function stepOvers(dbg, count, onStep = () => {}) {
+  for (let i = 0; i < count; i++) {
+    await dbg.actions.stepOver(getThreadContext(dbg));
+    await waitForPaused(dbg);
+    onStep();
+  }
+}
+
+function formatSteps(steps) {
+  return steps.map(loc => `(${loc.join(",")})`).join(", ");
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-pause-ux.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-pause-ux.js
@@ -1,27 +1,12 @@
 /* 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/>. */
 
-function getScrollTop(dbg) {
-  return getCM(dbg).doc.scrollTop;
-}
-
-async function waitForMatch(dbg, { matchIndex, count }) {
-  await waitForState(
-    dbg,
-    state => {
-      const result = dbg.selectors.getFileSearchResults();
-      return result.matchIndex == matchIndex && result.count == count;
-    },
-    "wait for match"
-  );
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html");
 
   // Make sure that we can set a breakpoint on a line out of the
   // viewport, and that pausing there scrolls the editor to it.
   const longSrc = findSource(dbg, "long.js");
   await selectSource(dbg, "long.js");
   await addBreakpoint(dbg, longSrc, 66);
@@ -37,8 +22,23 @@ add_task(async function() {
 
   info("2. searching should jump to the match");
   pressKey(dbg, "fileSearch");
   type(dbg, "check");
   await waitForMatch(dbg, { matchIndex: 0, count: 2 });
   const matchScrollTop = getScrollTop(dbg);
   ok(pauseScrollTop != matchScrollTop, "did not jump to debug line");
 });
+
+function getScrollTop(dbg) {
+  return getCM(dbg).doc.scrollTop;
+}
+
+async function waitForMatch(dbg, { matchIndex, count }) {
+  await waitForState(
+    dbg,
+    state => {
+      const result = dbg.selectors.getFileSearchResults();
+      return result.matchIndex == matchIndex && result.count == count;
+    },
+    "wait for match"
+  );
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-console.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-console.js
@@ -1,33 +1,16 @@
 /* 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/>. */
 
 // The test has a lot of interactions between debugger and console panels which
 // might take more than 30s to complete on a slow machine.
 requestLongerTimeout(2);
 
-async function waitForConsoleLink(dbg, text) {
-  const toolbox = dbg.toolbox;
-  const console = await toolbox.selectTool("webconsole");
-  const hud = console.hud;
-
-  return waitFor(() => {
-    // Wait until the message updates.
-    const linkEl = hud.ui.outputNode.querySelector(".frame-link-source");
-    if (!linkEl) {
-      return false;
-    }
-
-    const linkText = linkEl.textContent;
-    return linkText == text ? linkEl : null;
-  });
-}
-
 // Tests that pretty-printing updates console messages.
 add_task(async function() {
   const dbg = await initDebugger("doc-minified.html");
   invokeInTab("arithmetic");
 
   info("Switch to console and check message");
   const minifiedLink = await waitForConsoleLink(dbg, "math.min.js:3:73");
 
@@ -49,8 +32,25 @@ add_task(async function() {
 
   info(
     "Click on the link again and check the debugger opens in formatted file"
   );
   formattedLink.click();
   await selectSource(dbg, "math.min.js:formatted");
   await waitForSelectedLocation(dbg, 22);
 });
+
+async function waitForConsoleLink(dbg, text) {
+  const toolbox = dbg.toolbox;
+  const console = await toolbox.selectTool("webconsole");
+  const hud = console.hud;
+
+  return waitFor(() => {
+    // Wait until the message updates.
+    const linkEl = hud.ui.outputNode.querySelector(".frame-link-source");
+    if (!linkEl) {
+      return false;
+    }
+
+    const linkText = linkEl.textContent;
+    return linkText == text ? linkEl : null;
+  });
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-flow.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-flow.js
@@ -1,24 +1,25 @@
 /* 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 loader and new tab appear when pretty printing,
 // and the selected location is mapped afterwards
-function waitForTabCounts(dbg, counts) {
-  return waitForState(dbg, state => {
-    const tabCounts = countTabs(dbg);
-
-    return tabCounts == counts;
-  });
-}
 
 add_task(async function() {
   const dbg = await initDebugger("doc-pretty.html", "pretty.js");
 
   await selectSource(dbg, "pretty.js", 4, 8);
 
   prettyPrint(dbg);
   await waitForTabCounts(dbg, 2);
   await waitForElementWithSelector(dbg, selectors.prettyPrintLoader);
   await waitForSelectedLocation(dbg, 5);
 });
+
+function waitForTabCounts(dbg, counts) {
+  return waitForState(dbg, state => {
+    const tabCounts = countTabs(dbg);
+
+    return tabCounts == counts;
+  });
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 basic pretty-printing functionality.
 
 add_task(async function() {
   const dbg = await initDebugger("doc-minified.html", "math.min.js");
 
   await selectSource(dbg, "math.min.js", 2);
   clickElement(dbg, "prettyPrintButton");
--- a/devtools/client/debugger/test/mochitest/browser_dbg-preview-frame.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-preview-frame.js
@@ -1,30 +1,12 @@
 /* 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/>. */
 
-function waitForSelectedFrame(dbg, displayName) {
-  const { getInScopeLines, getVisibleSelectedFrame } = dbg.selectors;
-  return waitForState(dbg, state => {
-    const frame = getVisibleSelectedFrame();
-
-    return (
-      frame &&
-      frame.displayName == displayName &&
-      getInScopeLines(frame.location)
-    );
-  });
-}
-
-async function assertFunctionPreview(dbg, line, column, displayName) {
-  const previewEl = await tryHovering(dbg, line, column, "tooltip");
-  is(previewEl.innerText, displayName);
-}
-
 // Test hovering in a selected frame
 add_task(async function() {
   const dbg = await initDebugger("doc-script-switching.html");
 
   const found = findElement(dbg, "callStackBody");
   is(found, null, "Call stack is hidden");
 
   invokeInTab("firstCall");
@@ -41,8 +23,25 @@ add_task(async function() {
   await selectSource(dbg, "switching-01");
   await assertFunctionPreview(dbg, 8, 4, "secondCall()");
   is(
     dbg.selectors.getInScopeLines(frame.location),
     inScopeLines,
     "In scope lines"
   );
 });
+
+function waitForSelectedFrame(dbg, displayName) {
+  const { getInScopeLines, getVisibleSelectedFrame } = dbg.selectors;
+  return waitForState(dbg, state => {
+    const frame = getVisibleSelectedFrame();
+
+    return (
+      frame?.displayName == displayName &&
+      getInScopeLines(frame.location)
+    );
+  });
+}
+
+async function assertFunctionPreview(dbg, line, column, displayName) {
+  const previewEl = await tryHovering(dbg, line, column, "tooltip");
+  is(previewEl.innerText, displayName);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-preview-source-maps.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-preview-source-maps.js
@@ -1,43 +1,12 @@
 /* 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/>. */
 
-async function assertNoTooltip(dbg) {
-  await waitForTime(200);
-  const el = findElement(dbg, "tooltip");
-  is(el, null, "Tooltip should not exist");
-}
-
-function assertPreviewTooltip(dbg, { result, expression }) {
-  const previewEl = findElement(dbg, "tooltip");
-  is(previewEl.innerText, result, "Preview text shown to user");
-
-  const preview = dbg.selectors.getPreview();
-  is(`${preview.result}`, result, "Preview.result");
-  is(preview.updating, false, "Preview.updating");
-  is(preview.expression, expression, "Preview.expression");
-}
-
-function assertPreviewPopup(dbg, { field, value, expression }) {
-  const previewEl = findElement(dbg, "popup");
-  is(previewEl.innerText, "", "Preview text shown to user");
-
-  const preview = dbg.selectors.getPreview();
-
-  is(
-    `${preview.result.preview.ownProperties[field].value}`,
-    value,
-    "Preview.result"
-  );
-  is(preview.updating, false, "Preview.updating");
-  is(preview.expression, expression, "Preview.expression");
-}
-
 add_task(async function() {
   const dbg = await initDebugger(
     "doc-sourcemaps.html",
     "entry.js",
     "output.js",
     "times2.js",
     "opts.js"
   );
@@ -61,8 +30,39 @@ add_task(async function() {
     { line: 70, column: 11, result: 4, expression: "x" },
   ]);
 
   info("Test that you can not preview in another original file");
   await selectSource(dbg, "output");
   await hoverAtPos(dbg, { line: 2, ch: 16 });
   await assertNoTooltip(dbg);
 });
+
+async function assertNoTooltip(dbg) {
+  await waitForTime(200);
+  const el = findElement(dbg, "tooltip");
+  is(el, null, "Tooltip should not exist");
+}
+
+function assertPreviewTooltip(dbg, { result, expression }) {
+  const previewEl = findElement(dbg, "tooltip");
+  is(previewEl.innerText, result, "Preview text shown to user");
+
+  const preview = dbg.selectors.getPreview();
+  is(`${preview.result}`, result, "Preview.result");
+  is(preview.updating, false, "Preview.updating");
+  is(preview.expression, expression, "Preview.expression");
+}
+
+function assertPreviewPopup(dbg, { field, value, expression }) {
+  const previewEl = findElement(dbg, "popup");
+  is(previewEl.innerText, "", "Preview text shown to user");
+
+  const preview = dbg.selectors.getPreview();
+
+  is(
+    `${preview.result.preview.ownProperties[field].value}`,
+    value,
+    "Preview.result"
+  );
+  is(preview.updating, false, "Preview.updating");
+  is(preview.expression, expression, "Preview.expression");
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-preview.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-preview.js
@@ -1,38 +1,12 @@
 /* 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/>. */
 
-async function previews(dbg, fnName, previews) {
-  const invokeResult = invokeInTab(fnName);
-  await waitForPaused(dbg);
-
-  await assertPreviews(dbg, previews);
-  await resume(dbg);
-
-  info(`Ran tests for ${fnName}`);
-}
-
-async function testBucketedArray(dbg) {
-  const invokeResult = invokeInTab("largeArray");
-  await waitForPaused(dbg);
-  const preview = await hoverOnToken(dbg, 34, 10, "popup");
-
-  is(
-    preview.properties.map(p => p.name).join(" "),
-    "[0…99] [100…100] length <prototype>",
-    "Popup properties are bucketed"
-  );
-
-  is(preview.properties[0].meta.endIndex, 99, "first bucket ends at 99");
-  is(preview.properties[2].contents.value, 101, "length is 101");
-  await resume(dbg);
-}
-
 // Test hovering on an object, which will show a popup and on a
 // simple value, which will show a tooltip.
 add_task(async function() {
   const dbg = await initDebugger("doc-preview.html", "preview.js");
 
   await previews(dbg, "testInline", [
     { line: 17, column: 16, expression: "obj?.prop", result: 2 },
   ]);
@@ -59,8 +33,34 @@ add_task(async function() {
     {
       line: 17,
       column: 9,
       expression: "d",
       fields: [["length", "0"]],
     },
   ]);
 });
+
+async function previews(dbg, fnName, previews) {
+  const invokeResult = invokeInTab(fnName);
+  await waitForPaused(dbg);
+
+  await assertPreviews(dbg, previews);
+  await resume(dbg);
+
+  info(`Ran tests for ${fnName}`);
+}
+
+async function testBucketedArray(dbg) {
+  const invokeResult = invokeInTab("largeArray");
+  await waitForPaused(dbg);
+  const preview = await hoverOnToken(dbg, 34, 10, "popup");
+
+  is(
+    preview.properties.map(p => p.name).join(" "),
+    "[0…99] [100…100] length <prototype>",
+    "Popup properties are bucketed"
+  );
+
+  is(preview.properties[0].meta.endIndex, 99, "first bucket ends at 99");
+  is(preview.properties[2].contents.value, 101, "length is 101");
+  await resume(dbg);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-quick-open.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-quick-open.js
@@ -1,73 +1,12 @@
 /* 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/>. */
 
-function assertEnabled(dbg) {
-  is(dbg.selectors.getQuickOpenEnabled(), true, "quickOpen enabled");
-}
-
-function assertDisabled(dbg) {
-  is(dbg.selectors.getQuickOpenEnabled(), false, "quickOpen disabled");
-}
-
-function assertLine(dbg, lineNumber) {
-  is(
-    dbg.selectors.getSelectedLocation().line,
-    lineNumber,
-    `goto line is ${lineNumber}`
-  );
-}
-
-function assertColumn(dbg, columnNumber) {
-  is(
-    dbg.selectors.getSelectedLocation().column,
-    columnNumber,
-    `goto column is ${columnNumber}`
-  );
-}
-
-function waitForSymbols(dbg, url) {
-  const source = findSource(dbg, url);
-  return waitForState(dbg, state => dbg.selectors.getSymbols(state, source.id));
-}
-
-function resultCount(dbg) {
-  return findAllElements(dbg, "resultItems").length;
-}
-
-async function quickOpen(dbg, query, shortcut = "quickOpen") {
-  pressKey(dbg, shortcut);
-  assertEnabled(dbg);
-  query !== "" && type(dbg, query);
-}
-
-async function waitForResults(dbg, results) {
-  await waitForAllElements(dbg, "resultItems", results.length, true);
-
-  for (let i = 0; i < results.length; ++i) {
-    if (results[i] !== undefined) {
-      await waitForElement(dbg, "resultItemName", results[i], i + 1);
-    }
-  }
-}
-
-function findResultEl(dbg, index = 1) {
-  return waitForElementWithSelector(dbg, `.result-item:nth-child(${index})`);
-}
-
-async function assertResultIsTab(dbg, index) {
-  const el = await findResultEl(dbg, index);
-  ok(
-    el && !!el.querySelector(".tab.result-item-icon"),
-    "Result should be a tab"
-  );
-}
-
 // Testing quick open
 add_task(async function() {
   const dbg = await initDebugger("doc-script-switching.html");
 
   info("test opening and closing");
   await quickOpen(dbg, "");
   pressKey(dbg, "Escape");
   assertDisabled(dbg);
@@ -131,8 +70,69 @@ add_task(async function() {
 
   info("Testing gotoSource");
   await quickOpen(dbg, "sw1:5");
   await waitForResults(dbg, ["switching-01.js"]);
   pressKey(dbg, "Enter");
   await waitForSelectedSource(dbg, "switching-01");
   assertLine(dbg, 5);
 });
+
+function assertEnabled(dbg) {
+  is(dbg.selectors.getQuickOpenEnabled(), true, "quickOpen enabled");
+}
+
+function assertDisabled(dbg) {
+  is(dbg.selectors.getQuickOpenEnabled(), false, "quickOpen disabled");
+}
+
+function assertLine(dbg, lineNumber) {
+  is(
+    dbg.selectors.getSelectedLocation().line,
+    lineNumber,
+    `goto line is ${lineNumber}`
+  );
+}
+
+function assertColumn(dbg, columnNumber) {
+  is(
+    dbg.selectors.getSelectedLocation().column,
+    columnNumber,
+    `goto column is ${columnNumber}`
+  );
+}
+
+function waitForSymbols(dbg, url) {
+  const source = findSource(dbg, url);
+  return waitForState(dbg, state => dbg.selectors.getSymbols(state, source.id));
+}
+
+function resultCount(dbg) {
+  return findAllElements(dbg, "resultItems").length;
+}
+
+async function quickOpen(dbg, query, shortcut = "quickOpen") {
+  pressKey(dbg, shortcut);
+  assertEnabled(dbg);
+  query !== "" && type(dbg, query);
+}
+
+async function waitForResults(dbg, results) {
+  await waitForAllElements(dbg, "resultItems", results.length, true);
+
+  for (let i = 0; i < results.length; ++i) {
+    if (results[i] !== undefined) {
+      await waitForElement(dbg, "resultItemName", results[i], i + 1);
+    }
+  }
+}
+
+function findResultEl(dbg, index = 1) {
+  return waitForElementWithSelector(dbg, `.result-item:nth-child(${index})`);
+}
+
+async function assertResultIsTab(dbg, index) {
+  const el = await findResultEl(dbg, index);
+  ok(
+    el && !!el.querySelector(".tab.result-item-icon"),
+    "Result should be a tab"
+  );
+}
\ No newline at end of file
--- a/devtools/client/debugger/test/mochitest/browser_dbg-react-jsx.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-react-jsx.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 that dynamically generated <script> elements which contain source maps
 // will be shown in the debugger.
 add_task(async function() {
   const dbg = await initDebugger("doc-react-jsx.html");
 
   invokeInTab("injectScript");
   await waitForSources(dbg, "doc-react-jsx.html", "main.js");
--- a/devtools/client/debugger/test/mochitest/browser_dbg-reload.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-reload.js
@@ -3,26 +3,16 @@
  * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
 
 /*
  * Test reloading:
  * 1. reload the source
  * 2. re-sync breakpoints
  */
 
-async function waitForBreakpoint(dbg, location) {
-  return waitForState(
-    dbg,
-    state => {
-      return dbg.selectors.getBreakpoint(location);
-    },
-    "Waiting for breakpoint"
-  );
-}
-
 add_task(async function() {
   const dbg = await initDebugger("reload/doc-reload.html");
 
   await waitForSource(dbg, "sjs_code_reload");
   await selectSource(dbg, "sjs_code_reload");
   await addBreakpoint(dbg, "sjs_code_reload", 2);
 
   await waitForRequestsToSettle(dbg);
@@ -36,8 +26,18 @@ add_task(async function() {
 
   const breakpointList = dbg.selectors.getBreakpointsList();
   const breakpoint = breakpointList[0];
 
   is(breakpointList.length, 1);
   is(breakpoint.location.line, 6);
   await waitForRequestsToSettle(dbg);
 });
+
+async function waitForBreakpoint(dbg, location) {
+  return waitForState(
+    dbg,
+    state => {
+      return dbg.selectors.getBreakpoint(location);
+    },
+    "Waiting for breakpoint"
+  );
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-reloading.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-reloading.js
@@ -3,26 +3,16 @@
  * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
 
 /*
  * Test reloading:
  * 1. reload the source
  * 2. re-sync breakpoints
  */
 
-async function waitForBreakpoint(dbg, location) {
-  return waitForState(
-    dbg,
-    state => {
-      return dbg.selectors.getBreakpoint(location);
-    },
-    "Waiting for breakpoint"
-  );
-}
-
 add_task(async function() {
   const dbg = await initDebugger(
     "ember/quickstart/dist/",
     "ember-application/index.js"
   );
 
   await selectSource(dbg, "ember-application/index.js");
 
@@ -39,8 +29,18 @@ add_task(async function() {
   reload(dbg, "ember/quickstart/dist/");
 
   info(
     "4. wait for the debugger to pause and show that we're in the correct location"
   );
   await waitForPaused(dbg);
   assertPausedLocation(dbg, "ember-application/index.js", 4);
 });
+
+async function waitForBreakpoint(dbg, location) {
+  return waitForState(
+    dbg,
+    state => {
+      return dbg.selectors.getBreakpoint(location);
+    },
+    "Waiting for breakpoint"
+  );
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-remember-expanded-scopes.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-remember-expanded-scopes.js
@@ -1,41 +1,39 @@
 /* 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/>. */
 
 // Ignore strange errors when shutting down.
 PromiseTestUtils.whitelistRejectionsGlobally(/No such actor/);
 PromiseTestUtils.whitelistRejectionsGlobally(/connection just closed/);
 
-const MaxItems = 10;
+const MAXIMUM_ITEMS = 10;
+
+// Test that expanded scopes stay expanded after resuming and pausing again.
+add_task(async function() {
+  const dbg = await initDebugger("doc-remember-expanded-scopes.html");
+  invokeInTab("main", "doc-remember-expanded-scopes.html");
+  await waitForPaused(dbg);
+
+  await toggleNode(dbg, "object");
+  await toggleNode(dbg, "innerObject");
+  await stepOver(dbg);
+  await waitForPaused(dbg);
+
+  await waitUntil(() => findNode(dbg, "innerData"));
+  ok(true, "Inner object data automatically expanded after stepping");
+});
 
 function findNode(dbg, text) {
-  for (let index = 0; index < MaxItems; index++) {
-    var elem = findElement(dbg, "scopeNode", index);
-    if (elem && elem.innerText == text) {
+  for (let index = 0; index < MAXIMUM_ITEMS; index++) {
+    const elem = findElement(dbg, "scopeNode", index);
+    if (elem?.innerText == text) {
       return elem;
     }
   }
   return null;
 }
 
 async function toggleNode(dbg, text) {
   const node = await waitUntilPredicate(() => findNode(dbg, text));
   return toggleObjectInspectorNode(node);
-}
-
-// Test that expanded scopes stay expanded after resuming and pausing again.
-add_task(async function() {
-  const dbg = await initDebugger("doc-remember-expanded-scopes.html");
-  invokeInTab("main", "doc-remember-expanded-scopes.html");
-  await waitForPaused(dbg);
-
-  const MaxItems = 10;
-
-  await toggleNode(dbg, "object");
-  await toggleNode(dbg, "innerObject");
-  await stepOver(dbg);
-  await waitForPaused(dbg);
-
-  await waitUntil(() => findNode(dbg, "innerData"));
-  ok(true, "Inner object data automatically expanded after stepping");
-});
+}
\ No newline at end of file
--- a/devtools/client/debugger/test/mochitest/browser_dbg-returnvalues.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-returnvalues.js
@@ -1,8 +1,20 @@
+/* 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/>. */
+
+add_task(async function() {
+  const dbg = await initDebugger("doc-return-values.html");
+  await togglePauseOnExceptions(dbg, true, true);
+
+  await testReturnValue(dbg, "to sender");
+  await testThrowValue(dbg, "a fit");
+});
+
 function getLabel(dbg, index) {
   return findElement(dbg, "scopeNode", index).innerText;
 }
 
 function getValue(dbg, index) {
   return findElement(dbg, "scopeValue", index).innerText;
 }
 
@@ -46,16 +58,8 @@ async function testThrowValue(dbg, val) 
   // The "uneval" call here gives us the way one would write `val` as
   // a JavaScript expression, similar to the way the debugger
   // displays values, so this test works when `val` is a string.
   is(getValue(dbg, 2), uneval(val), `check exception is ${uneval(val)}`);
 
   await resume(dbg);
   assertNotPaused(dbg);
 }
-
-add_task(async function() {
-  const dbg = await initDebugger("doc-return-values.html");
-  await togglePauseOnExceptions(dbg, true, true);
-
-  await testReturnValue(dbg, "to sender");
-  await testThrowValue(dbg, "a fit");
-});
--- a/devtools/client/debugger/test/mochitest/browser_dbg-scopes-duplicated.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-scopes-duplicated.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 that properties with the same value objec be expanded. See Bug 1617210.
 
 const httpServer = createTestHTTPServer();
 httpServer.registerContentType("html", "text/html");
 httpServer.registerContentType("js", "application/javascript");
 
 httpServer.registerPathHandler(`/`, function(request, response) {
--- a/devtools/client/debugger/test/mochitest/browser_dbg-scopes-mutations.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-scopes-mutations.js
@@ -1,28 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function getScopeNodeLabel(dbg, index) {
-  return findElement(dbg, "scopeNode", index).innerText;
-}
-
-function getScopeNodeValue(dbg, index) {
-  return findElement(dbg, "scopeValue", index).innerText;
-}
-
-function expandNode(dbg, index) {
-  const node = findElement(dbg, "scopeNode", index);
-  const objectInspector = node.closest(".object-inspector");
-  const properties = objectInspector.querySelectorAll(".node").length;
-  findElement(dbg, "scopeNode", index).click();
-  return waitUntil(
-    () => objectInspector.querySelectorAll(".node").length !== properties
-  );
-}
+/* 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/>. */
 
 add_task(async function() {
   const dbg = await initDebugger("doc-script-mutate.html");
 
   let onPaused = waitForPaused(dbg);
   invokeInTab("mutate");
   await onPaused;
   await waitForSelectedSource(dbg, "script-mutate");
@@ -83,8 +66,26 @@ add_task(async function() {
     'The second element in the scope panel is "<this>"'
   );
   is(
     getScopeNodeLabel(dbg, 4),
     "phonebook",
     'The fourth element in the scope panel is "phonebook"'
   );
 });
+
+function getScopeNodeLabel(dbg, index) {
+  return findElement(dbg, "scopeNode", index).innerText;
+}
+
+function getScopeNodeValue(dbg, index) {
+  return findElement(dbg, "scopeValue", index).innerText;
+}
+
+function expandNode(dbg, index) {
+  const node = findElement(dbg, "scopeNode", index);
+  const objectInspector = node.closest(".object-inspector");
+  const properties = objectInspector.querySelectorAll(".node").length;
+  findElement(dbg, "scopeNode", index).click();
+  return waitUntil(
+    () => objectInspector.querySelectorAll(".node").length !== properties
+  );
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-scopes-xrays.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-scopes-xrays.js
@@ -1,37 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function findNode(dbg, text) {
-  for (let index = 0;; index++) {
-    var elem = findElement(dbg, "scopeNode", index);
-    if (elem && elem.innerText == text) {
-      return elem;
-    }
-  }
-}
-
-function toggleNode(dbg, text) {
-  return toggleObjectInspectorNode(findNode(dbg, text));
-}
-
-function findNodeValue(dbg, text) {
-  for (let index = 0;; index++) {
-    var elem = findElement(dbg, "scopeNode", index);
-    if (elem && elem.innerText == text) {
-      return findElement(dbg, "scopeValue", index).innerText;
-    }
-  }
-}
-
-async function checkObjectNode(dbg, text, value) {
-  await toggleNode(dbg, text);
-  ok(findNodeValue(dbg, "a") == value, "object value");
-}
+/* 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 that xrays do not interfere with examining objects in the scopes pane.
 add_task(async function() {
   const dbg = await initDebugger("doc-scopes-xrays.html");
 
   invokeInTab("start");
   await waitForPaused(dbg, "doc-scopes-xrays.html");
 
@@ -56,8 +30,35 @@ add_task(async function() {
   await toggleNode(dbg, "weakmap");
   await toggleNode(dbg, "<entries>");
   await toggleNode(dbg, "0");
   await checkObjectNode(dbg, "<key>", "5");
   await toggleNode(dbg, "<key>");
   await checkObjectNode(dbg, "<value>", "6");
   await toggleNode(dbg, "weakmap");
 });
+
+function findNode(dbg, text) {
+  for (let index = 0;; index++) {
+    const elem = findElement(dbg, "scopeNode", index);
+    if (elem?.innerText == text) {
+      return elem;
+    }
+  }
+}
+
+function toggleNode(dbg, text) {
+  return toggleObjectInspectorNode(findNode(dbg, text));
+}
+
+function findNodeValue(dbg, text) {
+  for (let index = 0;; index++) {
+    const elem = findElement(dbg, "scopeNode", index);
+    if (elem?.innerText == text) {
+      return findElement(dbg, "scopeValue", index).innerText;
+    }
+  }
+}
+
+async function checkObjectNode(dbg, text, value) {
+  await toggleNode(dbg, text);
+  ok(findNodeValue(dbg, "a") == value, "object value");
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-scopes.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-scopes.js
@@ -1,14 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function getLabel(dbg, index) {
-  return findElement(dbg, "scopeNode", index).innerText;
-}
+/* 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/>. */
 
 add_task(async function() {
   const dbg = await initDebugger("doc-script-switching.html");
 
   const ready = Promise.all([
     waitForPaused(dbg),
     waitForLoadedSource(dbg, "switching-02"),
 
@@ -24,8 +21,12 @@ add_task(async function() {
   is(getLabel(dbg, 4), "foo()");
   await toggleScopeNode(dbg, 4);
   is(getLabel(dbg, 5), "arguments");
 
   await stepOver(dbg);
   is(getLabel(dbg, 4), "foo()");
   is(getLabel(dbg, 5), "Window");
 });
+
+function getLabel(dbg, index) {
+  return findElement(dbg, "scopeNode", index).innerText;
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-search-file-paused.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-search-file-paused.js
@@ -1,27 +1,14 @@
 /* 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 the search bar correctly responds to queries, enter, shift enter
 
-function waitForSearchState(dbg) {
-  return waitForState(dbg, () => getCM(dbg).state.search);
-}
-
-function getFocusedEl(dbg) {
-  const doc = dbg.win.document;
-  return doc.activeElement;
-}
-
-function pressMouseDown(dbg, node) {
-  EventUtils.sendMouseEvent({ type: "mousedown" }, node, dbg.win);
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple1.js", "simple2.js");
   const {
     selectors: { getBreakpoints, getBreakpoint, getActiveSearch },
     getState
   } = dbg;
 
   info("Add a breakpoint, wait for pause");
@@ -64,8 +51,21 @@ add_task(async function() {
   await waitFor(() => cm.state.search.query === "func");
 
   // Ensure there is a match for the new term
   pressKey(dbg, "Enter");
   is(cm.state.search.posFrom.line, 0);
   pressKey(dbg, "Enter");
   is(cm.state.search.posFrom.line, 1);
 });
+
+function waitForSearchState(dbg) {
+  return waitForState(dbg, () => getCM(dbg).state.search);
+}
+
+function getFocusedEl(dbg) {
+  const doc = dbg.win.document;
+  return doc.activeElement;
+}
+
+function pressMouseDown(dbg, node) {
+  EventUtils.sendMouseEvent({ type: "mousedown" }, node, dbg.win);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-search-file-retains-query.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-search-file-retains-query.js
@@ -1,18 +1,14 @@
 /* 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 the search bar retains previous query on re-opening.
 
-function waitForSearchState(dbg) {
-  return waitForState(dbg, () => getCM(dbg).state.search);
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple1.js");
   const {
     selectors: { getActiveSearch, getFileSearchQuery },
   } = dbg;
   const source = findSource(dbg, "simple1.js");
 
   await selectSource(dbg, source.url);
@@ -38,8 +34,12 @@ add_task(async function() {
   await waitFor(() => getActiveSearch() === "file");
   is(getActiveSearch(), "file");
 
   // Test for the retained query
   is(getCM(dbg).state.search.query, "con");
   await waitForDispatch(dbg, "UPDATE_FILE_SEARCH_QUERY");
   is(getFileSearchQuery(), "con");
 });
+
+function waitForSearchState(dbg) {
+  return waitForState(dbg, () => getCM(dbg).state.search);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-search-file.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-search-file.js
@@ -1,24 +1,15 @@
 /* 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 the search bar correctly responds to queries, enter, shift enter
 
-const isMacOS = AppConstants.platform === "macosx";
-
-function waitForSearchState(dbg) {
-  return waitForState(dbg, () => getCM(dbg).state.search);
-}
-
-function getFocusedEl(dbg) {
-  const doc = dbg.win.document;
-  return doc.activeElement;
-}
+const IS_MAC_OSX = AppConstants.platform === "macosx";
 
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple1.js");
   const {
     selectors: { getBreakpoints, getBreakpoint, getActiveSearch },
     getState
   } = dbg;
   const source = findSource(dbg, "simple1.js");
@@ -47,17 +38,17 @@ add_task(async function() {
   is(state.posFrom.line, 3);
 
   pressKey(dbg, "Enter");
   is(state.posFrom.line, 4);
 
   pressKey(dbg, "ShiftEnter");
   is(state.posFrom.line, 3);
 
-  if (isMacOS) {
+  if (IS_MAC_OSX) {
     info('cmd+G and cmdShift+G shortcut for traversing results only work for macOS');
     pressKey(dbg, "fileSearchNext");
     is(state.posFrom.line, 4);
 
     pressKey(dbg, "fileSearchPrev");
     is(state.posFrom.line, 3);
   }
   
@@ -73,8 +64,17 @@ add_task(async function() {
 
   // search is always focused regardless of when or how it was opened
   pressKey(dbg, "fileSearch");
   await clickElement(dbg, "codeMirror");
   pressKey(dbg, "fileSearch");
   is(dbg.win.document.activeElement.tagName, "INPUT", "Search field focused");
   
 });
+
+function waitForSearchState(dbg) {
+  return waitForState(dbg, () => getCM(dbg).state.search);
+}
+
+function getFocusedEl(dbg) {
+  const doc = dbg.win.document;
+  return doc.activeElement;
+}
\ No newline at end of file
--- a/devtools/client/debugger/test/mochitest/browser_dbg-search-project.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-search-project.js
@@ -1,43 +1,12 @@
 /* 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/>. */
 
-function openProjectSearch(dbg) {
-  synthesizeKeyShortcut("CmdOrCtrl+Shift+F");
-  return waitForState(
-    dbg,
-    state => dbg.selectors.getActiveSearch() === "project"
-  );
-}
-
-function closeProjectSearch(dbg) {
-  pressKey(dbg, "Escape");
-  return waitForState(dbg, state => !dbg.selectors.getActiveSearch());
-}
-
-async function selectResult(dbg) {
-  const select = waitForState(dbg, () => !dbg.selectors.getActiveSearch());
-  await clickElement(dbg, "fileMatch");
-  return select;
-}
-
-function getExpandedResultsCount(dbg) {
-  return findAllElements(dbg, "projectSerchExpandedResults").length;
-}
-
-function getResultsFiles(dbg) {
-  const matches = dbg.selectors
-    .getTextSearchResults()
-    .map(file => file.matches);
-
-  return [...matches].length;
-}
-
 // Testing project search
 add_task(async function() {
   const dbg = await initDebugger("doc-script-switching.html", "switching-01");
 
   await selectSource(dbg, "switching-01");
 
   // test opening and closing
   await openProjectSearch(dbg);
@@ -69,8 +38,39 @@ add_task(async function() {
 
   const collapsedNodes = findAllElements(dbg, "projectSearchCollapsed");
   is(collapsedNodes.length, 1);
 
   collapsedNodes[0].click();
 
   is(getExpandedResultsCount(dbg), 226);
 });
+
+function openProjectSearch(dbg) {
+  synthesizeKeyShortcut("CmdOrCtrl+Shift+F");
+  return waitForState(
+    dbg,
+    state => dbg.selectors.getActiveSearch() === "project"
+  );
+}
+
+function closeProjectSearch(dbg) {
+  pressKey(dbg, "Escape");
+  return waitForState(dbg, state => !dbg.selectors.getActiveSearch());
+}
+
+async function selectResult(dbg) {
+  const select = waitForState(dbg, () => !dbg.selectors.getActiveSearch());
+  await clickElement(dbg, "fileMatch");
+  return select;
+}
+
+function getExpandedResultsCount(dbg) {
+  return findAllElements(dbg, "projectSerchExpandedResults").length;
+}
+
+function getResultsFiles(dbg) {
+  const matches = dbg.selectors
+    .getTextSearchResults()
+    .map(file => file.matches);
+
+  return [...matches].length;
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourceURL-breakpoint.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourceURL-breakpoint.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 that breakpoints are hit in eval'ed sources with a sourceURL property.
 add_task(async function() {
   const dbg = await initDebugger("doc-sourceURL-breakpoint.html", "my-foo.js");
   await selectSource(dbg, "my-foo.js");
   await addBreakpoint(dbg, "my-foo.js", 2);
 
   invokeInTab("foo");
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-breakpoint-console.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-breakpoint-console.js
@@ -1,51 +1,15 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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/>. */
 
 // This test can be really slow on debug platforms and should be split.
 requestLongerTimeout(3);
 
-async function evalInConsoleAtPoint(
-  dbg,
-  target,
-  fixture,
-  { line, column },
-  statements
-) {
-  const filename = `${target}://./${fixture}/input.`;
-  const fnName = (target + "-" + fixture).replace(/-([a-z])/g, (s, c) =>
-    c.toUpperCase()
-  );
-
-  await invokeWithBreakpoint(
-    dbg,
-    fnName,
-    filename,
-    { line, column },
-    async () => {
-      await assertConsoleEval(dbg, statements);
-    }
-  );
-
-  ok(true, `Ran tests for ${fixture} at line ${line} column ${column}`);
-}
-
-async function assertConsoleEval(dbg, statements) {
-  const { hud } = await dbg.toolbox.selectTool("webconsole");
-
-  for (const [index, statement] of statements.entries()) {
-    await dbg.client.evaluate(`window.TEST_RESULT = false;`);
-    await evaluateExpressionInConsole(hud, `TEST_RESULT = ${statement};`);
-
-    const result = await dbg.client.evaluate(`window.TEST_RESULT`);
-    is(result.result, true, `'${statement}' evaluates to true`);
-  }
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-sourcemapped.html");
   dbg.actions.toggleMapScopes();
 
   await evalInConsoleAtPoint(
     dbg,
     "webpack3-babel6",
     "eval-maps",
@@ -82,8 +46,45 @@ add_task(async function() {
   await evalInConsoleAtPoint(
     dbg,
     "webpack3-babel6",
     "babel-classes",
     { line: 8, column: 16 },
     [`this.hasOwnProperty("bound")`]
   );
 });
+
+async function evalInConsoleAtPoint(
+  dbg,
+  target,
+  fixture,
+  { line, column },
+  statements
+) {
+  const filename = `${target}://./${fixture}/input.`;
+  const fnName = (target + "-" + fixture).replace(/-([a-z])/g, (s, c) =>
+    c.toUpperCase()
+  );
+
+  await invokeWithBreakpoint(
+    dbg,
+    fnName,
+    filename,
+    { line, column },
+    async () => {
+      await assertConsoleEval(dbg, statements);
+    }
+  );
+
+  ok(true, `Ran tests for ${fixture} at line ${line} column ${column}`);
+}
+
+async function assertConsoleEval(dbg, statements) {
+  const { hud } = await dbg.toolbox.selectTool("webconsole");
+
+  for (const [index, statement] of statements.entries()) {
+    await dbg.client.evaluate(`window.TEST_RESULT = false;`);
+    await evaluateExpressionInConsole(hud, `TEST_RESULT = ${statement};`);
+
+    const result = await dbg.client.evaluate(`window.TEST_RESULT`);
+    is(result.result, true, `'${statement}' evaluates to true`);
+  }
+}
\ No newline at end of file
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-preview.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-preview.js
@@ -1,14 +1,24 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 for preview through Babel's compile output.
 requestLongerTimeout(3);
 
+add_task(async function() {
+  const dbg = await initDebugger("doc-sourcemapped.html");
+  dbg.actions.toggleMapScopes();
+
+  await testForOf(dbg);
+  await testShadowing(dbg);
+  await testImportedBindings(dbg);
+});
+
 async function breakpointPreviews(
   dbg,
   target,
   fixture,
   { line, column },
   previews
 ) {
   const filename = `${target}://./${fixture}/input.`;
@@ -190,17 +200,8 @@ function testImportedBindings(dbg) {
         line: 32,
         column: 20,
         expression: "_mod8.aNamed2;",
         result: '"a-named2"'
       }
     ]
   );
 }
-
-add_task(async function() {
-  const dbg = await initDebugger("doc-sourcemapped.html");
-  dbg.actions.toggleMapScopes();
-
-  await testForOf(dbg);
-  await testShadowing(dbg);
-  await testImportedBindings(dbg);
-});
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-scopes.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-scopes.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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/>. */
 
 // This test can be really slow on debug platforms and should be split.
 requestLongerTimeout(30);
 
 // Tests loading sourcemapped sources for Babel's compile output.
 
 const ACTIVE_TARGETS = new Set([
   // "webpack3",
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-stepping.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-stepping.js
@@ -1,15 +1,26 @@
 /* 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 for stepping through Babel's compile output.
 requestLongerTimeout(4);
 
+add_task(async function() {
+  const dbg = await initDebugger("doc-sourcemapped.html");
+
+  await testStepOverForOf(dbg);
+  await testStepOverForOfArray(dbg);
+  await testStepOveForOfClosure(dbg);
+  await testStepOverForOfArrayClosure(dbg);
+  await testStepOverFunctionParams(dbg);
+  await testStepOverRegeneratorAwait(dbg);
+});
+
 async function breakpointSteps(dbg, target, fixture, { line, column }, steps) {
   const filename = `${target}://./${fixture}/input.`;
   const fnName = `${target}-${fixture}`.replace(/-([a-z])/g, (s, c) =>
     c.toUpperCase()
   );
 
   await invokeWithBreakpoint(
     dbg,
@@ -145,19 +156,8 @@ function testStepOverRegeneratorAwait(db
     { line: 2, column: 2 },
     [
       // Won't work until a fix to regenerator lands and we rebuild.
       // https://github.com/facebook/regenerator/issues/342
       // ["stepOver", { line: 4, column: 2 }],
     ]
   );
 }
-
-add_task(async function() {
-  const dbg = await initDebugger("doc-sourcemapped.html");
-
-  await testStepOverForOf(dbg);
-  await testStepOverForOfArray(dbg);
-  await testStepOveForOfClosure(dbg);
-  await testStepOverForOfArrayClosure(dbg);
-  await testStepOverFunctionParams(dbg);
-  await testStepOverRegeneratorAwait(dbg);
-});
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-toggle.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemapped-toggle.js
@@ -1,27 +1,15 @@
 /* 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 for preview through Babel's compile output.
 requestLongerTimeout(3);
 
-function getOriginalScope(dbg) {
-  return dbg.selectors.getSelectedOriginalScope(
-    dbg.selectors.getCurrentThread()
-  );
-}
-
-async function previewToken(dbg, line, column, value) {
-  const previewEl = await tryHovering(dbg, line, column, "previewPopup");
-  is(previewEl.innerText, value);
-  dbg.actions.clearPreview(getContext(dbg));
-}
-
 // Test pausing with mapScopes enabled and disabled
 add_task(async function() {
   const dbg = await initDebugger("doc-sourcemapped.html");
   dbg.actions.toggleMapScopes();
 
   info("1. Pause on line 20");
   const filename = "webpack3-babel6://./esmodules-cjs/input.";
   await waitForSources(dbg, filename);
@@ -39,8 +27,20 @@ add_task(async function() {
   clickElement(dbg, "mapScopesCheckbox");
   await previewToken(dbg, 21, 16, "undefined");
 
   info("4. StepOver with mapScopes disabled");
   await stepOver(dbg);
   await previewToken(dbg, 20, 16, "undefined");
   ok(getOriginalScope(dbg) == null, "Scopes are not mapped");
 });
+
+function getOriginalScope(dbg) {
+  return dbg.selectors.getSelectedOriginalScope(
+    dbg.selectors.getCurrentThread()
+  );
+}
+
+async function previewToken(dbg, line, column, value) {
+  const previewEl = await tryHovering(dbg, line, column, "previewPopup");
+  is(previewEl.innerText, value);
+  dbg.actions.clearPreview(getContext(dbg));
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-disabled.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-disabled.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 loading and pretty printing bundles with sourcemaps disabled
 requestLongerTimeout(2);
 
 add_task(async function() {
   await pushPref("devtools.source-map.client-service.enabled", false);
   const dbg = await initDebugger("doc-sourcemaps.html");
 
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-indexed.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-indexed.js
@@ -1,23 +1,13 @@
 /* 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/>. */
 requestLongerTimeout(2);
 
-function assertBpInGutter(dbg, lineNumber) {
-  const el = findElement(dbg, "breakpoint");
-  const bpLineNumber = +el.querySelector(".CodeMirror-linenumber").innerText;
-  is(
-    bpLineNumber,
-    lineNumber,
-    "Breakpoint is on the correct line in the gutter"
-  );
-}
-
 // Tests loading sourcemapped sources, setting breakpoints, and
 // stepping in them.
 
 // This source map does not have source contents, so it's fetched separately
 add_task(async function() {
   // NOTE: the CORS call makes the test run times inconsistent
   const dbg = await initDebugger(
     "doc-sourcemaps-indexed.html",
@@ -52,8 +42,18 @@ add_task(async function() {
   ok(findElement(dbg, "sourceMapLink"), "Sourcemap link in original source");
   await selectSource(dbg, "main.min.js");
 
   ok(
     !findElement(dbg, "sourceMapLink"),
     "No Sourcemap link exists in generated source"
   );
 });
+
+function assertBpInGutter(dbg, lineNumber) {
+  const el = findElement(dbg, "breakpoint");
+  const bpLineNumber = +el.querySelector(".CodeMirror-linenumber").innerText;
+  is(
+    bpLineNumber,
+    lineNumber,
+    "Breakpoint is on the correct line in the gutter"
+  );
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-reload.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-reload.js
@@ -3,34 +3,16 @@
  * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
 
 /*
  * Test reloading:
  * 1. reload the source
  * 2. re-sync breakpoints
  */
 
-async function waitForBreakpoint(dbg, location) {
-  return waitForState(
-    dbg,
-    state => {
-      return dbg.selectors.getBreakpoint(location);
-    },
-    "Waiting for breakpoint"
-  );
-}
-
-function getBreakpoints(dbg) {
-  return dbg.selectors.getBreakpointsList();
-}
-
-function getBreakpointCount(dbg) {
-  return dbg.selectors.getBreakpointCount();
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-minified.html");
 
   await navigate(dbg, "sourcemaps-reload/doc-sourcemaps-reload.html", "v1.js");
 
   info("Add initial breakpoint");
   await selectSource(dbg, "v1.js");
   await addBreakpoint(dbg, "v1.js", 6);
@@ -59,8 +41,26 @@ add_task(async function() {
   await waitForSource(dbg, "v1");
 
   // There will initially be zero breakpoints, but wait to make sure none are
   // installed while syncing.
   await waitForTime(1000);
 
   is(getBreakpointCount(dbg), 0, "No breakpoints");
 });
+
+async function waitForBreakpoint(dbg, location) {
+  return waitForState(
+    dbg,
+    state => {
+      return dbg.selectors.getBreakpoint(location);
+    },
+    "Waiting for breakpoint"
+  );
+}
+
+function getBreakpoints(dbg) {
+  return dbg.selectors.getBreakpointsList();
+}
+
+function getBreakpointCount(dbg) {
+  return dbg.selectors.getBreakpointCount();
+}
\ No newline at end of file
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-reloading.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps-reloading.js
@@ -1,20 +1,13 @@
 /* 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/>. */
 requestLongerTimeout(2);
 
-async function waitForBreakpointCount(dbg, count) {
-  return waitForState(
-    dbg,
-    state => dbg.selectors.getBreakpointCount() === count
-  );
-}
-
 add_task(async function() {
   // NOTE: the CORS call makes the test run times inconsistent
   const dbg = await initDebugger("doc-sourcemaps.html");
   const {
     selectors: { getBreakpoint, getBreakpointCount }
   } = dbg;
 
   await waitForSources(dbg, "entry.js", "output.js", "times2.js", "opts.js");
@@ -54,8 +47,15 @@ add_task(async function() {
       sourceId: entrySrc.id,
       line: 15,
       column: 0,
       disabled: true
     }),
     "Breakpoint has correct line"
   );
 });
+
+async function waitForBreakpointCount(dbg, count) {
+  return waitForState(
+    dbg,
+    state => dbg.selectors.getBreakpointCount() === count
+  );
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js
@@ -1,58 +1,16 @@
 /* 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 loading sourcemapped sources, setting breakpoints, and
 // stepping in them.
 requestLongerTimeout(2);
 
-function assertBreakpointExists(dbg, source, line) {
-  const {
-    selectors: { getBreakpoint },
-    getState
-  } = dbg;
-
-  ok(
-    getBreakpoint({ sourceId: source.id, line }),
-    "Breakpoint has correct line"
-  );
-}
-
-async function assertEditorBreakpoint(dbg, line, shouldExist) {
-  const el = await getLineEl(dbg, line);
-  const exists = !!el.querySelector(".new-breakpoint");
-  ok(
-    exists === shouldExist,
-    `Breakpoint ${shouldExist ? "exists" : "does not exist"} on line ${line}`
-  );
-}
-
-async function getLineEl(dbg, line) {
-  let el = await codeMirrorGutterElement(dbg, line);
-  while (el && !el.matches(".CodeMirror-code > div")) {
-    el = el.parentElement;
-  }
-  return el;
-}
-
-async function clickGutter(dbg, line) {
-  const el = await codeMirrorGutterElement(dbg, line);
-  clickDOMElement(dbg, el);
-}
-
-async function waitForBreakpointCount(dbg, count) {
-  const {
-    selectors: { getBreakpointCount },
-    getState
-  } = dbg;
-  await waitForState(dbg, state => getBreakpointCount() == count);
-}
-
 add_task(async function() {
   // NOTE: the CORS call makes the test run times inconsistent
   const dbg = await initDebugger(
     "doc-sourcemaps.html",
     "entry.js",
     "output.js",
     "times2.js",
     "opts.js"
@@ -106,8 +64,50 @@ add_task(async function() {
   assertPausedLocation(dbg);
   assertDebugLine(dbg, 71);
 
   await dbg.actions.jumpToMappedSelectedLocation(getContext(dbg));
   await stepOut(dbg);
   assertPausedLocation(dbg);
   assertDebugLine(dbg, 16);
 });
+
+function assertBreakpointExists(dbg, source, line) {
+  const {
+    selectors: { getBreakpoint },
+    getState
+  } = dbg;
+
+  ok(
+    getBreakpoint({ sourceId: source.id, line }),
+    "Breakpoint has correct line"
+  );
+}
+
+async function assertEditorBreakpoint(dbg, line, shouldExist) {
+  const el = await getLineEl(dbg, line);
+  const exists = !!el.querySelector(".new-breakpoint");
+  ok(
+    exists === shouldExist,
+    `Breakpoint ${shouldExist ? "exists" : "does not exist"} on line ${line}`
+  );
+}
+
+async function getLineEl(dbg, line) {
+  let el = await codeMirrorGutterElement(dbg, line);
+  while (el && !el.matches(".CodeMirror-code > div")) {
+    el = el.parentElement;
+  }
+  return el;
+}
+
+async function clickGutter(dbg, line) {
+  const el = await codeMirrorGutterElement(dbg, line);
+  clickDOMElement(dbg, el);
+}
+
+async function waitForBreakpointCount(dbg, count) {
+  const {
+    selectors: { getBreakpointCount },
+    getState
+  } = dbg;
+  await waitForState(dbg, state => getBreakpointCount() == count);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps2.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps2.js
@@ -1,23 +1,13 @@
 /* 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/>. */
 requestLongerTimeout(2);
 
-function assertBpInGutter(dbg, lineNumber) {
-  const el = findElement(dbg, "breakpoint");
-  const bpLineNumber = +el.querySelector(".CodeMirror-linenumber").innerText;
-  is(
-    bpLineNumber,
-    lineNumber,
-    "Breakpoint is on the correct line in the gutter"
-  );
-}
-
 // Tests loading sourcemapped sources, setting breakpoints, and
 // stepping in them.
 
 // This source map does not have source contents, so it's fetched separately
 add_task(async function() {
   // NOTE: the CORS call makes the test run times inconsistent
   const dbg = await initDebugger(
     "doc-sourcemaps2.html",
@@ -52,8 +42,18 @@ add_task(async function() {
   ok(findElement(dbg, "sourceMapLink"), "Sourcemap link in original source");
   await selectSource(dbg, "main.min.js");
 
   ok(
     !findElement(dbg, "sourceMapLink"),
     "No Sourcemap link exists in generated source"
   );
 });
+
+function assertBpInGutter(dbg, lineNumber) {
+  const el = findElement(dbg, "breakpoint");
+  const bpLineNumber = +el.querySelector(".CodeMirror-linenumber").innerText;
+  is(
+    bpLineNumber,
+    lineNumber,
+    "Breakpoint is on the correct line in the gutter"
+  );
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sources-arrow-keys.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sources-arrow-keys.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 keyboard arrow behaviour
 add_task(async function() {
   const dbg = await initDebugger("doc-sources.html", "simple1", "simple2", "nested-source", "long.js");
 
   await clickElement(dbg, "sourceDirectoryLabel", 3);
   await assertSourceCount(dbg, 8);
 
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sources-named-eval.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sources-named-eval.js
@@ -1,27 +1,14 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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/>. */
 
 // Make sure named eval sources appear in the list.
 
-async function waitForSourceCount(dbg, i) {
-  // We are forced to wait until the DOM nodes appear because the
-  // source tree batches its rendering.
-  await waitUntil(() => {
-    return findAllElements(dbg, "sourceNodes").length === i;
-  }, `waiting for source count ${i}`);
-}
-
-function getLabel(dbg, index) {
-  return findElement(dbg, "sourceNode", index)
-    .textContent.trim()
-    .replace(/^[\s\u200b]*/g, "");
-}
-
 add_task(async function() {
   const dbg = await initDebugger(
     "doc-sources.html",
     "simple1",
     "simple2",
     "nested-source",
     "long.js"
   );
@@ -34,8 +21,22 @@ add_task(async function() {
   SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
     content.eval("window.evaledFunc = function() {} //# sourceURL=evaled.js");
   });
 
   await waitForSourceCount(dbg, 3);
   // is(getLabel(dbg, 3), "evaled.js", "evaled exists");
   ok(true);
 });
+
+async function waitForSourceCount(dbg, i) {
+  // We are forced to wait until the DOM nodes appear because the
+  // source tree batches its rendering.
+  await waitUntil(() => {
+    return findAllElements(dbg, "sourceNodes").length === i;
+  }, `waiting for source count ${i}`);
+}
+
+function getLabel(dbg, index) {
+  return findElement(dbg, "sourceNode", index)
+    .textContent.trim()
+    .replace(/^[\s\u200b]*/g, "");
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sources-querystring.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sources-querystring.js
@@ -1,24 +1,14 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 source tree works.
 
-function getLabel(dbg, index) {
-  return findElement(dbg, "sourceNode", index)
-    .textContent.trim()
-    .replace(/^[\s\u200b]*/g, "");
-}
-
-function assertBreakpointHeading(dbg, label, index) {
-  const breakpointHeading = findElement(dbg, "breakpointItem", index).innerText;
-  is(breakpointHeading, label, `Breakpoint heading is ${label}`);
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-sources-querystring.html", "simple1.js?x=1", "simple1.js?x=2");
   const {
     selectors: { getSelectedSource },
     getState
   } = dbg;
 
   // Expand nodes and make sure more sources appear.
@@ -53,8 +43,19 @@ add_task(async function() {
   ok(prettyTab.querySelector("img.prettyPrint"));
   assertBreakpointHeading(dbg, "simple1.js?x=1", 2);
 
   // assert quick open works with queries
   pressKey(dbg, "quickOpen");
   type(dbg, "simple1.js?x");
   ok(findElement(dbg, "resultItems")[0].innerText.includes("simple.js?x=1"));
 });
+
+function getLabel(dbg, index) {
+  return findElement(dbg, "sourceNode", index)
+    .textContent.trim()
+    .replace(/^[\s\u200b]*/g, "");
+}
+
+function assertBreakpointHeading(dbg, label, index) {
+  const breakpointHeading = findElement(dbg, "breakpointItem", index).innerText;
+  is(breakpointHeading, label, `Breakpoint heading is ${label}`);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-state-based-panels.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-state-based-panels.js
@@ -1,18 +1,14 @@
 /* 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 breakpoint panels open when their relevant breakpoint is hit
 
-function getPaneElements(dbg) {
-  return findElementWithSelector(dbg, '.breakpoints-pane').childNodes;
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-sources.html", "simple1");
 
   clickElementWithSelector(dbg, ".breakpoints-pane h2");
 
   info("Confirm the breakpoints pane is closed");
   is(getPaneElements(dbg).length, 1);
 
@@ -26,8 +22,12 @@ add_task(async function() {
   info("Confirm the breakpoints pane is open");
   is(getPaneElements(dbg).length, 2);
 
   await resume(dbg);
 
   info("Confirm the breakpoints pane is closed again");
   is(getPaneElements(dbg).length, 1);
 });
+
+function getPaneElements(dbg) {
+  return findElementWithSelector(dbg, '.breakpoints-pane').childNodes;
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-step-in-uninitialized.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-step-in-uninitialized.js
@@ -1,24 +1,15 @@
 /* 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/>. */
 
 // When stepping into a function, 'let' variables should show as uninitialized
 // instead of undefined.
 
-function findNodeValue(dbg, text) {
-  for (let index = 0;; index++) {
-    var elem = findElement(dbg, "scopeNode", index);
-    if (elem && elem.innerText == text) {
-      return findElement(dbg, "scopeValue", index).innerText;
-    }
-  }
-}
-
 add_task(async function test() {
   const dbg = await initDebugger("doc-step-in-uninitialized.html");
   invokeInTab("main");
   await waitForPaused(dbg, "doc-step-in-uninitialized.html");
 
   await stepOver(dbg);
   await stepIn(dbg);
 
@@ -31,8 +22,17 @@ add_task(async function test() {
   ok(findNodeValue(dbg, "y") == "(uninitialized)", "y uninitialized");
 
   await stepOver(dbg);
 
   assertDebugLine(dbg, 9);
 
   ok(findNodeValue(dbg, "y") == "3", "y initialized");
 });
+
+function findNodeValue(dbg, text) {
+  for (let index = 0;; index++) {
+    const elem = findElement(dbg, "scopeNode", index);
+    if (elem?.innerText == text) {
+      return findElement(dbg, "scopeValue", index).innerText;
+    }
+  }
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-tabs-keyboard.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-tabs-keyboard.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 removing tabs with keyboard shortcuts
 
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple1", "simple2");
 
   await selectSource(dbg, "simple1");
   await selectSource(dbg, "simple2");
--- a/devtools/client/debugger/test/mochitest/browser_dbg-tabs-pretty-print.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-tabs-pretty-print.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 re-opening pretty printed tabs on load
 
 add_task(async function() {
   const dbg = await initDebugger("doc-minified.html", "math.min.js");
 
   await selectSource(dbg, "math.min.js");
   clickElement(dbg, "prettyPrintButton");
--- a/devtools/client/debugger/test/mochitest/browser_dbg-tabs-without-urls-selected.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-tabs-without-urls-selected.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 that URL-less sources have tabs and selecting that location does not
 // create a new tab for the same URL-less source
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple1", "simple2");
 
   // Create a URL-less source 
   invokeInTab("doEval");
--- a/devtools/client/debugger/test/mochitest/browser_dbg-tabs-without-urls.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-tabs-without-urls.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 that URL-less sources have tabs added to the UI but
 // do not persist upon reload
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple1", "simple2");
 
   await selectSource(dbg, "simple1");
   await selectSource(dbg, "simple2");
--- a/devtools/client/debugger/test/mochitest/browser_dbg-tabs.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-tabs.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 adding and removing tabs
 
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "simple1", "simple2");
 
   await selectSource(dbg, "simple1");
   await selectSource(dbg, "simple2");
--- a/devtools/client/debugger/test/mochitest/browser_dbg-toggling-tools.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-toggling-tools.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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";
 
 // Tests that you can switch tools, without losing your editor position
 
 add_task(async function() {
   const dbg = await initDebugger("doc-scripts.html", "long");
 
--- a/devtools/client/debugger/test/mochitest/browser_dbg-watchpoints.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-watchpoints.js
@@ -1,16 +1,12 @@
 /* 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/>. */
 
-async function getScopeValue(dbg, index) {
-  return (await waitForElement(dbg, "scopeValue", index)).innerText;
-}
-
 // - Tests adding a watchpoint
 // - Tests removing a watchpoint
 // - Tests adding a watchpoint, resuming to after the youngest frame has popped,
 // then removing and adding a watchpoint during the same pause
 
 add_task(async function() {
   pushPref("devtools.debugger.features.watchpoints", true);
   const dbg = await initDebugger("doc-sources.html");
@@ -98,8 +94,13 @@ add_task(async function() {
 
   info("Resume and wait to pause on the final `obj.b;`");
   resume(dbg);
 
   await waitForPaused(dbg);
   assertPausedAtSourceAndLine(dbg, sourceId, 25);
   await waitForRequestsToSettle(dbg);
 });
+
+async function getScopeValue(dbg, index) {
+  return (await waitForElement(dbg, "scopeValue", index)).innerText;
+}
+
--- a/devtools/client/debugger/test/mochitest/browser_dbg-windowless-service-workers.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-windowless-service-workers.js
@@ -1,25 +1,12 @@
 /* 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/>. */
 
-async function checkWorkerThreads(dbg, count) {
-  await waitUntil(() => dbg.selectors.getThreads().length == count);
-  ok(true, `Have ${count} threads`);
-}
-
-async function checkWorkerStatus(dbg, status) {
-  await waitUntil(() => {
-    const threads = dbg.selectors.getThreads();
-    return threads.some(t => t.serviceWorkerStatus == status);
-  });
-  ok(true, `Have thread with status ${status}`);
-}
-
 // Test that we can detect a new service worker and hit breakpoints that we've
 // set in it.
 add_task(async function() {
   info("Subtest #1");
 
   await pushPref("devtools.debugger.features.windowless-service-workers", true);
   await pushPref("devtools.debugger.workers-visible", true);
   await pushPref("dom.serviceWorkers.enabled", true);
@@ -159,8 +146,21 @@ add_task(async function() {
 
   await resume(dbg);
   invokeInTab("unregisterWorker");
 
   await checkWorkerThreads(dbg, 0);
   await waitForRequestsToSettle(dbg);
   await removeTab(gBrowser.selectedTab);
 });
+
+async function checkWorkerThreads(dbg, count) {
+  await waitUntil(() => dbg.selectors.getThreads().length == count);
+  ok(true, `Have ${count} threads`);
+}
+
+async function checkWorkerStatus(dbg, status) {
+  await waitUntil(() => {
+    const threads = dbg.selectors.getThreads();
+    return threads.some(t => t.serviceWorkerStatus == status);
+  });
+  ok(true, `Have thread with status ${status}`);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-windowless-workers-early-breakpoint.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-windowless-workers-early-breakpoint.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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 that breakpoints at worker startup are hit when using windowless workers.
 add_task(async function() {
   const dbg = await initDebugger("doc-windowless-workers-early-breakpoint.html", "simple-worker.js");
 
   const workerSource = findSource(dbg, "simple-worker.js");
 
   await selectSource(dbg, "simple-worker.js");
--- a/devtools/client/debugger/test/mochitest/browser_dbg-windowless-workers.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-windowless-workers.js
@@ -1,35 +1,12 @@
 /* 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/>. */
 
-function assertClass(dbg, selector, className, ...args) {
-  ok(
-    findElement(dbg, selector, ...args).classList.contains(className),
-    `${className} class exists`
-  );
-}
-
-function threadIsPaused(dbg, index) {
-  return ok(findElement(dbg, "threadsPaneItemPause", index));
-}
-
-function threadIsSelected(dbg, index) {
-  return assertClass(dbg, "threadsPaneItem", "selected", index);
-}
-
-function getLabel(dbg, index) {
-  return findElement(dbg, "expressionNode", index).innerText;
-}
-
-function getValue(dbg, index) {
-  return findElement(dbg, "expressionValue", index).innerText;
-}
-
 // Test basic windowless worker functionality: the main thread and worker can be
 // separately controlled from the same debugger.
 add_task(async function() {
   await pushPref("devtools.debugger.features.windowless-workers", true);
   await pushPref("devtools.debugger.workers-visible", true);
 
   const dbg = await initDebugger("doc-windowless-workers.html");
   const mainThread = dbg.toolbox.threadFront.actor;
@@ -112,8 +89,31 @@ add_task(async function() {
   assertPausedAtSourceAndLine(dbg, workerSource.id, 10);
 
   info("StepOver in second worker and not the first");
   await stepOver(dbg);
   assertPausedAtSourceAndLine(dbg, workerSource.id, 11);
   await dbg.actions.selectThread(getContext(dbg), thread1);
   assertPausedAtSourceAndLine(dbg, workerSource.id, 10);
 });
+
+function assertClass(dbg, selector, className, ...args) {
+  ok(
+    findElement(dbg, selector, ...args).classList.contains(className),
+    `${className} class exists`
+  );
+}
+
+function threadIsPaused(dbg, index) {
+  return ok(findElement(dbg, "threadsPaneItemPause", index));
+}
+
+function threadIsSelected(dbg, index) {
+  return assertClass(dbg, "threadsPaneItem", "selected", index);
+}
+
+function getLabel(dbg, index) {
+  return findElement(dbg, "expressionNode", index).innerText;
+}
+
+function getValue(dbg, index) {
+  return findElement(dbg, "expressionValue", index).innerText;
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-worker-scopes.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-worker-scopes.js
@@ -1,37 +1,15 @@
 /* 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/>. */
 
 PromiseTestUtils.whitelistRejectionsGlobally(/Current state is running/);
 PromiseTestUtils.whitelistRejectionsGlobally(/Connection closed/);
 
-function findNode(dbg, text) {
-  for (let index = 0; ; index++) {
-    var elem = findElement(dbg, "scopeNode", index);
-    if (elem && elem.innerText == text) {
-      return elem;
-    }
-  }
-}
-
-function toggleNode(dbg, text) {
-  return toggleObjectInspectorNode(findNode(dbg, text));
-}
-
-function findNodeValue(dbg, text) {
-  for (let index = 0; ; index++) {
-    var elem = findElement(dbg, "scopeNode", index);
-    if (elem && elem.innerText == text) {
-      return findElement(dbg, "scopeValue", index).innerText;
-    }
-  }
-}
-
 // Test that unusual objects have their contents shown in worker thread scopes.
 add_task(async function() {
   const dbg = await initDebugger("doc-worker-scopes.html", "scopes-worker.js");
   const workerSource = findSource(dbg, "scopes-worker.js");
 
   await addBreakpoint(dbg, workerSource, 11);
   await dbg.toolbox.target.waitForRequestsToSettle();
   invokeInTab("startWorker");
@@ -89,8 +67,30 @@ add_task(async function() {
   await toggleNode(dbg, "var_weakset");
 
   // Close the scopes in order to unmount the reps in order to force spawning
   // the various `release` RDP requests which, otherwise, would happen in
   // middle of the toolbox destruction. Then, wait for them to finish.
   await toggleScopes(dbg);
   await waitForRequestsToSettle(dbg);
 });
+
+function findNode(dbg, text) {
+  for (let index = 0; ; index++) {
+    const elem = findElement(dbg, "scopeNode", index);
+    if (elem?.innerText == text) {
+      return elem;
+    }
+  }
+}
+
+function toggleNode(dbg, text) {
+  return toggleObjectInspectorNode(findNode(dbg, text));
+}
+
+function findNodeValue(dbg, text) {
+  for (let index = 0; ; index++) {
+    const elem = findElement(dbg, "scopeNode", index);
+    if (elem?.innerText == text) {
+      return findElement(dbg, "scopeValue", index).innerText;
+    }
+  }
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg-xhr-breakpoints.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-xhr-breakpoints.js
@@ -1,66 +1,12 @@
 /* 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/>. */
 
-async function addXHRBreakpoint(dbg, text, method) {
-  info(`Adding a XHR breakpoint for pattern ${text} and method ${method}`);
-
-  const plusIcon = findElementWithSelector(dbg, ".xhr-breakpoints-pane .plus");
-  if (plusIcon) {
-    plusIcon.click();
-  }
-  findElementWithSelector(dbg, ".xhr-input-url").focus();
-  type(dbg, text);
-
-  if (method) {
-    findElementWithSelector(dbg, ".xhr-input-method").value = method;
-  }
-
-  pressKey(dbg, "Enter");
-
-  await waitForDispatch(dbg, "SET_XHR_BREAKPOINT");
-}
-
-async function removeXHRBreakpoint(dbg, index) {
-  info("Removing a XHR breakpoint");
-
-  const closeButtons = dbg.win.document.querySelectorAll(
-    ".xhr-breakpoints-pane .close-btn"
-  );
-  if (closeButtons[index]) {
-    closeButtons[index].click();
-  }
-
-  await waitForDispatch(dbg, "REMOVE_XHR_BREAKPOINT");
-}
-
-function getXHRBreakpointsElements(dbg) {
-  return [
-    ...dbg.win.document.querySelectorAll(".xhr-breakpoints-pane .xhr-container")
-  ];
-}
-
-function getXHRBreakpointLabels(elements) {
-  return elements.map(element => element.title);
-}
-
-function getXHRBreakpointCheckbox(dbg) {
-  return findElementWithSelector(
-    dbg,
-    ".xhr-breakpoints-pane .breakpoints-exceptions input"
-  );
-}
-
-async function clickPauseOnAny(dbg, expectedEvent) {
-  getXHRBreakpointCheckbox(dbg).click();
-  await waitForDispatch(dbg, expectedEvent);
-}
-
 add_task(async function() {
   const dbg = await initDebugger("doc-xhr.html", "fetch.js");
 
   await addXHRBreakpoint(dbg, "doc", "GET");
 
   invokeInTab("main", "doc-xhr.html");
   await waitForPaused(dbg);
   assertPausedLocation(dbg);
@@ -122,8 +68,62 @@ add_task(async function() {
   is(listItems.length, 3, "3 XHR breakpoints display in list");
   is(pauseOnAnyCheckbox.checked, true, "The pause on any is still checked");
   is(
     getXHRBreakpointLabels(listItems).join(""),
     "134",
     "Only the desired breakpoint was removed"
   );
 });
+
+async function addXHRBreakpoint(dbg, text, method) {
+  info(`Adding a XHR breakpoint for pattern ${text} and method ${method}`);
+
+  const plusIcon = findElementWithSelector(dbg, ".xhr-breakpoints-pane .plus");
+  if (plusIcon) {
+    plusIcon.click();
+  }
+  findElementWithSelector(dbg, ".xhr-input-url").focus();
+  type(dbg, text);
+
+  if (method) {
+    findElementWithSelector(dbg, ".xhr-input-method").value = method;
+  }
+
+  pressKey(dbg, "Enter");
+
+  await waitForDispatch(dbg, "SET_XHR_BREAKPOINT");
+}
+
+async function removeXHRBreakpoint(dbg, index) {
+  info("Removing a XHR breakpoint");
+
+  const closeButtons = dbg.win.document.querySelectorAll(
+    ".xhr-breakpoints-pane .close-btn"
+  );
+  if (closeButtons[index]) {
+    closeButtons[index].click();
+  }
+
+  await waitForDispatch(dbg, "REMOVE_XHR_BREAKPOINT");
+}
+
+function getXHRBreakpointsElements(dbg) {
+  return [
+    ...dbg.win.document.querySelectorAll(".xhr-breakpoints-pane .xhr-container")
+  ];
+}
+
+function getXHRBreakpointLabels(elements) {
+  return elements.map(element => element.title);
+}
+
+function getXHRBreakpointCheckbox(dbg) {
+  return findElementWithSelector(
+    dbg,
+    ".xhr-breakpoints-pane .breakpoints-exceptions input"
+  );
+}
+
+async function clickPauseOnAny(dbg, expectedEvent) {
+  getXHRBreakpointCheckbox(dbg).click();
+  await waitForDispatch(dbg, expectedEvent);
+}
--- a/devtools/client/debugger/test/mochitest/head.js
+++ b/devtools/client/debugger/test/mochitest/head.js
@@ -1,10 +1,11 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
+/* 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/>. */
 
 /**
  * The Mochitest API documentation
  * @module mochitest
  */
 
 /**
  * The mochitest API to wait for certain events.
--- a/devtools/client/debugger/test/mochitest/helpers.js
+++ b/devtools/client/debugger/test/mochitest/helpers.js
@@ -10,18 +10,18 @@
 
 // Import helpers for the new debugger
 Services.scriptloader.loadSubScript(
   "chrome://mochitests/content/browser/devtools/client/debugger/test/mochitest/helpers/context.js",
   this
 );
 
 var { Toolbox } = require("devtools/client/framework/toolbox");
-var { Task } = require("devtools/shared/task");
-var asyncStorage = require("devtools/shared/async-storage");
+const { Task } = require("devtools/shared/task");
+const asyncStorage = require("devtools/shared/async-storage");
 
 const {
   getSelectedLocation,
 } = require("devtools/client/debugger/src/utils/selected-location");
 
 const {
   resetSchemaVersion,
 } = require("devtools/client/debugger/src/utils/prefs");