Bug 1580808 - Change UrlbarTestUtils.get[set]SelectedIndex to get[set]SelectedRowIndex. r=adw
authorHarry Twyford <htwyford@mozilla.com>
Thu, 12 Sep 2019 21:05:22 +0000
changeset 554497 173761e4fd6620f93d5b8b1c54f657524f3c4152
parent 554496 72d9ad70e1ba7d56e9e3732cfd912f53c348a9a8
child 554498 f26512d3707796059727bf53542e473c1fa01a17
push id12169
push userffxbld-merge
push dateMon, 14 Oct 2019 16:59:29 +0000
treeherdermozilla-beta@c819687300ed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1580808
milestone71.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 1580808 - Change UrlbarTestUtils.get[set]SelectedIndex to get[set]SelectedRowIndex. r=adw Depends on D45455 Differential Revision: https://phabricator.services.mozilla.com/D45724
browser/components/urlbar/tests/UrlbarTestUtils.jsm
browser/components/urlbar/tests/browser/browser_autoFill_preserve.js
browser/components/urlbar/tests/browser/browser_autocomplete_autoselect.js
browser/components/urlbar/tests/browser/browser_autocomplete_edit_completed.js
browser/components/urlbar/tests/browser/browser_autocomplete_readline_navigation.js
browser/components/urlbar/tests/browser/browser_caret_navigation.js
browser/components/urlbar/tests/browser/browser_downArrowKeySearch.js
browser/components/urlbar/tests/browser/browser_keyword_select_and_type.js
browser/components/urlbar/tests/browser/browser_restoreEmptyInput.js
browser/components/urlbar/tests/browser/browser_selectStaleResults.js
browser/components/urlbar/tests/browser/browser_selectionKeyNavigation.js
browser/components/urlbar/tests/browser/browser_switchTab_decodeuri.js
browser/components/urlbar/tests/browser/browser_switchTab_override.js
browser/components/urlbar/tests/browser/browser_tabMatchesInAwesomebar_perwindowpb.js
browser/components/urlbar/tests/browser/browser_tip_keyboard_selection.js
browser/components/urlbar/tests/browser/browser_urlbarDecode.js
browser/components/urlbar/tests/browser/browser_urlbarEnterAfterMouseOver.js
browser/components/urlbar/tests/browser/browser_urlbarOneOffs.js
browser/components/urlbar/tests/browser/browser_urlbarOneOffs_searchSuggestions.js
browser/components/urlbar/tests/browser/browser_urlbar_remove_match.js
browser/modules/test/browser/browser_UsageTelemetry_urlbar.js
toolkit/components/extensions/test/browser/browser_ext_themes_autocomplete_popup.js
--- a/browser/components/urlbar/tests/UrlbarTestUtils.jsm
+++ b/browser/components/urlbar/tests/UrlbarTestUtils.jsm
@@ -186,26 +186,26 @@ var UrlbarTestUtils = {
     return win.gURLBar.view._getSelectedRow() || null;
   },
 
   /**
    * Gets the index of the currently selected element.
    * @param {object} win The window containing the urlbar.
    * @returns {number} The selected index.
    */
-  getSelectedIndex(win) {
+  getSelectedRowIndex(win) {
     return win.gURLBar.view.selectedRowIndex;
   },
 
   /**
    * Selects the element at the index specified.
    * @param {object} win The window containing the urlbar.
    * @param {index} index The index to select.
    */
-  setSelectedIndex(win, index) {
+  setSelectedRowIndex(win, index) {
     win.gURLBar.view.selectedRowIndex = index;
   },
 
   /**
    * Gets the number of results.
    * You must wait for the query to be complete before using this.
    * @param {object} win The window containing the urlbar
    * @returns {number} the number of results.
--- a/browser/components/urlbar/tests/browser/browser_autoFill_preserve.js
+++ b/browser/components/urlbar/tests/browser/browser_autoFill_preserve.js
@@ -210,17 +210,17 @@ add_task(async function backspaceNoAutof
   ]);
 
   await cleanUp();
 });
 
 function checkKeys(testTuples) {
   for (let [key, value, selectedIndex] of testTuples) {
     EventUtils.synthesizeKey(key);
-    Assert.equal(UrlbarTestUtils.getSelectedIndex(window), selectedIndex);
+    Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), selectedIndex);
     Assert.equal(gURLBar.untrimmedValue, value);
   }
 }
 
 async function cleanUp() {
   EventUtils.synthesizeKey("KEY_Escape");
   await UrlbarTestUtils.promisePopupClose(window);
   await PlacesUtils.bookmarks.eraseEverything();
--- a/browser/components/urlbar/tests/browser/browser_autocomplete_autoselect.js
+++ b/browser/components/urlbar/tests/browser/browser_autocomplete_autoselect.js
@@ -13,17 +13,17 @@ const ONEOFF_URLBAR_PREF = "browser.urlb
 function repeat(limit, func) {
   for (let i = 0; i < limit; i++) {
     func(i);
   }
 }
 
 function assertSelected(index) {
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     index,
     "Should have selected the correct item"
   );
   // Also check the "selected" attribute, to ensure it is not a "fake" selection
   // due to binding misbehaviors.
   let element = UrlbarTestUtils.getSelectedRow(window);
   Assert.ok(
     element.hasAttribute("selected"),
@@ -44,17 +44,17 @@ function assertSelected_one_off(index) {
     UrlbarTestUtils.getOneOffSearchButtons(window).selectedButtonIndex,
     index,
     "Expected one-off button should be selected"
   );
 
   // This is true because although both the listbox and the one-offs can have
   // selections, the test doesn't check that.
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     -1,
     "A one-off is selected, so the listbox should not have a selection"
   );
 }
 
 add_task(async function() {
   let maxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
   Services.prefs.setBoolPref(ONEOFF_URLBAR_PREF, true);
--- a/browser/components/urlbar/tests/browser/browser_autocomplete_edit_completed.js
+++ b/browser/components/urlbar/tests/browser/browser_autocomplete_edit_completed.js
@@ -19,44 +19,44 @@ add_task(async function() {
   );
   registerCleanupFunction(async function() {
     BrowserTestUtils.removeTab(tab);
     await PlacesUtils.history.clear();
   });
 
   await promiseAutocompleteResultPopup("http://example.com");
 
-  const initialIndex = UrlbarTestUtils.getSelectedIndex(window);
+  const initialIndex = UrlbarTestUtils.getSelectedRowIndex(window);
 
   info("Key Down to select the next item.");
   EventUtils.synthesizeKey("KEY_ArrowDown");
 
   let nextIndex = initialIndex + 1;
   let nextResult = await UrlbarTestUtils.getDetailsOfResultAt(
     window,
     nextIndex
   );
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     nextIndex,
     "Should have selected the next item"
   );
   Assert.equal(
     gURLBar.untrimmedValue,
     nextResult.url,
     "Should have completed the URL"
   );
 
   info("Press backspace");
   EventUtils.synthesizeKey("KEY_Backspace");
   await promiseSearchComplete();
 
   let editedValue = gURLBar.value;
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     initialIndex,
     "Should have selected the initialIndex again"
   );
   Assert.notEqual(editedValue, nextResult.url, "The URL has changed.");
 
   let docLoad = BrowserTestUtils.waitForDocLoadAndStopIt(
     "http://" + editedValue,
     gBrowser.selectedBrowser
--- a/browser/components/urlbar/tests/browser/browser_autocomplete_readline_navigation.js
+++ b/browser/components/urlbar/tests/browser/browser_autocomplete_readline_navigation.js
@@ -12,17 +12,17 @@ const ONEOFF_URLBAR_PREF = "browser.urlb
 function repeat(limit, func) {
   for (let i = 0; i < limit; i++) {
     func(i);
   }
 }
 
 function assertSelected(index) {
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     index,
     "Should have the correct item selected"
   );
 
   // This is true because although both the listbox and the one-offs can have
   // selections, the test doesn't check that.
   Assert.equal(
     UrlbarTestUtils.getOneOffSearchButtons(window).selectedButton,
--- a/browser/components/urlbar/tests/browser/browser_caret_navigation.js
+++ b/browser/components/urlbar/tests/browser/browser_caret_navigation.js
@@ -71,17 +71,17 @@ async function checkCaretMoves(key, pos,
 async function checkPopupOpens(key) {
   // Store current selection and check it doesn't change.
   let selectionStart = gURLBar.selectionStart;
   let selectionEnd = gURLBar.selectionEnd;
   await UrlbarTestUtils.promisePopupOpen(window, () => {
     checkIfKeyStartsQuery(key, true);
   });
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     `${key}: Heuristic result should be selected`
   );
   Assert.equal(
     gURLBar.selectionStart,
     selectionStart,
     `${key}: Input selection start should not change`
   );
--- a/browser/components/urlbar/tests/browser/browser_downArrowKeySearch.js
+++ b/browser/components/urlbar/tests/browser/browser_downArrowKeySearch.js
@@ -16,41 +16,41 @@ add_task(async function init() {
 
 add_task(async function url() {
   await BrowserTestUtils.withNewTab("http://example.com/", async () => {
     gURLBar.focus();
     gURLBar.selectionEnd = gURLBar.untrimmedValue.length;
     gURLBar.selectionStart = gURLBar.untrimmedValue.length;
     EventUtils.synthesizeKey("KEY_ArrowDown");
     await UrlbarTestUtils.promiseSearchComplete(window);
-    Assert.equal(UrlbarTestUtils.getSelectedIndex(window), 0);
+    Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), 0);
     let details = await UrlbarTestUtils.getDetailsOfResultAt(window, 0);
     Assert.ok(details.autofill);
     Assert.equal(details.url, "http://example.com/");
     Assert.equal(gURLBar.value, "example.com/");
     await UrlbarTestUtils.promisePopupClose(window);
   });
 });
 
 add_task(async function userTyping() {
   await promiseAutocompleteResultPopup("foo", window, true);
   await UrlbarTestUtils.promisePopupClose(window);
   EventUtils.synthesizeKey("KEY_ArrowDown");
   await UrlbarTestUtils.promiseSearchComplete(window);
-  Assert.equal(UrlbarTestUtils.getSelectedIndex(window), 0);
+  Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), 0);
   let details = await UrlbarTestUtils.getDetailsOfResultAt(window, 0);
   Assert.equal(details.type, UrlbarUtils.RESULT_TYPE.SEARCH);
   Assert.ok(details.searchParams);
   Assert.equal(details.searchParams.query, "foo");
   Assert.equal(gURLBar.value, "foo");
   await UrlbarTestUtils.promisePopupClose(window);
 });
 
 add_task(async function empty() {
   await promiseAutocompleteResultPopup("", window, true);
   await UrlbarTestUtils.promisePopupClose(window);
   EventUtils.synthesizeKey("KEY_ArrowDown");
   await UrlbarTestUtils.promiseSearchComplete(window);
-  Assert.equal(UrlbarTestUtils.getSelectedIndex(window), -1);
+  Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), -1);
   let details = await UrlbarTestUtils.getDetailsOfResultAt(window, 0);
   Assert.equal(details.url, "http://example.com/");
   Assert.equal(gURLBar.value, "");
 });
--- a/browser/components/urlbar/tests/browser/browser_keyword_select_and_type.js
+++ b/browser/components/urlbar/tests/browser/browser_keyword_select_and_type.js
@@ -42,33 +42,33 @@ add_task(async function() {
     gBrowser,
     "about:mozilla"
   );
   await promiseAutocompleteResultPopup("keyword a");
   await waitForAutocompleteResultAt(1);
 
   // First item should already be selected
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     "Should have the first item selected"
   );
 
   // Select next one (important!)
   EventUtils.synthesizeKey("KEY_ArrowDown");
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     1,
     "Should have the second item selected"
   );
 
   // Re-select keyword item
   EventUtils.synthesizeKey("KEY_ArrowUp");
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     "Should have the first item selected"
   );
 
   EventUtils.sendString("b");
   await promiseSearchComplete();
 
   Assert.equal(
--- a/browser/components/urlbar/tests/browser/browser_restoreEmptyInput.js
+++ b/browser/components/urlbar/tests/browser/browser_restoreEmptyInput.js
@@ -10,34 +10,34 @@ add_task(async function test() {
   await PlacesTestUtils.addVisits("http://example.com/");
   registerCleanupFunction(async function() {
     await PlacesUtils.history.clear();
   });
 
   await promiseAutocompleteResultPopup("", window, true);
 
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     -1,
     "Nothing selected"
   );
 
   let resultCount = UrlbarTestUtils.getResultCount(window);
   Assert.ok(resultCount > 0, "At least one result");
 
   for (let i = 0; i < resultCount; i++) {
     EventUtils.synthesizeKey("KEY_ArrowDown");
   }
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     resultCount - 1,
     "Last result selected"
   );
   Assert.notEqual(gURLBar.value, "", "Input should not be empty");
 
   EventUtils.synthesizeKey("KEY_ArrowDown");
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     -1,
     "Nothing selected"
   );
   Assert.equal(gURLBar.value, "", "Input should be empty");
 });
--- a/browser/components/urlbar/tests/browser/browser_selectStaleResults.js
+++ b/browser/components/urlbar/tests/browser/browser_selectStaleResults.js
@@ -99,30 +99,30 @@ add_task(async function viewContainsStal
     gURLBar.view._isElementVisible(r)
   );
   Assert.equal(items.length, maxResults);
 
   // Arrow down through all the results.  After arrowing down from the last "xx"
   // result, the stale "x" results should be selected.  We should *not* enter
   // the one-off search buttons at that point.
   for (let i = 1; i < maxResults; i++) {
-    Assert.equal(UrlbarTestUtils.getSelectedIndex(window), i);
+    Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), i);
     let result = await UrlbarTestUtils.getDetailsOfResultAt(window, i);
     Assert.equal(result.element.row.result.uiIndex, i);
     EventUtils.synthesizeKey("KEY_ArrowDown");
   }
 
   // Now the first one-off should be selected.
-  Assert.equal(UrlbarTestUtils.getSelectedIndex(window), -1);
+  Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), -1);
   Assert.equal(gURLBar.view.oneOffSearchButtons.selectedButtonIndex, 0);
 
   // Arrow back up through all the results.
   for (let i = maxResults - 1; i >= 0; i--) {
     EventUtils.synthesizeKey("KEY_ArrowUp");
-    Assert.equal(UrlbarTestUtils.getSelectedIndex(window), i);
+    Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), i);
   }
 
   await UrlbarTestUtils.promisePopupClose(window, () =>
     EventUtils.synthesizeKey("KEY_Escape")
   );
 });
 
 // This tests the case where, before the search finishes, stale results have
@@ -266,28 +266,28 @@ add_task(async function staleReplacedWit
     Assert.equal(result.title, "test" + (maxResults - i));
     Assert.equal(result.element.row.result.uiIndex, i);
   }
 
   // Arrow down through all the results.  After arrowing down from "test3", we
   // should continue on to "test2".  We should *not* enter the one-off search
   // buttons at that point.
   for (let i = 1; i < maxResults; i++) {
-    Assert.equal(UrlbarTestUtils.getSelectedIndex(window), i);
+    Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), i);
     EventUtils.synthesizeKey("KEY_ArrowDown");
   }
 
   // Now the first one-off should be selected.
-  Assert.equal(UrlbarTestUtils.getSelectedIndex(window), -1);
+  Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), -1);
   Assert.equal(gURLBar.view.oneOffSearchButtons.selectedButtonIndex, 0);
 
   // Arrow back up through all the results.
   for (let i = maxResults - 1; i >= 0; i--) {
     EventUtils.synthesizeKey("KEY_ArrowUp");
-    Assert.equal(UrlbarTestUtils.getSelectedIndex(window), i);
+    Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), i);
   }
 
   await UrlbarTestUtils.promisePopupClose(window, () =>
     EventUtils.synthesizeKey("KEY_Escape")
   );
   await SpecialPowers.popPrefEnv();
   await Services.search.setDefault(oldDefaultEngine);
 });
--- a/browser/components/urlbar/tests/browser/browser_selectionKeyNavigation.js
+++ b/browser/components/urlbar/tests/browser/browser_selectionKeyNavigation.js
@@ -15,154 +15,157 @@ add_task(async function init() {
   registerCleanupFunction(async function() {
     await PlacesUtils.history.clear();
   });
 });
 
 add_task(async function downKey() {
   await promiseAutocompleteResultPopup("exam", window, true);
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     "The heuristic autofill result should be selected initially"
   );
   for (let i = 1; i < MAX_RESULTS; i++) {
     EventUtils.synthesizeKey("KEY_ArrowDown");
-    Assert.equal(UrlbarTestUtils.getSelectedIndex(window), i);
+    Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), i);
   }
   EventUtils.synthesizeKey("KEY_ArrowDown");
   let oneOffs = UrlbarTestUtils.getOneOffSearchButtons(window);
   Assert.ok(oneOffs.selectedButton, "A one-off should now be selected");
   while (oneOffs.selectedButton) {
     EventUtils.synthesizeKey("KEY_ArrowDown");
   }
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     "The heuristic autofill result should be selected again"
   );
 });
 
 add_task(async function upKey() {
   await promiseAutocompleteResultPopup("exam", window, true);
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     "The heuristic autofill result should be selected initially"
   );
   EventUtils.synthesizeKey("KEY_ArrowUp");
   let oneOffs = UrlbarTestUtils.getOneOffSearchButtons(window);
   Assert.ok(oneOffs.selectedButton, "A one-off should now be selected");
   while (oneOffs.selectedButton) {
     EventUtils.synthesizeKey("KEY_ArrowUp");
   }
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     MAX_RESULTS - 1,
     "The last result should be selected"
   );
   for (let i = 1; i < MAX_RESULTS; i++) {
     EventUtils.synthesizeKey("KEY_ArrowUp");
-    Assert.equal(UrlbarTestUtils.getSelectedIndex(window), MAX_RESULTS - i - 1);
+    Assert.equal(
+      UrlbarTestUtils.getSelectedRowIndex(window),
+      MAX_RESULTS - i - 1
+    );
   }
 });
 
 add_task(async function pageDownKey() {
   await promiseAutocompleteResultPopup("exam", window, true);
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     "The heuristic autofill result should be selected initially"
   );
   let pageCount = Math.ceil((MAX_RESULTS - 1) / UrlbarUtils.PAGE_UP_DOWN_DELTA);
   for (let i = 0; i < pageCount; i++) {
     EventUtils.synthesizeKey("KEY_PageDown");
     Assert.equal(
-      UrlbarTestUtils.getSelectedIndex(window),
+      UrlbarTestUtils.getSelectedRowIndex(window),
       Math.min((i + 1) * UrlbarUtils.PAGE_UP_DOWN_DELTA, MAX_RESULTS - 1)
     );
   }
   EventUtils.synthesizeKey("KEY_PageDown");
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     "Page down at end should wrap around to first result"
   );
 });
 
 add_task(async function pageUpKey() {
   await promiseAutocompleteResultPopup("exam", window, true);
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     "The heuristic autofill result should be selected initially"
   );
   EventUtils.synthesizeKey("KEY_PageUp");
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     MAX_RESULTS - 1,
     "Page up at start should wrap around to last result"
   );
   let pageCount = Math.ceil((MAX_RESULTS - 1) / UrlbarUtils.PAGE_UP_DOWN_DELTA);
   for (let i = 0; i < pageCount; i++) {
     EventUtils.synthesizeKey("KEY_PageUp");
     Assert.equal(
-      UrlbarTestUtils.getSelectedIndex(window),
+      UrlbarTestUtils.getSelectedRowIndex(window),
       Math.max(MAX_RESULTS - 1 - (i + 1) * UrlbarUtils.PAGE_UP_DOWN_DELTA, 0)
     );
   }
 });
 
 add_task(async function pageDownKeyShowsView() {
   await promiseAutocompleteResultPopup("exam", window, true);
   await UrlbarTestUtils.promisePopupClose(window);
   EventUtils.synthesizeKey("KEY_PageDown");
   await UrlbarTestUtils.promiseSearchComplete(window);
   Assert.ok(UrlbarTestUtils.isPopupOpen(window));
-  Assert.equal(UrlbarTestUtils.getSelectedIndex(window), 0);
+  Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), 0);
 });
 
 add_task(async function pageUpKeyShowsView() {
   await promiseAutocompleteResultPopup("exam", window, true);
   await UrlbarTestUtils.promisePopupClose(window);
   EventUtils.synthesizeKey("KEY_PageUp");
   await UrlbarTestUtils.promiseSearchComplete(window);
   Assert.ok(UrlbarTestUtils.isPopupOpen(window));
-  Assert.equal(UrlbarTestUtils.getSelectedIndex(window), 0);
+  Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), 0);
 });
 
 add_task(async function tabKey() {
   await promiseAutocompleteResultPopup("exam", window, true);
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     "The heuristic autofill result should be selected initially"
   );
   for (let i = 1; i < MAX_RESULTS; i++) {
     EventUtils.synthesizeKey("KEY_Tab");
-    Assert.equal(UrlbarTestUtils.getSelectedIndex(window), i);
+    Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), i);
   }
   EventUtils.synthesizeKey("KEY_Tab");
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     "The heuristic autofill result should be selected again"
   );
 });
 
 add_task(async function tabKeyReverse() {
   await promiseAutocompleteResultPopup("exam", window, true);
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     "The heuristic autofill result should be selected initially"
   );
   for (let i = 1; i < MAX_RESULTS; i++) {
     EventUtils.synthesizeKey("KEY_Tab", { shiftKey: true });
-    Assert.equal(UrlbarTestUtils.getSelectedIndex(window), MAX_RESULTS - i);
+    Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), MAX_RESULTS - i);
   }
 });
 
 add_task(async function tabKeyBlur() {
   await promiseAutocompleteResultPopup("exam", window, true);
   await UrlbarTestUtils.promisePopupClose(window);
   Assert.equal(document.activeElement, gURLBar.inputField);
   EventUtils.synthesizeKey("KEY_Tab");
--- a/browser/components/urlbar/tests/browser/browser_switchTab_decodeuri.js
+++ b/browser/components/urlbar/tests/browser/browser_switchTab_decodeuri.js
@@ -19,17 +19,17 @@ add_task(async function test_switchtab_d
 
   info("Wait for autocomplete");
   await promiseAutocompleteResultPopup("dummy_page");
 
   info("Select autocomplete popup entry");
   EventUtils.synthesizeKey("KEY_ArrowDown");
   let result = await UrlbarTestUtils.getDetailsOfResultAt(
     window,
-    UrlbarTestUtils.getSelectedIndex(window)
+    UrlbarTestUtils.getSelectedRowIndex(window)
   );
   Assert.equal(result.type, UrlbarUtils.RESULT_TYPE.TAB_SWITCH);
 
   info("switch-to-tab");
   let tabSelectPromise = BrowserTestUtils.waitForEvent(
     window,
     "TabSelect",
     false
--- a/browser/components/urlbar/tests/browser/browser_switchTab_override.js
+++ b/browser/components/urlbar/tests/browser/browser_switchTab_override.js
@@ -28,17 +28,17 @@ add_task(async function test_switchtab_o
 
   info("Wait for autocomplete");
   await promiseAutocompleteResultPopup("dummy_page");
 
   info("Select second autocomplete popup entry");
   EventUtils.synthesizeKey("KEY_ArrowDown");
   let result = await UrlbarTestUtils.getDetailsOfResultAt(
     window,
-    UrlbarTestUtils.getSelectedIndex(window)
+    UrlbarTestUtils.getSelectedRowIndex(window)
   );
   Assert.equal(result.type, UrlbarUtils.RESULT_TYPE.TAB_SWITCH);
 
   // Check to see if the switchtab label is visible and
   // all other labels are hidden
   const allLabels = document.getElementById("urlbar-label-box").children;
   for (let label of allLabels) {
     if (label.id == "urlbar-label-switchtab") {
--- a/browser/components/urlbar/tests/browser/browser_tabMatchesInAwesomebar_perwindowpb.js
+++ b/browser/components/urlbar/tests/browser/browser_tabMatchesInAwesomebar_perwindowpb.js
@@ -84,17 +84,17 @@ async function runTest(aSourceWindow, aD
 
   // Wait for the Awesomebar popup to appear.
   let searchString = TEST_URL;
   await promiseAutocompleteResultPopup(searchString, aDestWindow);
 
   info(`awesomebar popup appeared. aExpectSwitch: ${aExpectSwitch}`);
   // Make sure the last match is selected.
   while (
-    UrlbarTestUtils.getSelectedIndex(aDestWindow) <
+    UrlbarTestUtils.getSelectedRowIndex(aDestWindow) <
     UrlbarTestUtils.getResultCount(aDestWindow) - 1
   ) {
     info("handling key navigation for DOM_VK_DOWN key");
     EventUtils.synthesizeKey("KEY_ArrowDown", {}, aDestWindow);
   }
 
   let awaitTabSwitch;
   if (aExpectSwitch) {
--- a/browser/components/urlbar/tests/browser/browser_tip_keyboard_selection.js
+++ b/browser/components/urlbar/tests/browser/browser_tip_keyboard_selection.js
@@ -95,50 +95,50 @@ add_task(async function tipIsSecondResul
   Assert.equal(
     secondResult.type,
     UrlbarUtils.RESULT_TYPE.TIP,
     "The second result should be a tip."
   );
 
   EventUtils.synthesizeKey("KEY_ArrowDown");
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     "The first result should be selected."
   );
 
   EventUtils.synthesizeKey("KEY_ArrowDown");
   Assert.ok(
     UrlbarTestUtils.getSelectedElement(window).classList.contains(
       "urlbarView-tip-button"
     ),
     "The selected element should be the tip button."
   );
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     1,
     "getSelectedIndex should return 1 even though the tip button is selected."
   );
 
   EventUtils.synthesizeKey("KEY_ArrowDown");
   Assert.ok(
     UrlbarTestUtils.getSelectedElement(window).classList.contains(
       "urlbarView-tip-help"
     ),
     "The selected element should be the tip help button."
   );
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     1,
     "getSelectedIndex should return 1 even though the help button is selected."
   );
 
   EventUtils.synthesizeKey("KEY_ArrowDown");
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     2,
     "The third result should be selected."
   );
 
   EventUtils.synthesizeKey("KEY_ArrowUp");
   Assert.ok(
     UrlbarTestUtils.getSelectedElement(window).classList.contains(
       "urlbarView-tip-help"
@@ -189,37 +189,37 @@ add_task(async function tipIsOnlyResult(
   EventUtils.synthesizeKey("KEY_ArrowDown");
   Assert.ok(
     UrlbarTestUtils.getSelectedElement(window).classList.contains(
       "urlbarView-tip-button"
     ),
     "The selected element should be the tip button."
   );
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     "getSelectedIndex should return 0."
   );
 
   EventUtils.synthesizeKey("KEY_ArrowDown");
   Assert.ok(
     UrlbarTestUtils.getSelectedElement(window).classList.contains(
       "urlbarView-tip-help"
     ),
     "The selected element should be the tip help button."
   );
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     0,
     "getSelectedIndex should return 0."
   );
 
   EventUtils.synthesizeKey("KEY_ArrowDown");
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     -1,
     "There should be no selection."
   );
 
   EventUtils.synthesizeKey("KEY_ArrowUp");
   Assert.ok(
     UrlbarTestUtils.getSelectedElement(window).classList.contains(
       "urlbarView-tip-help"
--- a/browser/components/urlbar/tests/browser/browser_urlbarDecode.js
+++ b/browser/components/urlbar/tests/browser/browser_urlbarDecode.js
@@ -58,17 +58,17 @@ add_task(async function actionURILossles
   await promiseAutocompleteResultPopup(url);
 
   // At this point the heuristic result is selected but the urlbar's value is
   // simply `url`.  Key down and back around until the heuristic result is
   // selected again, and at that point the urlbar's value should be a visiturl
   // moz-action.
   do {
     EventUtils.synthesizeKey("KEY_ArrowDown");
-  } while (UrlbarTestUtils.getSelectedIndex(window) != 0);
+  } while (UrlbarTestUtils.getSelectedRowIndex(window) != 0);
 
   let result = await UrlbarTestUtils.getDetailsOfResultAt(window, 0);
 
   Assert.equal(
     result.type,
     UrlbarUtils.RESULT_TYPE.URL,
     "Should have selected a result of URL type"
   );
--- a/browser/components/urlbar/tests/browser/browser_urlbarEnterAfterMouseOver.js
+++ b/browser/components/urlbar/tests/browser/browser_urlbarEnterAfterMouseOver.js
@@ -17,17 +17,17 @@ async function promiseAutoComplete(input
   gURLBar.focus();
   gURLBar.value = inputText.slice(0, -1);
   EventUtils.sendString(inputText.slice(-1));
   await promiseSearchComplete();
 }
 
 function assertSelected(index) {
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     index,
     "Should have the correct index selected"
   );
 }
 
 let gMaxResults;
 
 add_task(async function() {
@@ -51,17 +51,17 @@ add_task(async function() {
   await promiseAutoComplete("http://example.com/autocomplete/");
 
   Assert.equal(
     UrlbarTestUtils.getResultCount(window),
     gMaxResults,
     "Should have got the correct amount of results"
   );
 
-  let initiallySelected = UrlbarTestUtils.getSelectedIndex(window);
+  let initiallySelected = UrlbarTestUtils.getSelectedRowIndex(window);
 
   info("Key Down to select the next item");
   EventUtils.synthesizeKey("KEY_ArrowDown");
   assertSelected(initiallySelected + 1);
 
   let result = await UrlbarTestUtils.getDetailsOfResultAt(
     window,
     initiallySelected + 1
--- a/browser/components/urlbar/tests/browser/browser_urlbarOneOffs.js
+++ b/browser/components/urlbar/tests/browser/browser_urlbarOneOffs.js
@@ -252,17 +252,17 @@ add_task(async function hiddenWhenUsingS
     true,
     "Should be showing the one-off buttons"
   );
   await hidePopup();
 });
 
 function assertState(result, oneOff, textValue = undefined) {
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     result,
     "Expected result should be selected"
   );
   Assert.equal(
     oneOffSearchButtons.selectedButtonIndex,
     oneOff,
     "Expected one-off should be selected"
   );
--- a/browser/components/urlbar/tests/browser/browser_urlbarOneOffs_searchSuggestions.js
+++ b/browser/components/urlbar/tests/browser/browser_urlbarOneOffs_searchSuggestions.js
@@ -189,17 +189,17 @@ add_task(async function overridden_engin
       label,
       "The label should have been updated"
     );
   });
 });
 
 function assertState(result, oneOff, textValue = undefined) {
   Assert.equal(
-    UrlbarTestUtils.getSelectedIndex(window),
+    UrlbarTestUtils.getSelectedRowIndex(window),
     result,
     "Expected result should be selected"
   );
   Assert.equal(
     UrlbarTestUtils.getOneOffSearchButtons(window).selectedButtonIndex,
     oneOff,
     "Expected one-off should be selected"
   );
--- a/browser/components/urlbar/tests/browser/browser_urlbar_remove_match.js
+++ b/browser/components/urlbar/tests/browser/browser_urlbar_remove_match.js
@@ -18,17 +18,17 @@ add_task(async function test_remove_hist
   await promiseAutocompleteResultPopup("from_urlbar");
 
   let result = await UrlbarTestUtils.getDetailsOfResultAt(window, 1);
   Assert.equal(result.url, TEST_URL, "Found the expected result");
 
   let expectedResultCount = UrlbarTestUtils.getResultCount(window) - 1;
 
   EventUtils.synthesizeKey("KEY_ArrowDown");
-  Assert.equal(UrlbarTestUtils.getSelectedIndex(window), 1);
+  Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), 1);
   EventUtils.synthesizeKey("KEY_Delete", { shiftKey: true });
   await promiseVisitRemoved;
   await TestUtils.waitForCondition(
     () => UrlbarTestUtils.getResultCount(window) == expectedResultCount,
     "Waiting for the result to disappear"
   );
 
   for (let i = 0; i < expectedResultCount; i++) {
@@ -56,17 +56,17 @@ add_task(async function test_remove_book
     await PlacesUtils.bookmarks.eraseEverything();
   });
 
   await promiseAutocompleteResultPopup("from_urlbar");
   let result = await UrlbarTestUtils.getDetailsOfResultAt(window, 1);
   Assert.equal(result.url, TEST_URL, "Found the expected result");
 
   EventUtils.synthesizeKey("KEY_ArrowDown");
-  Assert.equal(UrlbarTestUtils.getSelectedIndex(window), 1);
+  Assert.equal(UrlbarTestUtils.getSelectedRowIndex(window), 1);
   EventUtils.synthesizeKey("KEY_Delete", { shiftKey: true });
 
   // We don't have an easy way of determining if the event was process or not,
   // so let any event queues clear before testing.
   await new Promise(resolve => setTimeout(resolve, 0));
   await PlacesTestUtils.promiseAsyncUpdates();
 
   Assert.ok(
--- a/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js
+++ b/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js
@@ -735,17 +735,17 @@ add_task(async function test_suggestion_
       gBrowser,
       "about:blank"
     );
 
     info("Type a query. Suggestions should be generated by the test engine.");
     let p = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
     await searchInAwesomebar("query");
     info("Select the second result and press Return.");
-    UrlbarTestUtils.setSelectedIndex(window, 1);
+    UrlbarTestUtils.setSelectedRowIndex(window, 1);
     EventUtils.synthesizeKey("KEY_Enter");
     await p;
 
     TelemetryTestUtils.assertHistogram(
       resultMethodHist,
       URLBAR_SELECTED_RESULT_METHODS.enterSelection,
       1
     );
--- a/toolkit/components/extensions/test/browser/browser_ext_themes_autocomplete_popup.js
+++ b/toolkit/components/extensions/test/browser/browser_ext_themes_autocomplete_popup.js
@@ -118,17 +118,17 @@ add_task(async function test_popup_url()
 
   Assert.equal(
     popupCS.color,
     `rgb(${hexToRGB(POPUP_TEXT_COLOR_DARK).join(", ")})`,
     `Popup color should be set to ${POPUP_TEXT_COLOR_DARK}`
   );
 
   // Set the selected attribute to true to test the highlight popup properties
-  UrlbarTestUtils.setSelectedIndex(window, 1);
+  UrlbarTestUtils.setSelectedRowIndex(window, 1);
   let actionResult = await UrlbarTestUtils.getDetailsOfResultAt(window, 0);
   let urlResult = await UrlbarTestUtils.getDetailsOfResultAt(window, 1);
   let resultCS = window.getComputedStyle(urlResult.element.row);
 
   Assert.equal(
     resultCS.backgroundColor,
     `rgb(${hexToRGB(POPUP_SELECTED_COLOR).join(", ")})`,
     `Popup highlight background color should be set to ${POPUP_SELECTED_COLOR}`
@@ -137,17 +137,17 @@ add_task(async function test_popup_url()
   Assert.equal(
     resultCS.color,
     `rgb(${hexToRGB(POPUP_SELECTED_TEXT_COLOR).join(", ")})`,
     `Popup highlight color should be set to ${POPUP_SELECTED_TEXT_COLOR}`
   );
 
   // Now set the index to somewhere not on the first two, so that we can test both
   // url and action text colors.
-  UrlbarTestUtils.setSelectedIndex(window, 2);
+  UrlbarTestUtils.setSelectedRowIndex(window, 2);
 
   Assert.equal(
     window.getComputedStyle(urlResult.element.url).color,
     `rgb(${hexToRGB(POPUP_URL_COLOR_DARK).join(", ")})`,
     `Urlbar popup url color should be set to ${POPUP_URL_COLOR_DARK}`
   );
 
   Assert.equal(