Bug 901671 - Control-L should always select the text in the address field [r=rsilveira]
authorMatt Brubeck <mbrubeck@mozilla.com>
Tue, 06 Aug 2013 16:06:37 -0700
changeset 154567 950ab59626ab255251bd22954c3594359c7ee918
parent 154566 7558a07a7ed6f1568584cecd1b93341f356c1478
child 154568 5becd6830a7d7fd5242b447281ceee436c4bdff2
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrsilveira
bugs901671
milestone26.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 901671 - Control-L should always select the text in the address field [r=rsilveira]
browser/metro/base/content/browser-ui.js
browser/metro/base/tests/mochitest/browser_context_ui.js
--- a/browser/metro/base/content/browser-ui.js
+++ b/browser/metro/base/content/browser-ui.js
@@ -1017,16 +1017,17 @@ var BrowserUI = {
         this.goToURI();
         break;
       case "cmd_home":
         this.goToURI(Browser.getHomePage());
         break;
       case "cmd_openLocation":
         ContextUI.displayNavbar();
         this._edit.beginEditing(true);
+        this._edit.select();
         break;
       case "cmd_addBookmark":
         ContextUI.displayNavbar();
         Appbar.onStarButton(true);
         break;
       case "cmd_bookmarks":
         PanelUI.show("bookmarks-container");
         break;
--- a/browser/metro/base/tests/mochitest/browser_context_ui.js
+++ b/browser/metro/base/tests/mochitest/browser_context_ui.js
@@ -79,16 +79,24 @@ gTests.push({
     is(ContextUI.tabbarVisible, false, "Tab bar is not visible");
 
     let edit = document.getElementById("urlbar-edit");
     is(edit.value, "about:", "Location field contains the page URL");
     ok(document.commandDispatcher.focusedElement, edit.inputField, "Location field is focused");
     is(edit.selectionStart, 0, "Location field is selected");
     is(edit.selectionEnd, edit.value.length, "Location field is selected");
 
+    edit.selectionEnd = 0;
+    is(edit.selectionStart, 0, "Location field is unselected");
+    is(edit.selectionEnd, 0, "Location field is unselected");
+
+    EventUtils.synthesizeKey('l', { accelKey: true });
+    is(edit.selectionStart, 0, "Location field is selected again");
+    is(edit.selectionEnd, edit.value.length, "Location field is selected again");
+
     Browser.closeTab(tab, { forceClose: true });
   }
 });
 
 function doEdgeUIGesture() {
   let event = document.createEvent("Events");
   event.initEvent("MozEdgeUICompleted", true, false);
   window.dispatchEvent(event);