Bug 1463128 - Add setInputValue/getInputValue helper in console head.js;r=Honza.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Wed, 27 Feb 2019 10:09:00 +0000
changeset 519306 3991d2150835c782c7e09178906296ac63b794e5
parent 519305 441b5e03251699acc13c2a57a66e100d2ac66cd5
child 519307 63ca9c12292c99d7c54d9078d30ed195ae44c67d
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1463128
milestone67.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 1463128 - Add setInputValue/getInputValue helper in console head.js;r=Honza. This abstracts the most used console input functions, and might make it easier to refactor things in the future. Differential Revision: https://phabricator.services.mozilla.com/D20684
devtools/client/webconsole/test/mochitest/browser_jsterm_add_edited_input_to_history.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_accept_no_scroll.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_array_no_index.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_arrow_keys.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_await.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_cached_results.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_commands.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_control_space.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_crossdomain_iframe.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_escape_key.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_helpers.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_inside_text.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_native_getters.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_nav_and_tab_key.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_paste_undo.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key_no_selection.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_will_navigate.js
devtools/client/webconsole/test/mochitest/browser_jsterm_completion.js
devtools/client/webconsole/test/mochitest/browser_jsterm_completion_bracket.js
devtools/client/webconsole/test/mochitest/browser_jsterm_completion_bracket_cached_results.js
devtools/client/webconsole/test/mochitest/browser_jsterm_completion_case_sensitivity.js
devtools/client/webconsole/test/mochitest/browser_jsterm_ctrl_a_select_all.js
devtools/client/webconsole/test/mochitest/browser_jsterm_ctrl_key_nav.js
devtools/client/webconsole/test/mochitest/browser_jsterm_history.js
devtools/client/webconsole/test/mochitest/browser_jsterm_history_arrow_keys.js
devtools/client/webconsole/test/mochitest/browser_jsterm_history_nav.js
devtools/client/webconsole/test/mochitest/browser_jsterm_history_persist.js
devtools/client/webconsole/test/mochitest/browser_jsterm_middle_click_paste.js
devtools/client/webconsole/test/mochitest/browser_jsterm_multiline.js
devtools/client/webconsole/test/mochitest/browser_jsterm_no_input_and_tab_key_pressed.js
devtools/client/webconsole/test/mochitest/browser_jsterm_popup_close_on_tab_switch.js
devtools/client/webconsole/test/mochitest/browser_jsterm_selfxss.js
devtools/client/webconsole/test/mochitest/browser_webconsole_context_menu_store_as_global.js
devtools/client/webconsole/test/mochitest/browser_webconsole_in_line_layout.js
devtools/client/webconsole/test/mochitest/browser_webconsole_reverse_search.js
devtools/client/webconsole/test/mochitest/browser_webconsole_reverse_search_initial_value.js
devtools/client/webconsole/test/mochitest/browser_webconsole_reverse_search_keyboard_navigation.js
devtools/client/webconsole/test/mochitest/browser_webconsole_reverse_search_mouse_navigation.js
devtools/client/webconsole/test/mochitest/head.js
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_add_edited_input_to_history.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_add_edited_input_to_history.js
@@ -19,52 +19,52 @@ add_task(async function() {
   await pushPref("devtools.webconsole.jsterm.codeMirror", true);
   await performTests();
 });
 
 async function performTests() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const {jsterm} = hud;
 
-  ok(!jsterm.getInputValue(), "jsterm.getInputValue() is empty");
+  ok(!getInputValue(hud), "console input is empty");
   checkInputCursorPosition(hud, 0, "Cursor is at expected position");
 
-  jsterm.setInputValue('"first item"');
+  setInputValue(hud, '"first item"');
   EventUtils.synthesizeKey("KEY_ArrowUp");
-  is(jsterm.getInputValue(), '"first item"', "null test history up");
+  is(getInputValue(hud), '"first item"', "null test history up");
   EventUtils.synthesizeKey("KEY_ArrowDown");
-  is(jsterm.getInputValue(), '"first item"', "null test history down");
+  is(getInputValue(hud), '"first item"', "null test history down");
 
   await jsterm.execute();
-  is(jsterm.getInputValue(), "", "cleared input line after submit");
+  is(getInputValue(hud), "", "cleared input line after submit");
 
-  jsterm.setInputValue('"editing input 1"');
+  setInputValue(hud, '"editing input 1"');
   EventUtils.synthesizeKey("KEY_ArrowUp");
-  is(jsterm.getInputValue(), '"first item"', "test history up");
+  is(getInputValue(hud), '"first item"', "test history up");
   EventUtils.synthesizeKey("KEY_ArrowDown");
-  is(jsterm.getInputValue(), '"editing input 1"',
+  is(getInputValue(hud), '"editing input 1"',
     "test history down restores in-progress input");
 
-  jsterm.setInputValue('"second item"');
+  setInputValue(hud, '"second item"');
   await jsterm.execute();
-  jsterm.setInputValue('"editing input 2"');
+  setInputValue(hud, '"editing input 2"');
   EventUtils.synthesizeKey("KEY_ArrowUp");
-  is(jsterm.getInputValue(), '"second item"', "test history up");
+  is(getInputValue(hud), '"second item"', "test history up");
   EventUtils.synthesizeKey("KEY_ArrowUp");
-  is(jsterm.getInputValue(), '"first item"', "test history up");
+  is(getInputValue(hud), '"first item"', "test history up");
   EventUtils.synthesizeKey("KEY_ArrowDown");
-  is(jsterm.getInputValue(), '"second item"', "test history down");
+  is(getInputValue(hud), '"second item"', "test history down");
   EventUtils.synthesizeKey("KEY_ArrowDown");
-  is(jsterm.getInputValue(), '"editing input 2"',
+  is(getInputValue(hud), '"editing input 2"',
      "test history down restores new in-progress input again");
 
   // Appending the same value again should not impact the history.
   // Let's also use some spaces around to check that the input value
   // is properly trimmed.
   await jsterm.execute('"second item"');
   await jsterm.execute('  "second item"    ');
   EventUtils.synthesizeKey("KEY_ArrowUp");
-  is(jsterm.getInputValue(), '"second item"',
+  is(getInputValue(hud), '"second item"',
     "test history up reaches duplicated entry just once");
   EventUtils.synthesizeKey("KEY_ArrowUp");
-  is(jsterm.getInputValue(), '"first item"',
+  is(getInputValue(hud), '"first item"',
     "test history up reaches the previous value");
 }
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_accept_no_scroll.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_accept_no_scroll.js
@@ -17,36 +17,37 @@ const TEST_URI = `data:text/html;charset
       item1: "value1",
     }));
   </script>`;
 
 add_task(async function() {
   // Only run test with legacy JsTerm.
   await pushPref("devtools.webconsole.jsterm.codeMirror", false);
 
-  const { jsterm, ui } = await openNewTabAndConsole(TEST_URI);
+  const hud = await openNewTabAndConsole(TEST_URI);
+  const { jsterm, ui } = hud;
   const { autocompletePopup: popup } = jsterm;
 
   info("Insert multiple new lines so the input overflows");
   const onPopUpOpen = popup.once("popup-opened");
   const lines = "\n".repeat(200);
-  jsterm.setInputValue(lines);
+  setInputValue(hud, lines);
 
   info("Fire the autocompletion popup");
   EventUtils.sendString("window.foobar.");
 
   await onPopUpOpen;
 
   const inputContainer = ui.window.document.querySelector(".jsterm-input-container");
   ok(inputContainer.scrollTop > 0, "The input overflows");
   const scrollTop = inputContainer.scrollTop;
 
   info("Hit Enter to accept the autocompletion");
   const onPopupClose = popup.once("popup-closed");
   EventUtils.synthesizeKey("KEY_Enter");
   await onPopupClose;
 
   ok(!popup.isOpen, "popup is not open after KEY_Enter");
-  is(jsterm.getInputValue(), lines + "window.foobar.item0",
+  is(getInputValue(hud), lines + "window.foobar.item0",
     "completion was successful after KEY_Enter");
   is(inputContainer.scrollTop, scrollTop,
     "The scrolling position stayed the same when accepting the completion");
 });
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_array_no_index.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_array_no_index.js
@@ -20,26 +20,25 @@ add_task(async function() {
   await pushPref("devtools.webconsole.jsterm.codeMirror", false);
   await performTests();
   // And then run it with the CodeMirror-powered one.
   await pushPref("devtools.webconsole.jsterm.codeMirror", true);
   await performTests();
 });
 
 async function performTests() {
-  const { jsterm } = await openNewTabAndConsole(TEST_URI);
-
+  const hud = await openNewTabAndConsole(TEST_URI);
   const {
     autocompletePopup: popup,
-  } = jsterm;
+  } = hud.jsterm;
 
   const onPopUpOpen = popup.once("popup-opened");
 
   info("wait for popup to show");
-  jsterm.setInputValue("foo");
+  setInputValue(hud, "foo");
   EventUtils.sendString(".");
 
   await onPopUpOpen;
 
   const popupItems = popup.getItems().map(e => e.label);
   is(popupItems.includes("0"), false, "Completing on an array doesn't show numbers.");
 
   info("press Escape to close the popup");
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_arrow_keys.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_arrow_keys.js
@@ -28,17 +28,17 @@ async function performTests() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
   const { autocompletePopup: popup } = jsterm;
 
   const checkInput = (expected, assertionInfo) =>
     checkInputValueAndCursorPosition(hud, expected, assertionInfo);
 
   let onPopUpOpen = popup.once("popup-opened");
-  jsterm.setInputValue("window.foo");
+  setInputValue(hud, "window.foo");
   EventUtils.sendString(".");
   await onPopUpOpen;
 
   info("Trigger autocomplete popup opening");
   // checkInput is asserting the cursor position with the "|" char.
   checkInput("window.foo.|");
   is(popup.isOpen, true, "popup is open");
   checkInputCompletionValue(hud, "           aa", "completeNode has expected value");
@@ -48,17 +48,17 @@ async function performTests() {
   EventUtils.synthesizeKey("KEY_ArrowLeft");
   await onPopUpClose;
   checkInput("window.foo|.");
   is(popup.isOpen, false, "popup is closed");
   checkInputCompletionValue(hud, "", "completeNode is empty");
 
   info("Trigger autocomplete popup opening again");
   onPopUpOpen = popup.once("popup-opened");
-  jsterm.setInputValue("window.foo");
+  setInputValue(hud, "window.foo");
   EventUtils.sendString(".");
   await onPopUpOpen;
 
   checkInput("window.foo.|");
   is(popup.isOpen, true, "popup is open");
   checkInputCompletionValue(hud, "           aa", "completeNode has expected value");
 
   info("Test that arrow right selects selected autocomplete item");
@@ -66,33 +66,33 @@ async function performTests() {
   EventUtils.synthesizeKey("KEY_ArrowRight");
   await onPopUpClose;
   checkInput("window.foo.aa|");
   is(popup.isOpen, false, "popup is closed");
   checkInputCompletionValue(hud, "", "completeNode is empty");
 
   info("Test that Ctrl/Cmd + Left removes complete node");
   await setInputValueForAutocompletion(hud, "window.foo.a");
-  const prefix = jsterm.getInputValue().replace(/[\S]/g, " ");
+  const prefix = getInputValue(hud).replace(/[\S]/g, " ");
   checkInputCompletionValue(hud, prefix + "a", "completeNode has expected value");
 
   const isOSX = Services.appinfo.OS == "Darwin";
   EventUtils.synthesizeKey("KEY_ArrowLeft", {
     [isOSX ? "metaKey" : "ctrlKey"]: true,
   });
   checkInputCompletionValue(hud, "",
     "completeNode was cleared after Ctrl/Cmd + left");
 
   info("Test that Ctrl/Cmd + Right closes the popup if there's text after cursor");
-  jsterm.setInputValue(".");
+  setInputValue(hud, ".");
   EventUtils.synthesizeKey("KEY_ArrowLeft");
   onPopUpOpen = popup.once("popup-opened");
   EventUtils.sendString("win");
   await onPopUpOpen;
   ok(popup.isOpen, "popup is open");
 
   onPopUpClose = popup.once("popup-closed");
   EventUtils.synthesizeKey("KEY_ArrowRight", {
     [isOSX ? "metaKey" : "ctrlKey"]: true,
   });
   await onPopUpClose;
-  is(jsterm.getInputValue(), "win.", "input value wasn't modified");
+  is(getInputValue(hud), "win.", "input value wasn't modified");
 }
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_await.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_await.js
@@ -23,17 +23,17 @@ async function performTests() {
   const { jsterm } = hud;
   const { autocompletePopup } = jsterm;
 
   info("Check that the await keyword is in the autocomplete");
   await setInputValueForAutocompletion(hud, "aw");
   checkInputCompletionValue(hud, "  ait", "completeNode has expected value");
 
   EventUtils.synthesizeKey("KEY_Tab");
-  is(jsterm.getInputValue(), "await", "'await' tab completion");
+  is(getInputValue(hud), "await", "'await' tab completion");
 
   const updated = jsterm.once("autocomplete-updated");
   EventUtils.sendString(" ");
   await updated;
 
   info("Check that the autocomplete popup is displayed");
   const onPopUpOpen = autocompletePopup.once("popup-opened");
   EventUtils.sendString("P");
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_cached_results.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_cached_results.js
@@ -23,17 +23,17 @@ async function performTests() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
   const { autocompletePopup: popup } = jsterm;
 
   const jstermComplete = (value, pos) => setInputValueForAutocompletion(hud, value, pos);
 
   // Test if 'doc' gives 'document'
   await jstermComplete("doc");
-  is(jsterm.getInputValue(), "doc", "'docu' completion (input.value)");
+  is(getInputValue(hud), "doc", "'docu' completion (input.value)");
   checkInputCompletionValue(hud, "   ument", "'docu' completion (completeNode)");
 
   // Test typing 'window.'.'
   await jstermComplete("window.");
   ok(popup.getItems().length > 0, "'window.' gave a list of suggestions");
 
   info("Add a property on the window object");
   await ContentTask.spawn(gBrowser.selectedBrowser, {}, () => {
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_commands.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_commands.js
@@ -35,27 +35,27 @@ async function performTests() {
 
   let onAutocompleUpdated = jsterm.once("autocomplete-updated");
   EventUtils.sendString("s");
   await onAutocompleUpdated;
   checkInputCompletionValue(hud, "  creenshot",
     "completion node has expected :screenshot value");
 
   EventUtils.synthesizeKey("KEY_Tab");
-  is(jsterm.getInputValue(), ":screenshot", "Tab key correctly completed :screenshot");
+  is(getInputValue(hud), ":screenshot", "Tab key correctly completed :screenshot");
 
   ok(!autocompletePopup.isOpen, "popup is closed after Tab");
 
   info("Test :hel completion");
-  jsterm.setInputValue(":he");
+  setInputValue(hud, ":he");
   onAutocompleUpdated = jsterm.once("autocomplete-updated");
   EventUtils.sendString("l");
 
   await onAutocompleUpdated;
   checkInputCompletionValue(hud, "    p", "completion node has expected :help value");
 
   EventUtils.synthesizeKey("KEY_Tab");
-  is(jsterm.getInputValue(), ":help", "Tab key correctly completes :help");
+  is(getInputValue(hud), ":help", "Tab key correctly completes :help");
 }
 
 function getPopupItems(popup) {
   return popup.items.map(item => item.label);
 }
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_control_space.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_control_space.js
@@ -25,25 +25,25 @@ add_task(async function() {
   await pushPref("devtools.webconsole.jsterm.codeMirror", false);
   await performTests();
   // And then run it with the CodeMirror-powered one.
   await pushPref("devtools.webconsole.jsterm.codeMirror", true);
   // await performTests();
 });
 
 async function performTests() {
-  const { jsterm } = await openNewTabAndConsole(TEST_URI);
+  const hud = await openNewTabAndConsole(TEST_URI);
   info("web console opened");
 
-  const { autocompletePopup: popup } = jsterm;
+  const { autocompletePopup: popup } = hud.jsterm;
 
   let onPopUpOpen = popup.once("popup-opened");
 
   info("wait for completion: window.foo.");
-  jsterm.setInputValue("window.foo");
+  setInputValue(hud, "window.foo");
   EventUtils.sendString(".");
 
   await onPopUpOpen;
 
   const {itemCount} = popup;
   ok(popup.isOpen, "popup is open");
   ok(itemCount > 0, "popup has items");
 
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_crossdomain_iframe.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_crossdomain_iframe.js
@@ -24,21 +24,21 @@ async function performTests() {
 
   const onParentTitle = waitForMessage(hud, "iframe parent");
   jsterm.execute("document.title");
   await onParentTitle;
   ok(true, "root document's title is accessible");
 
   // Make sure we don't throw when trying to autocomplete
   const autocompleteUpdated = hud.jsterm.once("autocomplete-updated");
-  jsterm.setInputValue("window[0].document");
+  setInputValue(hud, "window[0].document");
   EventUtils.sendString(".");
   await autocompleteUpdated;
 
-  hud.jsterm.setInputValue("window[0].document.title");
+  setInputValue(hud, "window[0].document.title");
   const onPermissionDeniedMessage = waitForMessage(hud, "Permission denied");
   EventUtils.synthesizeKey("KEY_Enter");
   const permissionDenied = await onPermissionDeniedMessage;
   ok(permissionDenied.node.classList.contains("error"),
     "A message error is shown when trying to inspect window[0]");
 
   const onParentLocation = waitForMessage(hud, "test-iframe-parent.html");
   hud.jsterm.execute("window.location");
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_escape_key.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_escape_key.js
@@ -36,26 +36,26 @@ async function performTests() {
   const { jsterm } = hud;
   info("web console opened");
 
   const { autocompletePopup: popup } = jsterm;
 
   const onPopUpOpen = popup.once("popup-opened");
 
   info("wait for completion: window.foo.");
-  jsterm.setInputValue("window.foo");
+  setInputValue(hud, "window.foo");
   EventUtils.sendString(".");
 
   await onPopUpOpen;
 
   ok(popup.isOpen, "popup is open");
   ok(popup.itemCount, "popup has items");
 
   info("press Escape to close the popup");
   const onPopupClose = popup.once("popup-closed");
   EventUtils.synthesizeKey("KEY_Escape");
 
   await onPopupClose;
 
   ok(!popup.isOpen, "popup is not open after VK_ESCAPE");
-  is(jsterm.getInputValue(), "window.foo.", "completion was cancelled");
+  is(getInputValue(hud), "window.foo.", "completion was cancelled");
   ok(!getInputCompletionValue(hud), "completeNode is empty");
 }
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_helpers.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_helpers.js
@@ -15,25 +15,26 @@ add_task(async function() {
   await pushPref("devtools.webconsole.jsterm.codeMirror", false);
   await performTests();
   // And then run it with the CodeMirror-powered one.
   await pushPref("devtools.webconsole.jsterm.codeMirror", true);
   await performTests();
 });
 
 async function performTests() {
-  const {jsterm} = await openNewTabAndConsole(TEST_URI);
-  await testInspectAutoCompletion(jsterm, "i", true);
-  await testInspectAutoCompletion(jsterm, "window.", false);
-  await testInspectAutoCompletion(jsterm, "dump(i", true);
-  await testInspectAutoCompletion(jsterm, "window.dump(i", true);
+  const hud = await openNewTabAndConsole(TEST_URI);
+  await testInspectAutoCompletion(hud, "i", true);
+  await testInspectAutoCompletion(hud, "window.", false);
+  await testInspectAutoCompletion(hud, "dump(i", true);
+  await testInspectAutoCompletion(hud, "window.dump(i", true);
 }
 
-async function testInspectAutoCompletion(jsterm, inputValue, expectInspect) {
-  jsterm.setInputValue("");
+async function testInspectAutoCompletion(hud, inputValue, expectInspect) {
+  setInputValue(hud, "");
+  const {jsterm} = hud;
   jsterm.focus();
   const updated = jsterm.once("autocomplete-updated");
   EventUtils.sendString(inputValue);
   await updated;
   is(getPopupItemsLabel(jsterm.autocompletePopup).includes("inspect"), expectInspect,
     `autocomplete results${expectInspect ? "" : " does not"} contain helper 'inspect'`);
 }
 
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_inside_text.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_inside_text.js
@@ -80,17 +80,17 @@ async function performTests() {
   await onPopupClose;
 
   ok(!popup.isOpen, "popup is not open");
   checkInputValueAndCursorPosition(hud, "dump(window.testBugAA|)",
     "completion was successful after Enter");
   ok(!getInputCompletionValue(hud), "there is no completion text");
 
   info("Test autocomplete inside parens");
-  jsterm.setInputValue("dump()");
+  setInputValue(hud, "dump()");
   EventUtils.synthesizeKey("KEY_ArrowLeft");
   let onAutocompleteUpdated = jsterm.once("autocomplete-updated");
   EventUtils.sendString("window.testBugA");
   await onAutocompleteUpdated;
   ok(popup.isOpen, "popup is open");
   ok(!getInputCompletionValue(hud), "there is no completion text");
 
   info("Matching the completion proposal should close the popup");
@@ -106,48 +106,48 @@ async function performTests() {
   checkInputValueAndCursorPosition(hud, "dump(window.testBugAA\t|)",
     "completion was successful after Enter");
 
   info("Check that we don't show the popup when editing words");
   await setInputValueForAutocompletion(hud, "estBug", 0);
   onAutocompleteUpdated = jsterm.once("autocomplete-updated");
   EventUtils.sendString("t");
   await onAutocompleteUpdated;
-  is(jsterm.getInputValue(), "testBug", "jsterm has expected value");
+  is(getInputValue(hud), "testBug", "jsterm has expected value");
   is(popup.isOpen, false, "popup is not open");
   ok(!getInputCompletionValue(hud), "there is no completion text");
 
   await setInputValueForAutocompletion(hud, "__foo", 1);
   onAutocompleteUpdated = jsterm.once("autocomplete-updated");
   EventUtils.sendString("t");
   await onAutocompleteUpdated;
-  is(jsterm.getInputValue(), "_t_foo", "jsterm has expected value");
+  is(getInputValue(hud), "_t_foo", "jsterm has expected value");
   is(popup.isOpen, false, "popup is not open");
   ok(!getInputCompletionValue(hud), "there is no completion text");
 
   await setInputValueForAutocompletion(hud, "$$bar", 1);
   onAutocompleteUpdated = jsterm.once("autocomplete-updated");
   EventUtils.sendString("t");
   await onAutocompleteUpdated;
-  is(jsterm.getInputValue(), "$t$bar", "jsterm has expected value");
+  is(getInputValue(hud), "$t$bar", "jsterm has expected value");
   is(popup.isOpen, false, "popup is not open");
   ok(!getInputCompletionValue(hud), "there is no completion text");
 
   await setInputValueForAutocompletion(hud, "99luftballons", 1);
   onAutocompleteUpdated = jsterm.once("autocomplete-updated");
   EventUtils.sendString("t");
   await onAutocompleteUpdated;
-  is(jsterm.getInputValue(), "9t9luftballons", "jsterm has expected value");
+  is(getInputValue(hud), "9t9luftballons", "jsterm has expected value");
   is(popup.isOpen, false, "popup is not open");
   ok(!getInputCompletionValue(hud), "there is no completion text");
 }
 
 async function setInitialState(hud) {
   const {jsterm} = hud;
   jsterm.focus();
-  jsterm.setInputValue("dump()");
+  setInputValue(hud, "dump()");
   EventUtils.synthesizeKey("KEY_ArrowLeft");
 
   const onPopUpOpen = jsterm.autocompletePopup.once("popup-opened");
   EventUtils.sendString("window.testB");
   checkInputValueAndCursorPosition(hud, "dump(window.testB|)");
   await onPopUpOpen;
 }
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_native_getters.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_native_getters.js
@@ -23,17 +23,17 @@ async function performTests() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm, ui } = hud;
 
   const { autocompletePopup: popup } = jsterm;
 
   ok(!popup.isOpen, "popup is not open");
   const onPopupOpen = popup.once("popup-opened");
 
-  jsterm.setInputValue("document.body");
+  setInputValue(hud, "document.body");
   EventUtils.sendString(".");
 
   await onPopupOpen;
 
   ok(popup.isOpen, "popup is open");
   const cacheMatches = ui.wrapper.getStore().getState().autocomplete.cache.matches;
   is(popup.itemCount, cacheMatches.length, "popup.itemCount is correct");
   ok(cacheMatches.includes("addEventListener"),
@@ -45,17 +45,17 @@ async function performTests() {
   const onPopupClose = popup.once("popup-closed");
   EventUtils.synthesizeKey("KEY_Escape");
 
   await onPopupClose;
 
   ok(!popup.isOpen, "popup is not open");
   const onAutoCompleteUpdated = jsterm.once("autocomplete-updated");
   const inputStr = "document.b";
-  jsterm.setInputValue(inputStr);
+  setInputValue(hud, inputStr);
   EventUtils.sendString("o");
 
   await onAutoCompleteUpdated;
 
   // Build the spaces that are placed in the input to place the autocompletion result at
   // the expected spot:
   // > document.bo        <-- input
   // > -----------dy      <-- autocomplete
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_nav_and_tab_key.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_nav_and_tab_key.js
@@ -37,17 +37,17 @@ async function performTests() {
   const { jsterm } = hud;
   info("web console opened");
 
   const { autocompletePopup: popup } = jsterm;
 
   ok(!popup.isOpen, "popup is not open");
 
   const onPopUpOpen = popup.once("popup-opened");
-  jsterm.setInputValue("window.foo");
+  setInputValue(hud, "window.foo");
 
   // Shows the popup
   EventUtils.sendString(".");
   await onPopUpOpen;
 
   ok(popup.isOpen, "popup is open");
 
   const popupItems = popup.getItems().map(e => e.label);
@@ -60,17 +60,17 @@ async function performTests() {
 
   is(popup.itemCount, expectedPopupItems.length, "popup.itemCount is correct");
   is(popupItems.join("-"), expectedPopupItems.join("-"),
     "getItems returns the items we expect");
   is(popup.selectedIndex, 0, "Index of the first item is selected.");
 
   EventUtils.synthesizeKey("KEY_ArrowUp");
 
-  let prefix = jsterm.getInputValue().replace(/[\S]/g, " ");
+  let prefix = getInputValue(hud).replace(/[\S]/g, " ");
   is(popup.selectedIndex, 3, "index 3 is selected");
   is(popup.selectedItem.label, "item3", "item3 is selected");
   checkInputCompletionValue(hud, prefix + "item3", "completeNode.value holds item3");
 
   EventUtils.synthesizeKey("KEY_ArrowUp");
 
   is(popup.selectedIndex, 2, "index 2 is selected");
   is(popup.selectedItem.label, "item2", "item2 is selected");
@@ -100,26 +100,26 @@ async function performTests() {
   info("press Tab and wait for popup to hide");
   const onPopupClose = popup.once("popup-closed");
   EventUtils.synthesizeKey("KEY_Tab");
 
   await onPopupClose;
 
   // At this point the completion suggestion should be accepted.
   ok(!popup.isOpen, "popup is not open");
-  is(jsterm.getInputValue(), "window.foo.item3",
+  is(getInputValue(hud), "window.foo.item3",
      "completion was successful after KEY_Tab");
   ok(!getInputCompletionValue(hud), "completeNode is empty");
 
   info("Check that hitting Home hides the completion text when the popup is hidden");
   await setInputValueForAutocompletion(hud, "window.foo.item0");
-  prefix = jsterm.getInputValue().replace(/[\S]/g, " ");
+  prefix = getInputValue(hud).replace(/[\S]/g, " ");
   checkInputCompletionValue(hud, prefix + "0", "completeNode has expected value");
   EventUtils.synthesizeKey("KEY_Home");
   checkInputCompletionValue(hud, "", "completeNode was cleared after hitting Home");
 
   info("Check that hitting End hides the completion text when the popup is hidden");
   await setInputValueForAutocompletion(hud, "window.foo.item0");
-  prefix = jsterm.getInputValue().replace(/[\S]/g, " ");
+  prefix = getInputValue(hud).replace(/[\S]/g, " ");
   checkInputCompletionValue(hud, prefix + "0", "completeNode has expected value");
   EventUtils.synthesizeKey("KEY_End");
   checkInputCompletionValue(hud, "", "completeNode was cleared after hitting End");
 }
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_paste_undo.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_paste_undo.js
@@ -25,30 +25,30 @@ add_task(async function() {
 });
 
 async function performTests() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const {jsterm, ui} = hud;
   ui.clearOutput();
   ok(!getInputCompletionValue(hud), "no completeNode.value");
 
-  jsterm.setInputValue("doc");
+  setInputValue(hud, "doc");
 
   info("wait for completion value after typing 'docu'");
   let onAutocompleteUpdated = jsterm.once("autocomplete-updated");
   EventUtils.sendString("u");
   await onAutocompleteUpdated;
 
   const completionValue = getInputCompletionValue(hud);
 
   info(`Copy "${stringToCopy}" in clipboard`);
   await waitForClipboardPromise(() =>
     clipboardHelper.copyString(stringToCopy), stringToCopy);
 
-  jsterm.setInputValue("docu");
+  setInputValue(hud, "docu");
   info("wait for completion update after clipboard paste");
   onAutocompleteUpdated = jsterm.once("autocomplete-updated");
   EventUtils.synthesizeKey("v", {accelKey: true});
 
   await onAutocompleteUpdated;
 
   ok(!getInputCompletionValue(hud), "no completion value after paste");
 
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key.js
@@ -38,17 +38,17 @@ async function performTests() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
   const { autocompletePopup: popup } = jsterm;
 
   let onPopUpOpen = popup.once("popup-opened");
 
   info("wait for completion suggestions: window.foobar.");
 
-  jsterm.setInputValue("window.fooba");
+  setInputValue(hud, "window.fooba");
   EventUtils.sendString("r.");
 
   await onPopUpOpen;
 
   ok(popup.isOpen, "popup is open");
 
   const expectedPopupItems = [
     "item0",
@@ -59,40 +59,40 @@ async function performTests() {
   ];
   is(popup.itemCount, expectedPopupItems.length, "popup.itemCount is correct");
   is(popup.selectedIndex, 0, "First index from top is selected");
 
   EventUtils.synthesizeKey("KEY_ArrowUp");
 
   is(popup.selectedIndex, expectedPopupItems.length - 1, "last index is selected");
   is(popup.selectedItem.label, "item33", "item33 is selected");
-  const prefix = jsterm.getInputValue().replace(/[\S]/g, " ");
+  const prefix = getInputValue(hud).replace(/[\S]/g, " ");
   checkInputCompletionValue(hud, prefix + "item33", "completeNode.value holds item33");
 
   info("press Return to accept suggestion. wait for popup to hide");
   let onPopupClose = popup.once("popup-closed");
   EventUtils.synthesizeKey("KEY_Enter");
 
   await onPopupClose;
 
   ok(!popup.isOpen, "popup is not open after KEY_Enter");
-  is(jsterm.getInputValue(), "window.foobar.item33",
+  is(getInputValue(hud), "window.foobar.item33",
     "completion was successful after KEY_Enter");
   ok(!getInputCompletionValue(hud), "completeNode is empty");
 
   info("Test that hitting enter when the completeNode is empty closes the popup");
   onPopUpOpen = popup.once("popup-opened");
   info("wait for completion suggestions: window.foobar.item3");
-  jsterm.setInputValue("window.foobar.item");
+  setInputValue(hud, "window.foobar.item");
   EventUtils.sendString("3");
   await onPopUpOpen;
 
   is(popup.selectedItem.label, "item3", "item3 is selected");
   ok(!getInputCompletionValue(hud), "completeNode is empty");
 
   onPopupClose = popup.once("popup-closed");
   EventUtils.synthesizeKey("KEY_Enter");
   await onPopupClose;
 
   ok(!popup.isOpen, "popup is not open after KEY_Enter");
-  is(jsterm.getInputValue(), "window.foobar.item3",
+  is(getInputValue(hud), "window.foobar.item3",
     "completion was successful after KEY_Enter");
 }
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key_no_selection.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key_no_selection.js
@@ -36,34 +36,34 @@ async function performTests() {
     ui,
   } = hud;
 
   const { autocompletePopup: popup } = jsterm;
 
   const onPopUpOpen = popup.once("popup-opened");
 
   info("wait for popup to show");
-  jsterm.setInputValue("window.testBu");
+  setInputValue(hud, "window.testBu");
   EventUtils.sendString("g");
 
   await onPopUpOpen;
 
   ok(popup.isOpen, "popup is open");
   is(popup.itemCount, 2, "popup.itemCount is correct");
   isnot(popup.selectedIndex, -1, "popup.selectedIndex is correct");
 
   info("press Return and wait for popup to hide");
   const onPopUpClose = popup.once("popup-closed");
   EventUtils.synthesizeKey("KEY_Enter");
   await onPopUpClose;
 
   ok(!popup.isOpen, "popup is not open after KEY_Enter");
-  is(jsterm.getInputValue(), "window.testBugA",
+  is(getInputValue(hud), "window.testBugA",
     "input was completed with the first item of the popup");
   ok(!getInputCompletionValue(hud), "completeNode is empty");
 
   EventUtils.synthesizeKey("KEY_Enter");
-  is(jsterm.getInputValue(), "", "input is empty after KEY_Enter");
+  is(getInputValue(hud), "", "input is empty after KEY_Enter");
 
   const state = ui.wrapper.getStore().getState();
   const entries = getHistoryEntries(state);
   is(entries[entries.length - 1], "window.testBugA", "jsterm history is correct");
 }
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_will_navigate.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_will_navigate.js
@@ -35,25 +35,25 @@ async function performTests() {
   const { jsterm } = hud;
   info("web console opened");
 
   const { autocompletePopup: popup } = jsterm;
 
   const onPopUpOpen = popup.once("popup-opened");
 
   info("wait for completion: window.foo.");
-  jsterm.setInputValue("window.foo");
+  setInputValue(hud, "window.foo");
   EventUtils.sendString(".");
 
   await onPopUpOpen;
 
   ok(popup.isOpen, "popup is open");
   ok(popup.itemCount, "popup has items");
 
   info("reload the page to close the popup");
   const onPopupClose = popup.once("popup-closed");
   await refreshTab();
   await onPopupClose;
 
   ok(!popup.isOpen, "popup is not open after reloading the page");
-  is(jsterm.getInputValue(), "window.foo.", "completion was cancelled");
+  is(getInputValue(hud), "window.foo.", "completion was cancelled");
   ok(!getInputCompletionValue(hud), "completeNode is empty");
 }
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_completion.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_completion.js
@@ -23,76 +23,76 @@ add_task(async function() {
 
 async function performTests() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const {jsterm, ui} = hud;
   const {autocompletePopup} = jsterm;
 
   // Test typing 'docu'.
   await setInputValueForAutocompletion(hud, "foob");
-  is(jsterm.getInputValue(), "foob", "'foob' completion (input.value)");
+  is(getInputValue(hud), "foob", "'foob' completion (input.value)");
   checkInputCompletionValue(hud, "    ar", "'foob' completion (completeNode)");
   is(autocompletePopup.items.length, 1, "autocomplete popup has 1 item");
   is(autocompletePopup.isOpen, false, "autocomplete popup is not open");
 
   // Test typing 'docu' and press tab.
   EventUtils.synthesizeKey("KEY_Tab");
-  is(jsterm.getInputValue(), "foobar", "'foob' tab completion");
+  is(getInputValue(hud), "foobar", "'foob' tab completion");
 
   checkInputCursorPosition(hud, "foobar".length, "cursor is at the end of 'foobar'");
   is(getInputCompletionValue(hud).replace(/ /g, ""), "", "'foob' completed");
 
   // Test typing 'window.Ob' and press tab.  Just 'window.O' is
   // ambiguous: could be window.Object, window.Option, etc.
   await setInputValueForAutocompletion(hud, "window.Ob");
   EventUtils.synthesizeKey("KEY_Tab");
-  is(jsterm.getInputValue(), "window.Object", "'window.Ob' tab completion");
+  is(getInputValue(hud), "window.Object", "'window.Ob' tab completion");
 
   // Test typing 'document.getElem'.
   const onPopupOpened = autocompletePopup.once("popup-opened");
   await setInputValueForAutocompletion(hud, "document.getElem");
-  is(jsterm.getInputValue(), "document.getElem", "'document.getElem' completion");
+  is(getInputValue(hud), "document.getElem", "'document.getElem' completion");
   checkInputCompletionValue(hud, "                entById",
      "'document.getElem' completion");
 
   // Test pressing key down.
   await onPopupOpened;
   EventUtils.synthesizeKey("KEY_ArrowDown");
-  is(jsterm.getInputValue(), "document.getElem", "'document.getElem' completion");
+  is(getInputValue(hud), "document.getElem", "'document.getElem' completion");
   checkInputCompletionValue(hud, "                entsByClassName",
      "'document.getElem' another tab completion");
 
   // Test pressing key up.
   EventUtils.synthesizeKey("KEY_ArrowUp");
   await waitFor(() => (getInputCompletionValue(hud) || "").includes("entById"));
-  is(jsterm.getInputValue(), "document.getElem", "'document.getElem' untab completion");
+  is(getInputValue(hud), "document.getElem", "'document.getElem' untab completion");
   checkInputCompletionValue(hud, "                entById",
      "'document.getElem' completion");
 
   ui.clearOutput();
 
   await setInputValueForAutocompletion(hud, "docu");
   checkInputCompletionValue(hud, "    ment", "'docu' completion");
 
   let onAutocompletUpdated = jsterm.once("autocomplete-updated");
   await jsterm.execute();
   checkInputCompletionValue(hud, "", "clear completion on execute()");
 
   // Test multi-line completion works. We can't use setInputValueForAutocompletion because
   // it would trigger an evaluation (because of the new line, an Enter keypress is
   // simulated).
   onAutocompletUpdated = jsterm.once("autocomplete-updated");
-  jsterm.setInputValue("console.log('one');\n");
+  setInputValue(hud, "console.log('one');\n");
   EventUtils.sendString("consol");
   await onAutocompletUpdated;
   checkInputCompletionValue(hud, "\n      e", "multi-line completion");
 
   // Test multi-line completion works even if there is text after the cursor
   onAutocompletUpdated = jsterm.once("autocomplete-updated");
-  jsterm.setInputValue("{\n\n}");
+  setInputValue(hud, "{\n\n}");
   EventUtils.synthesizeKey("KEY_ArrowUp");
   EventUtils.sendString("console.g");
   await onAutocompletUpdated;
   checkInputValueAndCursorPosition(hud, "{\nconsole.g|\n}");
   checkInputCompletionValue(hud, "\n         roup", "multi-line completion");
   is(autocompletePopup.isOpen, true, "popup is opened");
 
   // Test non-object autocompletion.
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_completion_bracket.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_completion_bracket.js
@@ -152,17 +152,17 @@ async function testInput(hud, {
   info(`${description} - test accepting completion`);
   const onPopupClose = autocompletePopup.once("popup-closed");
   EventUtils.synthesizeKey("KEY_Tab");
   await onPopupClose;
   checkInputValueAndCursorPosition(hud, expectedInputAfterCompletion + "|",
     `${description} - input was completed as expected`);
   checkInputCompletionValue(hud, "", `${description} - completeNode is empty`);
 
-  jsterm.setInputValue("");
+  setInputValue(hud, "");
 }
 
 async function testCompletionTextUpdateOnPopupNavigate(hud) {
   const {jsterm} = hud;
   const {autocompletePopup} = jsterm;
 
   info("Test that navigating the popup list update the completionText as expected");
   const onPopUpOpen = autocompletePopup.once("popup-opened");
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_completion_bracket_cached_results.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_completion_bracket_cached_results.js
@@ -131,21 +131,21 @@ async function performTests() {
     for (const {char, expectedItems, expectedCompletionText} of test.sequence) {
       const onPopupUpdate = jsterm.once("autocomplete-updated");
       EventUtils.sendString(char);
       await onPopupUpdate;
 
       is(getAutocompletePopupLabels(autocompletePopup).join("|"), expectedItems.join("|"),
         `popup has expected items, in expected order`);
       checkInputCompletionValue(hud,
-        " ".repeat(jsterm.getInputValue().length) + expectedCompletionText,
+        " ".repeat(getInputValue(hud).length) + expectedCompletionText,
         `completeNode has expected value`);
     }
 
-    jsterm.setInputValue("");
+    setInputValue(hud, "");
     const onPopupClose = autocompletePopup.once("popup-closed");
     EventUtils.synthesizeKey("KEY_Escape");
     await onPopupClose;
   }
 }
 
 function getAutocompletePopupLabels(autocompletePopup) {
   return autocompletePopup.items.map(i => i.label);
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_completion_case_sensitivity.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_completion_case_sensitivity.js
@@ -76,34 +76,34 @@ async function performTests() {
   checkInputCompletionValue(hud, "        oo", "completeNode has expected value");
 
   onPopupClose = autocompletePopup.once("popup-closed");
   EventUtils.synthesizeKey("KEY_Tab");
   await onPopupClose;
   checkInput("fooBar.Foo|", "The input was completed with the correct casing");
   checkInputCompletionValue(hud, "", "completeNode is empty");
 
-  jsterm.setInputValue("");
+  setInputValue(hud, "");
 
   info("Check that Javascript keywords are displayed first");
   onPopUpOpen = autocompletePopup.once("popup-opened");
   EventUtils.sendString("func");
   await onPopUpOpen;
 
   is(getAutocompletePopupLabels(autocompletePopup).join(" - "), "function - Function",
     "popup has expected item");
   checkInputCompletionValue(hud, "    tion", "completeNode has expected value");
 
   onPopupClose = autocompletePopup.once("popup-closed");
   EventUtils.synthesizeKey("KEY_Tab");
   await onPopupClose;
   checkInput("function|", "The input was completed as expected");
   checkInputCompletionValue(hud, "", "completeNode is empty");
 
-  jsterm.setInputValue("");
+  setInputValue(hud, "");
 
   info("Check that filtering the cache works like on the server");
   onPopUpOpen = autocompletePopup.once("popup-opened");
   EventUtils.sendString("fooBar.");
   await onPopUpOpen;
   is(getAutocompletePopupLabels(autocompletePopup).join(" - "),
     "test - Foo - TEST - Test", "popup has expected items");
 
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_ctrl_a_select_all.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_ctrl_a_select_all.js
@@ -14,30 +14,31 @@ add_task(async function() {
   await pushPref("devtools.webconsole.jsterm.codeMirror", false);
   await performTests();
   // And then run it with the CodeMirror-powered one.
   await pushPref("devtools.webconsole.jsterm.codeMirror", true);
   await performTests();
 });
 
 async function performTests() {
-  const {jsterm} = await openNewTabAndConsole(TEST_URI);
+  const hud = await openNewTabAndConsole(TEST_URI);
+  const {jsterm} = hud;
 
-  jsterm.setInputValue("Ignore These Four Words");
+  setInputValue(hud, "Ignore These Four Words");
 
   // Test select all with (cmd|control) + a.
   EventUtils.synthesizeKey("a", { accelKey: true });
 
   const inputLength = getSelectionTextLength(jsterm);
-  is(inputLength, jsterm.getInputValue().length, "Select all of input");
+  is(inputLength, getInputValue(hud).length, "Select all of input");
 
   // (cmd|control) + e cannot be disabled on Linux so skip this section on that OS.
   if (Services.appinfo.OS !== "Linux") {
    // Test do nothing on Control + E.
-    jsterm.setInputValue("Ignore These Four Words");
+    setInputValue(hud, "Ignore These Four Words");
     setCursorAtStart(jsterm);
     EventUtils.synthesizeKey("e", { accelKey: true });
     checkSelectionStart(jsterm, 0, "control|cmd + e does not move to end of input");
   }
 }
 
 function getSelectionTextLength(jsterm) {
   if (jsterm.inputNode) {
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_ctrl_key_nav.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_ctrl_key_nav.js
@@ -20,19 +20,18 @@ add_task(async function() {
   await performTests();
   // And then run it with the CodeMirror-powered one.
   await pushPref("devtools.webconsole.jsterm.codeMirror", true);
   await performTests();
 });
 
 async function performTests() {
   const hud = await openNewTabAndConsole(TEST_URI);
-  const {jsterm} = hud;
 
-  ok(!jsterm.getInputValue(), "jsterm.getInputValue() is empty");
+  ok(!getInputValue(hud), "input is empty");
   checkInputCursorPosition(hud, 0, "Cursor is at the start of the input");
 
   testSingleLineInputNavNoHistory(hud);
   testMultiLineInputNavNoHistory(hud);
   await testNavWithHistory(hud);
 }
 
 function testSingleLineInputNavNoHistory(hud) {
@@ -86,20 +85,20 @@ function testSingleLineInputNavNoHistory
   checkInput("12|", "ctrl-n moves to end of line");
 }
 
 function testMultiLineInputNavNoHistory(hud) {
   const checkInput = (expected, assertionInfo) =>
     checkInputValueAndCursorPosition(hud, expected, assertionInfo);
 
   const lineValues = ["one", "2", "something longer", "", "", "three!"];
-  hud.jsterm.setInputValue("");
+  setInputValue(hud, "");
   // simulate shift-return
   for (const lineValue of lineValues) {
-    hud.jsterm.setInputValue(hud.jsterm.getInputValue() + lineValue);
+    setInputValue(hud, getInputValue(hud) + lineValue);
     EventUtils.synthesizeKey("KEY_Enter", {shiftKey: true});
   }
 
   checkInput(
 `one
 2
 something longer
 
@@ -216,17 +215,17 @@ async function testNavWithHistory(hud) {
   const values = [
     "single line input",
     "a longer single-line input to check caret repositioning",
     "multi-line\ninput\nhere",
   ];
 
   // submit to history
   for (const value of values) {
-    hud.jsterm.setInputValue(value);
+    setInputValue(hud, value);
     await hud.jsterm.execute();
   }
 
   checkInput("|", "caret location at start of empty line");
 
   synthesizeLineUpKey();
   checkInput("multi-line\ninput\nhere|", "caret location at end of last history input");
 
@@ -260,17 +259,17 @@ async function testNavWithHistory(hud) {
   synthesizeLineDownKey();
   checkInput("multi-line\ninput\nhere|", "caret location at end of last history input");
 
   synthesizeLineDownKey();
   checkInput("|", "ctrl-n at end of history updates to empty input");
 
   // Simulate editing multi-line
   const inputValue = "one\nlinebreak";
-  hud.jsterm.setInputValue(inputValue);
+  setInputValue(hud, inputValue);
   checkInput("one\nlinebreak|");
 
   // Attempt nav within input
   synthesizeLineUpKey();
   checkInput("one|\nlinebreak", "ctrl-p from end of multi-line does not trigger history");
 
   synthesizeLineStartKey();
   checkInput("|one\nlinebreak");
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_history.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_history.js
@@ -14,47 +14,48 @@ add_task(async function() {
   await pushPref("devtools.webconsole.jsterm.codeMirror", false);
   await testHistory();
 
   await pushPref("devtools.webconsole.jsterm.codeMirror", true);
   await testHistory();
 });
 
 async function testHistory() {
-  const { jsterm } = await openNewTabAndConsole(TEST_URI);
+  const hud = await openNewTabAndConsole(TEST_URI);
+  const {jsterm} = hud;
   jsterm.focus();
 
   for (const command of COMMANDS) {
     info(`Executing command ${command}`);
     await jsterm.execute(command);
   }
 
   for (let x = COMMANDS.length - 1; x != -1; x--) {
     EventUtils.synthesizeKey("KEY_ArrowUp");
-    is(jsterm.getInputValue(), COMMANDS[x], "check history previous idx:" + x);
+    is(getInputValue(hud), COMMANDS[x], "check history previous idx:" + x);
   }
 
   EventUtils.synthesizeKey("KEY_ArrowUp");
-  is(jsterm.getInputValue(), COMMANDS[0], "test that item is still index 0");
+  is(getInputValue(hud), COMMANDS[0], "test that item is still index 0");
 
   EventUtils.synthesizeKey("KEY_ArrowUp");
-  is(jsterm.getInputValue(), COMMANDS[0], "test that item is still still index 0");
+  is(getInputValue(hud), COMMANDS[0], "test that item is still still index 0");
 
   for (let i = 1; i < COMMANDS.length; i++) {
     EventUtils.synthesizeKey("KEY_ArrowDown");
-    is(jsterm.getInputValue(), COMMANDS[i], "check history next idx:" + i);
+    is(getInputValue(hud), COMMANDS[i], "check history next idx:" + i);
   }
 
   EventUtils.synthesizeKey("KEY_ArrowDown");
-  is(jsterm.getInputValue(), "", "check input is empty again");
+  is(getInputValue(hud), "", "check input is empty again");
 
   // Simulate pressing Arrow_Down a few times and then if Arrow_Up shows
   // the previous item from history again.
   EventUtils.synthesizeKey("KEY_ArrowDown");
   EventUtils.synthesizeKey("KEY_ArrowDown");
   EventUtils.synthesizeKey("KEY_ArrowDown");
 
-  is(jsterm.getInputValue(), "", "check input is still empty");
+  is(getInputValue(hud), "", "check input is still empty");
 
   const idxLast = COMMANDS.length - 1;
   EventUtils.synthesizeKey("KEY_ArrowUp");
-  is(jsterm.getInputValue(), COMMANDS[idxLast], "check history next idx:" + idxLast);
+  is(getInputValue(hud), COMMANDS[idxLast], "check history next idx:" + idxLast);
 }
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_history_arrow_keys.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_history_arrow_keys.js
@@ -34,17 +34,17 @@ async function performTests() {
   const checkInput = (expected, assertionInfo) =>
     checkInputValueAndCursorPosition(hud, expected, assertionInfo);
 
   jsterm.focus();
   checkInput("|", "input is empty");
 
   info("Execute each test value in the console");
   for (const value of TEST_VALUES) {
-    jsterm.setInputValue(value);
+    setInputValue(hud, value);
     await jsterm.execute();
   }
 
   EventUtils.synthesizeKey("KEY_ArrowUp");
   checkInput("document.location|", "↑: input #4 is correct");
   ok(inputHasNoSelection(jsterm));
 
   EventUtils.synthesizeKey("KEY_ArrowUp");
@@ -82,17 +82,17 @@ async function performTests() {
 
   EventUtils.synthesizeKey("KEY_ArrowDown");
   checkInput("document.body|", "↓: input #2 is correct");
 
   EventUtils.synthesizeKey("KEY_ArrowDown");
   checkInput("document;\nwindow;\ndocument.body|", "↓: input #3 is correct");
   ok(inputHasNoSelection(jsterm));
 
-  setCursorAtPosition(jsterm, 2);
+  setCursorAtPosition(hud, 2);
   checkInput("do|cument;\nwindow;\ndocument.body");
 
   EventUtils.synthesizeKey("KEY_ArrowDown");
   EventUtils.synthesizeKey("KEY_ArrowDown");
   checkInput("document;\nwindow;\ndo|cument.body", "↓↓: input #3 is correct");
   ok(inputHasNoSelection(jsterm));
 
   EventUtils.synthesizeKey("KEY_ArrowDown");
@@ -135,24 +135,25 @@ async function performTests() {
     EventUtils.synthesizeKey("KEY_ArrowDown", option);
     checkInput("document.location|", "Cmd+↓ : input is correct");
 
     EventUtils.synthesizeKey("KEY_ArrowDown", option);
     checkInput("|", "Cmd+↓: input is empty");
   }
 }
 
-function setCursorAtPosition(jsterm, pos) {
+function setCursorAtPosition(hud, pos) {
+  const {jsterm} = hud;
   const {inputNode, editor} = jsterm;
 
   if (editor) {
     let line = 0;
     let ch = 0;
     let currentPos = 0;
-    jsterm.getInputValue().split("\n").every(l => {
+    getInputValue(hud).split("\n").every(l => {
       if (l.length < pos - currentPos) {
         line++;
         currentPos += l.length;
         return true;
       }
       ch = pos - currentPos;
       return false;
     });
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_history_nav.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_history_nav.js
@@ -17,17 +17,18 @@ add_task(async function() {
   await testHistory();
 
   // And then in codeMirror JsTerm.
   await pushPref("devtools.webconsole.jsterm.codeMirror", true);
   await testHistory();
 });
 
 async function testHistory() {
-  const { jsterm } = await openNewTabAndConsole(TEST_URI);
+  const hud = await openNewTabAndConsole(TEST_URI);
+  const { jsterm } = hud;
   const popup = jsterm.autocompletePopup;
 
   // The autocomplete popup should never be displayed during the test.
   const onShown = function() {
     ok(false, "popup shown");
   };
   popup.on("popup-opened", onShown);
 
@@ -44,14 +45,14 @@ async function testHistory() {
   const onSetInputValue = jsterm.once("set-input-value");
   EventUtils.synthesizeKey("KEY_ArrowUp");
   await onSetInputValue;
 
   // We don't have an explicit event to wait for here, so we just wait for the next tick
   // before checking the popup status.
   await new Promise(executeSoon);
 
-  is(jsterm.getInputValue(), "window.foobarBug660806.location",
+  is(getInputValue(hud), "window.foobarBug660806.location",
     "input has expected value");
 
   ok(!popup.isOpen, "popup is not open");
   popup.off("popup-opened", onShown);
 }
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_history_persist.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_history_persist.js
@@ -66,17 +66,17 @@ async function testHistory() {
   let state3 = hud3.ui.wrapper.getStore().getState();
 
   is(JSON.stringify(getHistoryEntries(state3)),
      '["0","1","2","3","4","5","6","7","8","9"]',
      "Third tab has populated history");
 
   // Set input value separately from execute so UP arrow accurately navigates
   // history.
-  hud3.jsterm.setInputValue('"hello from third tab"');
+  setInputValue(hud3, '"hello from third tab"');
   await hud3.jsterm.execute();
 
   state1 = hud1.ui.wrapper.getStore().getState();
   is(JSON.stringify(getHistoryEntries(state1)),
      '["0","1","2","3","4","5","6","7","8","9"]',
      "First tab history hasn't changed due to command in third tab");
 
   state2 = hud2.ui.wrapper.getStore().getState();
@@ -119,28 +119,28 @@ async function testHistory() {
  * Populate the history by running the following commands:
  *  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
  */
 async function populateInputHistory(hud) {
   const jsterm = hud.jsterm;
 
   for (let i = 0; i < INPUT_HISTORY_COUNT; i++) {
     // Set input value separately from execute so UP arrow accurately navigates history.
-    jsterm.setInputValue(i.toString());
+    setInputValue(hud, i.toString());
     await jsterm.execute();
   }
 }
 
 /**
  * Check pressing up results in history traversal like:
  *  [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
  */
 function testNavigatingHistoryInUI(hud) {
   const {jsterm} = hud;
   jsterm.focus();
 
   // Count backwards from original input and make sure that pressing up
   // restores this.
   for (let i = INPUT_HISTORY_COUNT - 1; i >= 0; i--) {
     EventUtils.synthesizeKey("KEY_ArrowUp");
-    is(jsterm.getInputValue(), i, "Pressing up restores last input");
+    is(getInputValue(hud), i, "Pressing up restores last input");
   }
 }
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_middle_click_paste.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_middle_click_paste.js
@@ -28,17 +28,17 @@ async function performTests() {
   info("Set clipboard content");
   const clipboardContent = "test clipboard content";
   setClipboardText(clipboardContent);
 
   info("Middle-click on the console input");
   const node = jsterm.node || jsterm.inputNode;
 
   EventUtils.synthesizeMouse(node, 30, 10, {button: 1}, hud.iframeWindow);
-  is(jsterm.getInputValue(), clipboardContent,
+  is(getInputValue(hud), clipboardContent,
     "clipboard content was pasted in the console input");
 }
 
 function setClipboardText(text) {
   const helper = SpecialPowers.Cc["@mozilla.org/widget/clipboardhelper;1"]
     .getService(SpecialPowers.Ci.nsIClipboardHelper);
   helper.copyString(text);
 }
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_multiline.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_multiline.js
@@ -87,34 +87,35 @@ add_task(async function() {
 async function performTests() {
   // Let's reset the counts.
   Services.telemetry.clearEvents();
 
   // Ensure no events have been logged
   const snapshot = Services.telemetry.snapshotEvents(OPTOUT, true);
   ok(!snapshot.parent, "No events have been logged for the main process");
 
-  const {jsterm} = await openNewTabAndConsole(TEST_URI);
+  const hud = await openNewTabAndConsole(TEST_URI);
+  const {jsterm} = hud;
 
   for (const {input, shiftKey} of SHOULD_ENTER_MULTILINE) {
-    jsterm.setInputValue(input);
+    setInputValue(hud, input);
     EventUtils.synthesizeKey("VK_RETURN", { shiftKey });
 
     // We need to remove the spaces at the end of the input since code mirror do some
     // automatic indent in some case.
-    const newValue = jsterm.getInputValue().replace(/ +$/g, "");
+    const newValue = getInputValue(hud).replace(/ +$/g, "");
     is(newValue, input + "\n", "A new line was added");
   }
 
   for (const {input, shiftKey} of SHOULD_EXECUTE) {
-    jsterm.setInputValue(input);
+    setInputValue(hud, input);
     EventUtils.synthesizeKey("VK_RETURN", { shiftKey });
 
-    await waitFor(() => !jsterm.getInputValue());
-    is(jsterm.getInputValue(), "", "Input is cleared");
+    await waitFor(() => !getInputValue(hud));
+    is(getInputValue(hud), "", "Input is cleared");
   }
 
   await jsterm.execute("document.\nlocation.\nhref");
 
   checkEventTelemetry();
 }
 
 function checkEventTelemetry() {
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_no_input_and_tab_key_pressed.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_no_input_and_tab_key_pressed.js
@@ -19,25 +19,25 @@ add_task(async function() {
 });
 
 async function performTests(codeMirror) {
   const hud = await openNewTabAndConsole(TEST_URI);
   const jsterm = hud.jsterm;
 
   info("Check that hitting Tab when input is empty insert blur the input");
   jsterm.focus();
-  jsterm.setInputValue("");
+  setInputValue(hud, "");
   EventUtils.synthesizeKey("KEY_Tab");
-  is(jsterm.getInputValue(), "", "inputnode is empty - matched");
+  is(getInputValue(hud), "", "inputnode is empty - matched");
   ok(!isInputFocused(hud), "input isn't focused anymore");
 
   info("Check that hitting Shift+Tab when input is not empty insert a tab");
   jsterm.focus();
   EventUtils.synthesizeKey("KEY_Tab", {shiftKey: true});
-  is(jsterm.getInputValue(), "", "inputnode is empty - matched");
+  is(getInputValue(hud), "", "inputnode is empty - matched");
   ok(!isInputFocused(hud), "input isn't focused anymore");
   ok(hasFocus(hud.ui.outputNode.querySelector(".devtools-button.net")),
     `The "Requests" filter button is now focused`);
 
   info("Check that hitting Tab when input is not empty insert a tab");
   jsterm.focus();
 
   const testString = "window.Bug583816";
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_popup_close_on_tab_switch.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_popup_close_on_tab_switch.js
@@ -20,17 +20,17 @@ add_task(async function() {
   await performTests();
 });
 
 async function performTests() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const popup = hud.jsterm.autocompletePopup;
   const popupShown = once(popup, "popup-opened");
 
-  hud.jsterm.setInputValue("sc");
+  setInputValue(hud, "sc");
   EventUtils.sendString("r");
 
   await popupShown;
 
   await addTab(TEST_URI_NAVIGATE);
 
   ok(!popup.isOpen, "Popup closes on tab switch");
 }
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_selfxss.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_selfxss.js
@@ -23,44 +23,45 @@ add_task(async function() {
   await performTest();
   // And then run it with the CodeMirror-powered one.
   await pushPref("devtools.webconsole.jsterm.codeMirror", true);
   await performTest();
 });
 
 async function performTest() {
   await pushPref("devtools.selfxss.count", 0);
-  const {jsterm, ui} = await openNewTabAndConsole(TEST_URI);
+  const hud = await openNewTabAndConsole(TEST_URI);
+  const {jsterm, ui} = hud;
   const {document} = ui;
 
   info("Self-xss paste tests");
   WebConsoleUtils.usageCount = 0;
   is(WebConsoleUtils.usageCount, 0, "Test for usage count getter");
 
   // Input some commands to check if usage counting is working
   for (let i = 0; i <= 3; i++) {
-    jsterm.setInputValue(i.toString());
+    setInputValue(hud, i.toString());
     jsterm.execute();
   }
   is(WebConsoleUtils.usageCount, 4, "Usage count incremented");
   WebConsoleUtils.usageCount = 0;
 
   info(`Copy "${stringToCopy}" in clipboard`);
   await waitForClipboardPromise(() =>
     clipboardHelper.copyString(stringToCopy), stringToCopy);
   goDoCommand("cmd_paste");
 
   const notificationbox = document.getElementById("webconsole-notificationbox");
   const notification = notificationbox.querySelector(".notification");
   is(notification.getAttribute("data-key"), "selfxss-notification",
     "Self-xss notification shown");
-  is(jsterm.getInputValue(), "", "Paste blocked by self-xss prevention");
+  is(getInputValue(hud), "", "Paste blocked by self-xss prevention");
 
   // Allow pasting
   const allowToken = "allow pasting";
   for (const char of allowToken) {
     EventUtils.sendString(char);
   }
 
-  jsterm.setInputValue("");
+  setInputValue(hud, "");
   goDoCommand("cmd_paste");
-  is(jsterm.getInputValue(), stringToCopy, "Paste works");
+  is(getInputValue(hud), stringToCopy, "Paste works");
 }
--- a/devtools/client/webconsole/test/mochitest/browser_webconsole_context_menu_store_as_global.js
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_context_menu_store_as_global.js
@@ -79,13 +79,13 @@ async function storeAsVariable(hud, msg,
   storeMenuItem.click();
 
   info("Wait for console input to be updated with the temp variable");
   await onceInputSet;
 
   info("Wait for context menu to be hidden");
   await hideContextMenu(hud);
 
-  is(hud.jsterm.getInputValue(), "temp" + varIdx, "Input was set");
+  is(getInputValue(hud), "temp" + varIdx, "Input was set");
 
   const equal = await hud.jsterm.requestEvaluation("temp" + varIdx + " === " + equalTo);
   is(equal.result, true, "Correct variable assigned into console.");
 }
--- a/devtools/client/webconsole/test/mochitest/browser_webconsole_in_line_layout.js
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_in_line_layout.js
@@ -19,17 +19,17 @@ add_task(async function() {
   await pushPref("devtools.webconsole.jsterm.codeMirror", true);
   await performTests();
 });
 
 async function performTests() {
   // The style is only enabled in the new jsterm.
   await pushPref("devtools.webconsole.jsterm.codeMirror", true);
   const hud = await openNewTabAndConsole(TEST_URI);
-  const {jsterm, ui} = hud;
+  const {ui} = hud;
   const {document} = ui;
   const appNode = document.querySelector(".webconsole-app");
   const [
     filterBarNode,
     outputNode,
     ,
     inputNode,
   ] = appNode.querySelector(".webconsole-flex-wrapper").childNodes;
@@ -57,17 +57,17 @@ async function performTests() {
       content.wrappedJSObject.console.log("message-" + i);
     }
   });
   await onLastMessage;
   ok(outputNode.scrollHeight > outputNode.clientHeight, "Output node overflows");
   testLayout(appNode);
 
   info("Make sure setting a tall value in the input does not break the layout");
-  jsterm.setInputValue("multiline\n".repeat(200));
+  setInputValue(hud, "multiline\n".repeat(200));
   is(outputNode.clientHeight, MINIMUM_MESSAGE_HEIGHT,
     "One message is still visible in the output node");
   testLayout(appNode);
 
   const filterBarHeight = filterBarNode.clientHeight;
 
   info("Show the hidden messages label");
   const onHiddenMessagesLabelVisible = waitFor(() =>
@@ -84,17 +84,17 @@ async function performTests() {
 
   ok(filterBarNode.clientHeight > filterBarHeight, "The filter bar is taller");
   testLayout(appNode);
 
   info("Expand the window so hidden label isn't on its own line anymore");
   hostWindow.resizeTo(window.screen.availWidth, window.screen.availHeight);
   testLayout(appNode);
 
-  jsterm.setInputValue("");
+  setInputValue(hud, "");
   testLayout(appNode);
 
   ui.clearOutput();
   testLayout(appNode);
   is(outputNode.offsetHeight, 0, "output node has no height");
   is(filterBarNode.offsetHeight + inputNode.offsetHeight, appNode.offsetHeight,
     "The entire height is taken by filter bar and input");
 }
--- a/devtools/client/webconsole/test/mochitest/browser_webconsole_reverse_search.js
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_reverse_search.js
@@ -23,30 +23,30 @@ add_task(async function() {
   ];
 
   const onLastMessage = waitForMessage(hud, `"😎"`);
   for (const input of jstermHistory) {
     await hud.jsterm.execute(input);
   }
   await onLastMessage;
 
-  const jstermInitialValue = "initialValue";
-  hud.jsterm.setInputValue(jstermInitialValue);
+  const initialValue = "initialValue";
+  setInputValue(hud, initialValue);
 
   info("Check that the reverse search toolbar as the expected initial state");
   let reverseSearchElement = await openReverseSearch(hud);
   ok(reverseSearchElement, "Reverse search is displayed with a keyboard shortcut");
   ok(!getReverseSearchInfoElement(hud),
     "The result info element is not displayed by default");
   ok(
     !reverseSearchElement.querySelector(".search-result-button-prev") &&
     !reverseSearchElement.querySelector(".search-result-button-next"),
     "The results navigation buttons are not displayed by default"
   );
-  is(hud.jsterm.getInputValue(), jstermInitialValue,
+  is(getInputValue(hud), initialValue,
     "The jsterm value is not changed when opening reverse search");
   is(isReverseSearchInputFocused(hud), true, "reverse search input is focused");
 
   EventUtils.sendString("d");
   let infoElement = await waitFor(() => getReverseSearchInfoElement(hud));
   is(infoElement.textContent, "3 of 3 results", "The reverse info has the expected text "
     + "— duplicated results (`document`) are coalesced");
 
@@ -54,55 +54,55 @@ add_task(async function() {
   const nextButton = reverseSearchElement.querySelector(".search-result-button-next");
   ok(previousButton, "Previous navigation button is now displayed");
   is(previousButton.title, `Previous result (${isMacOS ? "Ctrl + R" : "F9"})`,
     "Previous navigation button has expected title");
 
   ok(nextButton, "Next navigation button is now displayed");
   is(nextButton.title, `Next result (${isMacOS ? "Ctrl + S" : "Shift + F9"})`,
     "Next navigation button has expected title");
-  is(hud.jsterm.getInputValue(), "document", "JsTerm has the expected input");
+  is(getInputValue(hud), "document", "JsTerm has the expected input");
   is(hud.jsterm.autocompletePopup.isOpen, false,
     "Setting the input value did not trigger the autocompletion");
   is(isReverseSearchInputFocused(hud), true, "reverse search input is focused");
 
   let onJsTermValueChanged = hud.jsterm.once("set-input-value");
   EventUtils.sendString("og");
   await onJsTermValueChanged;
-  is(hud.jsterm.getInputValue(), `Dog = "Snoopy"`, "JsTerm input was updated");
+  is(getInputValue(hud), `Dog = "Snoopy"`, "JsTerm input was updated");
   is(infoElement.textContent, "1 result", "The reverse info has the expected text");
   ok(
     !reverseSearchElement.querySelector(".search-result-button-prev") &&
     !reverseSearchElement.querySelector(".search-result-button-next"),
     "The results navigation buttons are not displayed when there's only one result"
   );
 
   info("Check that the UI and results are updated when typing in the input");
   onJsTermValueChanged = hud.jsterm.once("set-input-value");
   EventUtils.sendString("g");
   await waitFor(() => reverseSearchElement.classList.contains("no-result"));
-  is(hud.jsterm.getInputValue(), `Dog = "Snoopy"`,
+  is(getInputValue(hud), `Dog = "Snoopy"`,
     "JsTerm input was not updated since there's no results");
   is(infoElement.textContent, "No results", "The reverse info has the expected text");
   ok(
     !reverseSearchElement.querySelector(".search-result-button-prev") &&
     !reverseSearchElement.querySelector(".search-result-button-next"),
     "The results navigation buttons are not displayed when there's no result"
   );
 
   info("Check that Backspace updates the UI");
   EventUtils.synthesizeKey("KEY_Backspace");
   await waitFor(() => !reverseSearchElement.classList.contains("no-result"));
   is(infoElement.textContent, "1 result", "The reverse info has the expected text");
-  is(hud.jsterm.getInputValue(), `Dog = "Snoopy"`, "JsTerm kept its value");
+  is(getInputValue(hud), `Dog = "Snoopy"`, "JsTerm kept its value");
 
   info("Check that Escape does not affect the jsterm value");
   EventUtils.synthesizeKey("KEY_Escape");
   await waitFor(() => !getReverseSearchElement(hud));
-  is(hud.jsterm.getInputValue(), `Dog = "Snoopy"`,
+  is(getInputValue(hud), `Dog = "Snoopy"`,
     "Closing the input did not changed the JsTerm value");
   is(isInputFocused(hud), true, "input is focused");
 
   info("Check that the search works with emojis");
   reverseSearchElement = await openReverseSearch(hud);
   onJsTermValueChanged = hud.jsterm.once("set-input-value");
   EventUtils.sendString("😎");
   infoElement = await waitFor(() => getReverseSearchInfoElement(hud));
--- a/devtools/client/webconsole/test/mochitest/browser_webconsole_reverse_search_initial_value.js
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_reverse_search_initial_value.js
@@ -31,18 +31,17 @@ async function performTests() {
   ];
 
   const onLastMessage = waitForMessage(hud, `"😎"`);
   for (const input of jstermHistory) {
     await jsterm.execute(input);
   }
   await onLastMessage;
 
-  const jstermInitialValue = "ado";
-  jsterm.setInputValue(jstermInitialValue);
+  setInputValue(hud, "ado");
 
   info(`Select 2 chars ("do") from the input`);
   if (jsterm.inputNode) {
     jsterm.inputNode.selectionStart = 1;
     jsterm.inputNode.selectionEnd = 3;
   } else {
     jsterm.editor.setSelection({line: 0, ch: 1}, {line: 0, ch: 3});
   }
@@ -56,24 +55,24 @@ async function performTests() {
   const infoElement = getReverseSearchInfoElement(hud);
   is(infoElement.textContent, "3 of 3 results", "The reverse info has the expected text");
 
   const previousButton = reverseSearchElement.querySelector(".search-result-button-prev");
   const nextButton = reverseSearchElement.querySelector(".search-result-button-next");
   ok(previousButton, "Previous navigation button is displayed");
   ok(nextButton, "Next navigation button is displayed");
 
-  is(jsterm.getInputValue(), "document", "JsTerm has the expected input");
+  is(getInputValue(hud), "document", "JsTerm has the expected input");
   is(jsterm.autocompletePopup.isOpen, false,
     "Setting the input value did not trigger the autocompletion");
 
   const onJsTermValueChanged = jsterm.once("set-input-value");
   EventUtils.sendString("g");
   await onJsTermValueChanged;
-  is(jsterm.getInputValue(), `Dog = "Snoopy"`, "JsTerm input was updated");
+  is(getInputValue(hud), `Dog = "Snoopy"`, "JsTerm input was updated");
   is(infoElement.textContent, "1 result", "The reverse info has the expected text");
   ok(
     !reverseSearchElement.querySelector(".search-result-button-prev") &&
     !reverseSearchElement.querySelector(".search-result-button-next"),
     "The results navigation buttons are not displayed when there's only one result"
   );
 
   info("Check that there's no initial value when no text is selected");
--- a/devtools/client/webconsole/test/mochitest/browser_webconsole_reverse_search_keyboard_navigation.js
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_reverse_search_keyboard_navigation.js
@@ -26,17 +26,17 @@ add_task(async function() {
   }
   await onLastMessage;
 
   await openReverseSearch(hud);
   EventUtils.sendString("d");
   const infoElement = await waitFor(() => getReverseSearchInfoElement(hud));
   is(infoElement.textContent, "3 of 3 results", "The reverse info has the expected text");
 
-  is(hud.jsterm.getInputValue(), jstermHistory[2], "JsTerm has the expected input");
+  is(getInputValue(hud), jstermHistory[2], "JsTerm has the expected input");
   is(hud.jsterm.autocompletePopup.isOpen, false,
     "Setting the input value did not trigger the autocompletion");
 
   await navigateResultsAndCheckState(hud, {
     direction: "previous",
     expectedInfoText: "2 of 3 results",
     expectedJsTermInputValue: jstermHistory[1],
   });
@@ -93,17 +93,17 @@ async function navigateResultsAndCheckSt
   const onJsTermValueChanged = hud.jsterm.once("set-input-value");
   if (direction === "previous") {
     triggerPreviousResultShortcut();
   } else {
     triggerNextResultShortcut();
   }
   await onJsTermValueChanged;
 
-  is(hud.jsterm.getInputValue(), expectedJsTermInputValue, "JsTerm has expected value");
+  is(getInputValue(hud), expectedJsTermInputValue, "JsTerm has expected value");
 
   const infoElement = getReverseSearchInfoElement(hud);
   is(infoElement.textContent, expectedInfoText, "The reverse info has the expected text");
   is(isReverseSearchInputFocused(hud), true, "reverse search input is still focused");
 }
 
 function triggerPreviousResultShortcut() {
   if (isMacOS) {
--- a/devtools/client/webconsole/test/mochitest/browser_webconsole_reverse_search_mouse_navigation.js
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_reverse_search_mouse_navigation.js
@@ -25,17 +25,17 @@ add_task(async function() {
   }
   await onLastMessage;
 
   await openReverseSearch(hud);
   EventUtils.sendString("d");
   const infoElement = await waitFor(() => getReverseSearchInfoElement(hud));
   is(infoElement.textContent, "3 of 3 results", "The reverse info has the expected text");
 
-  is(hud.jsterm.getInputValue(), jstermHistory[2], "JsTerm has the expected input");
+  is(getInputValue(hud), jstermHistory[2], "JsTerm has the expected input");
   is(hud.jsterm.autocompletePopup.isOpen, false,
     "Setting the input value did not trigger the autocompletion");
 
   await navigateResultsAndCheckState(hud, {
     direction: "previous",
     expectedInfoText: "2 of 3 results",
     expectedJsTermInputValue: jstermHistory[1],
   });
@@ -80,17 +80,17 @@ async function navigateResultsAndCheckSt
   const onJsTermValueChanged = hud.jsterm.once("set-input-value");
   if (direction === "previous") {
     clickPreviousButton(hud);
   } else {
     clickNextButton(hud);
   }
   await onJsTermValueChanged;
 
-  is(hud.jsterm.getInputValue(), expectedJsTermInputValue, "JsTerm has expected value");
+  is(getInputValue(hud), expectedJsTermInputValue, "JsTerm has expected value");
 
   const infoElement = getReverseSearchInfoElement(hud);
   is(infoElement.textContent, expectedInfoText, "The reverse info has the expected text");
   is(isReverseSearchInputFocused(hud), true, "reverse search input is still focused");
 }
 
 function clickPreviousButton(hud) {
   const reverseSearchElement = getReverseSearchElement(hud);
--- a/devtools/client/webconsole/test/mochitest/head.js
+++ b/devtools/client/webconsole/test/mochitest/head.js
@@ -388,33 +388,54 @@ async function checkClickOnNode(hud, too
  * Returns true if the give node is currently focused.
  */
 function hasFocus(node) {
   return node.ownerDocument.activeElement == node
     && node.ownerDocument.hasFocus();
 }
 
 /**
+ * Get the value of the console input .
+ *
+ * @param {WebConsole} hud: The webconsole
+ * @returns {String}: The value of the console input.
+ */
+function getInputValue(hud) {
+  return hud.jsterm.getInputValue();
+}
+
+/**
+ * Set the value of the console input .
+ *
+ * @param {WebConsole} hud: The webconsole
+ * @param {String} value : The value to set the console input to.
+ */
+function setInputValue(hud, value) {
+  return hud.jsterm.setInputValue(value);
+}
+
+/**
  * Set the value of the console input and its caret position, and wait for the
  * autocompletion to be updated.
  *
  * @param {WebConsole} hud: The webconsole
  * @param {String} value : The value to set the jsterm to.
  * @param {Integer} caretPosition : The index where to place the cursor. A negative
  *                  number will place the caret at (value.length - offset) position.
  *                  Default to value.length (caret set at the end).
  * @returns {Promise} resolves when the jsterm is completed.
  */
 async function setInputValueForAutocompletion(
   hud,
   value,
   caretPosition = value.length,
 ) {
   const {jsterm} = hud;
-  jsterm.setInputValue("");
+
+  setInputValue(hud, "");
   jsterm.focus();
 
   const updated = jsterm.once("autocomplete-updated");
   EventUtils.sendString(value);
   await updated;
 
   if (caretPosition < 0) {
     caretPosition = value.length + caretPosition;
@@ -506,17 +527,17 @@ function checkInputValueAndCursorPositio
   info(`Checking jsterm state: \n${expectedStringWithCursor}`);
   if (!expectedStringWithCursor.includes("|")) {
     ok(false,
       `expectedStringWithCursor must contain a "|" char to indicate cursor position`);
   }
 
   const inputValue = expectedStringWithCursor.replace("|", "");
   const {jsterm} = hud;
-  is(jsterm.getInputValue(), inputValue, "jsterm has expected value");
+  is(getInputValue(hud), inputValue, "console input has expected value");
   if (jsterm.inputNode) {
     is(jsterm.inputNode.selectionStart, jsterm.inputNode.selectionEnd);
     is(jsterm.inputNode.selectionStart, expectedStringWithCursor.indexOf("|"),
       assertionInfo);
   } else {
     const lines = expectedStringWithCursor.split("\n");
     const lineWithCursor = lines.findIndex(line => line.includes("|"));
     const {ch, line} = jsterm.editor.getCursor();