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

--HG--
extra : rebase_source : 349a808b86410f5470d19c4f32d2b7040e060fbb
This commit is contained in:
Nicolas Chevobbe 2018-05-29 17:32:56 +02:00
parent de2f3011e4
commit 2c3dd00e37
5 changed files with 7 additions and 24 deletions

View File

@ -266,10 +266,6 @@ pref("devtools.netmonitor.persistlog", false);
// 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);

View File

@ -23,7 +23,6 @@ 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++;
@ -201,16 +200,13 @@ class JSTerm extends Component {
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;
},
@ -685,9 +681,9 @@ class JSTerm extends Component {
}
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;
}

View File

@ -37,7 +37,6 @@ 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");

View File

@ -23,7 +23,6 @@ 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 = {

View File

@ -24,12 +24,7 @@ const TEST_URI = `data:text/html;charset=utf-8,
</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,
@ -74,6 +69,4 @@ add_task(async function() {
is(jsterm.getInputValue(), "window.foobar.item3",
"completion was successful after KEY_Enter");
ok(!completeNode.value, "completeNode is empty");
Services.prefs.clearUserPref(PREF_AUTO_MULTILINE);
});