Commit 8a17e7e5 authored by Paolo Amadini's avatar Paolo Amadini
Browse files

Bug 1524957 - Part 2 - Prevent autocomplete suggestions from other pages in...

Bug 1524957 - Part 2 - Prevent autocomplete suggestions from other pages in the search field. r=bgrins

Differential Revision: https://phabricator.services.mozilla.com/D18564

--HG--
extra : rebase_source : cb7b3f4165fab31d3d79ae17c47826ae2e0b160d
parent 44cd8005
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ body.config-warning {
  min-width: 644px;
}

#search {
#about-config-search {
  box-sizing: border-box;
  width: 100%;
  background-image: url("chrome://global/skin/icons/search-textbox.svg");
+4 −1
Original line number Diff line number Diff line
@@ -44,7 +44,10 @@

    <template id="main">
      <div id="search-container">
        <input type="text" id="search" data-l10n-id="about-config-search">
        <!-- Use a unique ID to prevent showing autocomplete results from other
             browser pages with similarly named fields. -->
        <input type="text" id="about-config-search"
               data-l10n-id="about-config-search">
      </div>

      <table id="prefs"></table>
+3 −3
Original line number Diff line number Diff line
@@ -314,7 +314,7 @@ if (!Preferences.get("browser.aboutConfig.showWarning")) {
  // the value of the textbox has been restored from previous sessions.
  document.addEventListener("DOMContentLoaded", loadPrefs, { once: true });
  window.addEventListener("load", () => {
    if (document.getElementById("search").value) {
    if (document.getElementById("about-config-search").value) {
      filterPrefs();
    }
  }, { once: true });
@@ -334,7 +334,7 @@ function loadPrefs() {
  document.body.textContent = "";
  document.body.appendChild(content);

  let search = document.getElementById("search");
  let search = document.getElementById("about-config-search");
  let prefs = document.getElementById("prefs");
  search.focus();

@@ -391,7 +391,7 @@ function filterPrefs() {
  }
  gDeletedPrefs.clear();

  let searchName = document.getElementById("search").value.trim();
  let searchName = document.getElementById("about-config-search").value.trim();
  gFilterString = searchName.toLowerCase();
  let prefArray = [...gExistingPrefs.values()];
  if (gFilterString) {
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ class AboutConfigTest {
  }

  get searchInput() {
    return this.document.getElementById("search");
    return this.document.getElementById("about-config-search");
  }

  get prefsTable() {
+2 −2
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ add_task(async function test_set_tabstate_and_duplicate() {
     "the tab's state was correctly restored");

  // add text data
  await setInputValue(tab.linkedBrowser, {id: "search", value: value3});
  await setInputValue(tab.linkedBrowser, {id: "about-config-search", value: value3});

  // duplicate the tab
  let tab2 = ss.duplicateTab(window, tab);
@@ -71,7 +71,7 @@ add_task(async function test_set_tabstate_and_duplicate() {
  ok(ss.getCustomTabValue(tab2, key2) == value2 &&
     tab2.linkedBrowser.currentURI.spec == URL,
     "correctly duplicated the tab's state");
  let textbox = await getInputValue(tab2.linkedBrowser, {id: "search"});
  let textbox = await getInputValue(tab2.linkedBrowser, {id: "about-config-search"});
  is(textbox, value3, "also duplicated text data");

  // clean up