Bug 1195054 - The location bar should displays 10 autocomplete suggestions without scrollbar instead of 6. r=mak draft
authorDrew Willcoxon <adw@mozilla.com>
Thu, 07 Apr 2016 12:53:29 -0700
changeset 348640 3f19f64662a82e6b7c655c5f7b25791deb3b1ccd
parent 347957 061165ac1ff9e076ec51ea268878efa751173511
child 517879 7dcbc2823b74e868ebd6da9b69487339961eb28c
push id14858
push userdwillcoxon@mozilla.com
push dateThu, 07 Apr 2016 19:53:44 +0000
reviewersmak
bugs1195054
milestone48.0a1
Bug 1195054 - The location bar should displays 10 autocomplete suggestions without scrollbar instead of 6. r=mak MozReview-Commit-ID: 4U434DF712d
browser/app/profile/firefox.js
browser/base/content/browser.xul
browser/base/content/test/general/browser_autocomplete_autoselect.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -299,17 +299,17 @@ pref("browser.urlbar.unifiedcomplete", t
 // 0: Match anywhere (e.g., middle of words)
 // 1: Match on word boundaries and then try matching anywhere
 // 2: Match only on word boundaries (e.g., after / or .)
 // 3: Match at the beginning of the url or title
 pref("browser.urlbar.matchBehavior", 1);
 pref("browser.urlbar.filter.javascript", true);
 
 // the maximum number of results to show in autocomplete when doing richResults
-pref("browser.urlbar.maxRichResults", 12);
+pref("browser.urlbar.maxRichResults", 10);
 // The amount of time (ms) to wait after the user has stopped typing
 // before starting to perform autocomplete.  50 is the default set in
 // autocomplete.xml.
 pref("browser.urlbar.delay", 50);
 
 // The special characters below can be typed into the urlbar to either restrict
 // the search to visited history, bookmarked, tagged pages; or force a match on
 // just the title text or url.
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -693,17 +693,17 @@
                      autocompletesearchparam="enable-actions"
                      autocompletepopup="PopupAutoCompleteRichResult"
                      completeselectedindex="true"
                      shrinkdelay="250"
                      tabscrolling="true"
                      showcommentcolumn="true"
                      showimagecolumn="true"
                      enablehistory="true"
-                     maxrows="6"
+                     maxrows="10"
                      newlines="stripsurroundingwhitespace"
                      ontextentered="this.handleCommand(param);"
                      ontextreverted="return this.handleRevert();"
                      pageproxystate="invalid"
                      onfocus="document.getElementById('identity-box').style.MozUserFocus= 'normal'"
                      onblur="setTimeout(() => { document.getElementById('identity-box').style.MozUserFocus = ''; }, 0);">
               <box id="notification-popup-box" hidden="true" align="center">
                 <image id="default-notification-icon" class="notification-anchor-icon" role="button"
--- a/browser/base/content/test/general/browser_autocomplete_autoselect.js
+++ b/browser/base/content/test/general/browser_autocomplete_autoselect.js
@@ -11,54 +11,56 @@ function is_selected(index) {
 add_task(function*() {
   // This test is only relevant if UnifiedComplete is enabled.
   let ucpref = Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
   Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
   registerCleanupFunction(() => {
     Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", ucpref);
   });
 
+  let maxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
+
   registerCleanupFunction(function* () {
     yield PlacesTestUtils.clearHistory();
   });
 
   let visits = [];
-  repeat(10, i => {
+  repeat(maxResults, i => {
     visits.push({
       uri: makeURI("http://example.com/autocomplete/?" + i),
     });
   });
   yield PlacesTestUtils.addVisits(visits);
 
   let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
   yield promiseTabLoaded(tab);
   yield promiseAutocompleteResultPopup("example.com/autocomplete");
 
   let popup = gURLBar.popup;
   let results = popup.richlistbox.children;
-  // 1 extra for the current search engine match
-  is(results.length, 11, "Should get 11 results");
+  is(results.length, maxResults,
+     "Should get maxResults=" + maxResults + " results");
   is_selected(0);
 
   info("Key Down to select the next item");
   EventUtils.synthesizeKey("VK_DOWN", {});
   is_selected(1);
 
-  info("Key Down 11 times should wrap around all the way around");
-  repeat(11, () => EventUtils.synthesizeKey("VK_DOWN", {}));
+  info("Key Down maxResults times should wrap around all the way around");
+  repeat(maxResults, () => EventUtils.synthesizeKey("VK_DOWN", {}));
   is_selected(1);
 
-  info("Key Up 11 times should wrap around the other way");
-  repeat(11, () => EventUtils.synthesizeKey("VK_UP", {}));
+  info("Key Up maxResults times should wrap around the other way");
+  repeat(maxResults, () => EventUtils.synthesizeKey("VK_UP", {}));
   is_selected(1);
 
   info("Page Up will go up the list, but not wrap");
   EventUtils.synthesizeKey("VK_PAGE_UP", {})
   is_selected(0);
 
   info("Page Up again will wrap around to the end of the list");
   EventUtils.synthesizeKey("VK_PAGE_UP", {})
-  is_selected(10);
+  is_selected(maxResults - 1);
 
   EventUtils.synthesizeKey("VK_ESCAPE", {});
   yield promisePopupHidden(gURLBar.popup);
   gBrowser.removeTab(tab);
 });