Bug 1464476 - Remove devtools.webconsole.autoMultiline preference; r=Honza.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Tue, 29 May 2018 17:32:56 +0200
changeset 475069 0a2f54ae94caf3c686e5be9b98ed367bf4336eb4
parent 475068 8fd817cc95a7dc611539856eabde846c7446a80f
child 475070 7ce972f7d2d5a318db2ba845b67fe051e61c5be4
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1464476
milestone62.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 1464476 - Remove devtools.webconsole.autoMultiline preference; r=Honza. The preference was true by default and never exposed to the users, so removing it is the logical next step. This patch removes all occurences of the preference, and add a fix to the RETURN key handling when the autocomplete popup is open (this is asserted on a test where autoMultiline was explicitely disabled.) MozReview-Commit-ID: 5783AK8lGR
devtools/client/preferences/devtools-client.js
devtools/client/webconsole/components/JSTerm.js
devtools/client/webconsole/local-dev/index.js
devtools/client/webconsole/test/mocha-test-setup.js
devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key.js
--- a/devtools/client/preferences/devtools-client.js
+++ b/devtools/client/preferences/devtools-client.js
@@ -261,20 +261,16 @@ pref("devtools.webconsole.inputHistoryCo
 pref("devtools.webconsole.persistlog", false);
 pref("devtools.netmonitor.persistlog", false);
 
 // Web Console timestamp: |true| if you want the logs and instructions
 // in the Web Console to display a timestamp, or |false| to not display
 // any timestamps.
 pref("devtools.webconsole.timestampMessages", false);
 
-// Web Console automatic multiline mode: |true| if you want incomplete statements
-// to automatically trigger multiline editing (equivalent to shift + enter).
-pref("devtools.webconsole.autoMultiline", true);
-
 // Enable the webconsole sidebar toggle in Nightly builds.
 #if defined(NIGHTLY_BUILD)
 pref("devtools.webconsole.sidebarToggle", true);
 #else
 pref("devtools.webconsole.sidebarToggle", false);
 #endif
 
 // Enable CodeMirror in the JsTerm: |false|
--- a/devtools/client/webconsole/components/JSTerm.js
+++ b/devtools/client/webconsole/components/JSTerm.js
@@ -18,17 +18,16 @@ loader.lazyRequireGetter(this, "PropType
 loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
 loader.lazyRequireGetter(this, "KeyCodes", "devtools/client/shared/keycodes", true);
 loader.lazyRequireGetter(this, "Editor", "devtools/client/sourceeditor/editor");
 loader.lazyRequireGetter(this, "Telemetry", "devtools/client/shared/telemetry");
 
 const l10n = require("devtools/client/webconsole/webconsole-l10n");
 
 const HELP_URL = "https://developer.mozilla.org/docs/Tools/Web_Console/Helpers";
-const PREF_AUTO_MULTILINE = "devtools.webconsole.autoMultiline";
 
 function gSequenceId() {
   return gSequenceId.n++;
 }
 gSequenceId.n = 0;
 
 // React & Redux
 const { Component } = require("devtools/client/shared/vendor/react");
@@ -196,26 +195,23 @@ class JSTerm extends Component {
           gutters: [],
           lineWrapping: true,
           mode: Editor.modes.js,
           styleActiveLine: false,
           tabIndex: "0",
           viewportMargin: Infinity,
           extraKeys: {
             "Enter": (e, cm) => {
-              let autoMultiline = Services.prefs.getBoolPref(PREF_AUTO_MULTILINE);
-              if (e.shiftKey
-                || (
-                  !Debugger.isCompilableUnit(this.getInputValue())
-                  && autoMultiline
-                )
-              ) {
+              if (!this.autocompletePopup.isOpen && (
+                e.shiftKey || !Debugger.isCompilableUnit(this.getInputValue())
+              )) {
                 // shift return or incomplete statement
                 return "CodeMirror.Pass";
               }
+
               this.execute();
               return null;
             },
           },
         });
         this.editor.appendToLocalElement(this.node);
       }
     } else if (this.inputNode) {
@@ -680,19 +676,19 @@ class JSTerm extends Component {
           }
           this.clearCompletion();
           break;
         default:
           break;
       }
       return;
     } else if (event.keyCode == KeyCodes.DOM_VK_RETURN) {
-      let autoMultiline = Services.prefs.getBoolPref(PREF_AUTO_MULTILINE);
-      if (event.shiftKey ||
-          (!Debugger.isCompilableUnit(inputNode.value) && autoMultiline)) {
+      if (!this.autocompletePopup.isOpen && (
+        event.shiftKey || !Debugger.isCompilableUnit(this.getInputValue())
+      )) {
         // shift return or incomplete statement
         return;
       }
     }
 
     switch (event.keyCode) {
       case KeyCodes.DOM_VK_ESCAPE:
         if (this.autocompletePopup.isOpen) {
--- a/devtools/client/webconsole/local-dev/index.js
+++ b/devtools/client/webconsole/local-dev/index.js
@@ -32,17 +32,16 @@ pref("devtools.webconsole.filter.log", t
 pref("devtools.webconsole.filter.debug", true);
 pref("devtools.webconsole.filter.css", false);
 pref("devtools.webconsole.filter.net", false);
 pref("devtools.webconsole.filter.netxhr", false);
 pref("devtools.webconsole.ui.filterbar", false);
 pref("devtools.webconsole.inputHistoryCount", 50);
 pref("devtools.webconsole.persistlog", false);
 pref("devtools.webconsole.timestampMessages", false);
-pref("devtools.webconsole.autoMultiline", true);
 pref("devtools.webconsole.sidebarToggle", true);
 
 const WebConsoleOutputWrapper = require("../webconsole-output-wrapper");
 const WebConsoleFrame = require("../webconsole-frame").WebConsoleFrame;
 
 // Copied from netmonitor/index.js:
 window.addEventListener("DOMContentLoaded", () => {
   for (let link of document.head.querySelectorAll("link")) {
--- a/devtools/client/webconsole/test/mocha-test-setup.js
+++ b/devtools/client/webconsole/test/mocha-test-setup.js
@@ -18,17 +18,16 @@ pref("devtools.webconsole.filter.log", t
 pref("devtools.webconsole.filter.debug", true);
 pref("devtools.webconsole.filter.css", false);
 pref("devtools.webconsole.filter.net", false);
 pref("devtools.webconsole.filter.netxhr", false);
 pref("devtools.webconsole.ui.filterbar", false);
 pref("devtools.webconsole.inputHistoryCount", 50);
 pref("devtools.webconsole.persistlog", false);
 pref("devtools.webconsole.timestampMessages", false);
-pref("devtools.webconsole.autoMultiline", true);
 pref("devtools.webconsole.sidebarToggle", true);
 
 global.loader = {
   lazyServiceGetter: () => {},
   lazyRequireGetter: () => {}
 };
 
 // Point to vendored-in files and mocks when needed.
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key.js
@@ -19,22 +19,17 @@ const TEST_URI = `data:text/html;charset
       item1: "value1",
       item2: "value2",
       item3: "value3",
     });
   </script>
 </head>
 <body>bug 585991 - test pressing return with open popup</body>`;
 
-// We should turn off auto-multiline editing during these tests
-const PREF_AUTO_MULTILINE = "devtools.webconsole.autoMultiline";
-
 add_task(async function() {
-  Services.prefs.setBoolPref(PREF_AUTO_MULTILINE, false);
-
   let { jsterm } = await openNewTabAndConsole(TEST_URI);
   const {
     autocompletePopup: popup,
     completeNode,
   } = jsterm;
 
   let onPopUpOpen = popup.once("popup-opened");
 
@@ -69,11 +64,9 @@ add_task(async function() {
   EventUtils.synthesizeKey("KEY_Enter");
 
   await onPopupClose;
 
   ok(!popup.isOpen, "popup is not open after KEY_Enter");
   is(jsterm.getInputValue(), "window.foobar.item3",
     "completion was successful after KEY_Enter");
   ok(!completeNode.value, "completeNode is empty");
-
-  Services.prefs.clearUserPref(PREF_AUTO_MULTILINE);
 });