Bug 873250 - Having enter select autocomplete is annoying; r=msucan
authorRob Campbell <rcampbell@mozilla.com>
Tue, 04 Jun 2013 15:09:00 -0400
changeset 134397 1095f46b02204eb2a276ff506990cf2551086bac
parent 134396 855a29c9dd686ddeb5fdb485a24ca975589d445e
child 134495 a55ab39eda71d5004bb45626db8df91b46cb6bf7
push id1722
push userrcampbell@mozilla.com
push dateMon, 10 Jun 2013 12:16:40 +0000
treeherderfx-team@1095f46b0220 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmsucan
bugs873250
milestone24.0a1
Bug 873250 - Having enter select autocomplete is annoying; r=msucan
browser/devtools/webconsole/test/browser_webconsole_bug_585991_autocomplete_keys.js
browser/devtools/webconsole/webconsole.js
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_585991_autocomplete_keys.js
+++ b/browser/devtools/webconsole/test/browser_webconsole_bug_585991_autocomplete_keys.js
@@ -189,18 +189,22 @@ function testReturnKey()
     is(completeNode.value, prefix + "valueOf",
         "completeNode.value holds valueOf");
 
     popup._panel.addEventListener("popuphidden", function onHidden() {
       popup._panel.removeEventListener("popuphidden", onHidden, false);
 
       ok(!popup.isOpen, "popup is not open after VK_RETURN");
 
-      is(inputNode.value, "window.foobarBug585991.valueOf",
-         "completion was successful after VK_RETURN");
+      // modified by bug 873250
+      is(inputNode.value, "", "no completion after VK_RETURN");
+      isnot(jsterm.lastInputValue, "window.foobarBug585991.valueOf",
+        "lastInputValue is not window.foobarBug585991.valueOf");
+      EventUtils.synthesizeKey("VK_UP", {});
+      is(inputNode.value, jsterm.lastInputValue, "previous entry was lastInputNode")
 
       ok(!completeNode.value, "completeNode is empty");
 
       dontShowArrayNumbers();
     }, false);
 
     EventUtils.synthesizeKey("VK_RETURN", {});
   }, false);
--- a/browser/devtools/webconsole/webconsole.js
+++ b/browser/devtools/webconsole/webconsole.js
@@ -3944,23 +3944,19 @@ JSTerm.prototype = {
           this.clearCompletion();
           aEvent.preventDefault();
         }
         else if (this.sidebar) {
           this._sidebarDestroy();
         }
         break;
 
+      // Bug 873250 - always enter, ignore autocomplete
       case Ci.nsIDOMKeyEvent.DOM_VK_RETURN:
-        if (this.autocompletePopup.isOpen && this.autocompletePopup.selectedIndex > -1) {
-          this.acceptProposedCompletion();
-        }
-        else {
-          this.execute();
-        }
+        this.execute();
         aEvent.preventDefault();
         break;
 
       case Ci.nsIDOMKeyEvent.DOM_VK_UP:
         if (this.autocompletePopup.isOpen) {
           inputUpdated = this.complete(this.COMPLETE_BACKWARD);
         }
         else if (this.canCaretGoPrevious()) {