Backed out 2 changesets (bug 1499193, bug 1504370) for failing bc at browser/modules/test/browser/browser_UsageTelemetry_urlbar.js a=backout DEVEDITION_64_0b9_BUILD1 DEVEDITION_64_0b9_RELEASE FENNEC_64_0b9_BUILD1 FENNEC_64_0b9_RELEASE FIREFOX_64_0b9_BUILD1 FIREFOX_64_0b9_RELEASE
authorRazvan Maries <rmaries@mozilla.com>
Mon, 12 Nov 2018 18:44:38 +0200
changeset 498457 6226ce7f4038d566fe750b1d13f107146d137463
parent 498456 d74a918ff930da31a1ef3ad019ae27fdc75b0d44
child 498458 36804d86a9c09f60785cdbd8ccbedd496692ed02
push id10168
push userrmaries@mozilla.com
push dateMon, 12 Nov 2018 16:45:19 +0000
treeherdermozilla-beta@6226ce7f4038 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1499193, 1504370
milestone64.0
backs outa106808198a6b0eac935d7bf9cecc3fb9d5a975a
f7221b7dad3fac285b301f3b43275c76854f79a7
Backed out 2 changesets (bug 1499193, bug 1504370) for failing bc at browser/modules/test/browser/browser_UsageTelemetry_urlbar.js a=backout Backed out changeset a106808198a6 (bug 1504370) Backed out changeset f7221b7dad3f (bug 1499193)
browser/base/content/browser.js
browser/base/content/urlbarBindings.xml
browser/components/extensions/parent/ext-search.js
browser/modules/BrowserUsageTelemetry.jsm
browser/modules/test/browser/browser_UsageTelemetry_urlbar.js
browser/modules/test/browser/head.js
toolkit/components/search/nsSearchService.js
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/histogram-whitelists.json
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4229,17 +4229,17 @@ const BrowserSearch = {
    *        An optional parameter passed to |BrowserUsageTelemetry.recordSearch|.
    *        See its documentation for allowed options.
    *        Additionally, if the search was a suggested search, |details.selection|
    *        indicates where the item was in the suggestion list and how the user
    *        selected it: {selection: {index: The selected index, kind: "key" or "mouse"}}
    */
   recordSearchInTelemetry(engine, source, details = {}) {
     try {
-      BrowserUsageTelemetry.recordSearch(gBrowser, engine, source, details);
+      BrowserUsageTelemetry.recordSearch(engine, source, details);
     } catch (ex) {
       Cu.reportError(ex);
     }
   },
 
   /**
    * Helper to record a one-off search with Telemetry.
    *
@@ -4253,17 +4253,17 @@ const BrowserSearch = {
    * @param type
    *        (string) Indicates how the user selected the search item.
    * @param where
    *        (string) Where was the search link opened (e.g. new tab, current tab, ..).
    */
   recordOneoffSearchInTelemetry(engine, source, type, where) {
     try {
       const details = {type, isOneOff: true};
-      BrowserUsageTelemetry.recordSearch(gBrowser, engine, source, details);
+      BrowserUsageTelemetry.recordSearch(engine, source, details);
     } catch (ex) {
       Cu.reportError(ex);
     }
   },
 };
 
 XPCOMUtils.defineConstant(this, "BrowserSearch", BrowserSearch);
 
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -750,17 +750,17 @@ file, You can obtain one at http://mozil
                 break;
               case "searchengine":
                 if (selectedOneOff && selectedOneOff.engine) {
                   // Replace the engine with the selected one-off engine.
                   action.params.engineName = selectedOneOff.engine.name;
                 }
                 const actionDetails = {
                   isSuggestion: !!action.params.searchSuggestion,
-                  alias: action.params.alias,
+                  isAlias: !!action.params.alias,
                 };
                 [url, postData] = this._parseAndRecordSearchEngineLoad(
                   action.params.engineName,
                   action.params.searchSuggestion || action.params.searchQuery,
                   event,
                   where,
                   openUILinkParams,
                   actionDetails
--- a/browser/components/extensions/parent/ext-search.js
+++ b/browser/components/extensions/parent/ext-search.js
@@ -71,27 +71,24 @@ this.search = class extends ExtensionAPI
           } else {
             engine = Services.search.currentEngine;
           }
           let submission = engine.getSubmission(searchProperties.query, null, "webextension");
           let options = {
             postData: submission.postData,
             triggeringPrincipal: context.principal,
           };
-          let tabbrowser;
           if (searchProperties.tabId === null) {
             let {gBrowser} = windowTracker.topWindow;
             let nativeTab = gBrowser.addTab(submission.uri.spec, options);
             if (!searchLoadInBackground) {
               gBrowser.selectedTab = nativeTab;
             }
-            tabbrowser = gBrowser;
           } else {
             let tab = tabTracker.getTab(searchProperties.tabId);
             tab.linkedBrowser.loadURI(submission.uri.spec, options);
-            tabbrowser = tab.linkedBrowser.getTabBrowser();
           }
-          BrowserUsageTelemetry.recordSearch(tabbrowser, engine, "webextension");
+          BrowserUsageTelemetry.recordSearch(engine, "webextension");
         },
       },
     };
   }
 };
--- a/browser/modules/BrowserUsageTelemetry.jsm
+++ b/browser/modules/BrowserUsageTelemetry.jsm
@@ -112,21 +112,16 @@ function getSearchEngineId(engine) {
     }
     if (engine.name) {
       return "other-" + engine.name;
     }
   }
   return "other";
 }
 
-function shouldRecordSearchCount(tabbrowser) {
-  return !PrivateBrowsingUtils.isWindowPrivate(tabbrowser.ownerGlobal) ||
-         !Services.prefs.getBoolPref("browser.engagement.search_counts.pbm", false);
-}
-
 let URICountListener = {
   // A set containing the visited domains, see bug 1271310.
   _domainSet: new Set(),
   // A map to keep track of the URIs loaded from the restored tabs.
   _restoredURIsMap: new WeakMap(),
 
   isHttpURI(uri) {
     // Only consider http(s) schemas.
@@ -200,19 +195,17 @@ let URICountListener = {
     if (shouldCountURI) {
       Services.telemetry.scalarAdd(UNFILTERED_URI_COUNT_SCALAR_NAME, 1);
     }
 
     if (!this.isHttpURI(uri)) {
       return;
     }
 
-    if (shouldRecordSearchCount(browser.getTabBrowser())) {
-      Services.search.recordSearchURLTelemetry(uriSpec);
-    }
+    Services.search.recordSearchURLTelemetry(uriSpec);
 
     if (!shouldCountURI) {
       return;
     }
 
     // Update the URI counts.
     Services.telemetry.scalarAdd(TOTAL_URI_COUNT_SCALAR_NAME, 1);
 
@@ -402,39 +395,33 @@ let BrowserUsageTelemetry = {
 
   /**
    * The main entry point for recording search related Telemetry. This includes
    * search counts and engagement measurements.
    *
    * Telemetry records only search counts per engine and action origin, but
    * nothing pertaining to the search contents themselves.
    *
-   * @param {tabbrowser} tabbrowser
-   *        The tabbrowser where the search was loaded.
    * @param {nsISearchEngine} engine
    *        The engine handling the search.
    * @param {String} source
    *        Where the search originated from. See KNOWN_SEARCH_SOURCES for allowed
    *        values.
    * @param {Object} [details] Options object.
    * @param {Boolean} [details.isOneOff=false]
    *        true if this event was generated by a one-off search.
    * @param {Boolean} [details.isSuggestion=false]
    *        true if this event was generated by a suggested search.
-   * @param {Boolean} [details.alias=null]
-   *        The search engine alias used in the search, if any.
+   * @param {Boolean} [details.isAlias=false]
+   *        true if this event was generated by a search using an alias.
    * @param {Object} [details.type=null]
    *        The object describing the event that triggered the search.
    * @throws if source is not in the known sources list.
    */
-  recordSearch(tabbrowser, engine, source, details = {}) {
-    if (!shouldRecordSearchCount(tabbrowser)) {
-      return;
-    }
-
+  recordSearch(engine, source, details = {}) {
     const isOneOff = !!details.isOneOff;
     const countId = getSearchEngineId(engine) + "." + source;
 
     if (isOneOff) {
       if (!KNOWN_ONEOFF_SOURCES.includes(source)) {
         // Silently drop the error if this bogus call
         // came from 'urlbar' or 'searchbar'. They're
         // calling |recordSearch| twice from two different
@@ -445,25 +432,17 @@ let BrowserUsageTelemetry = {
           return;
         }
         throw new Error("Unknown source for one-off search: " + source);
       }
     } else {
       if (!KNOWN_SEARCH_SOURCES.includes(source)) {
         throw new Error("Unknown source for search: " + source);
       }
-      let histogram = Services.telemetry.getKeyedHistogramById("SEARCH_COUNTS");
-      histogram.add(countId);
-
-      if (details.alias &&
-          engine.wrappedJSObject._internalAliases.includes(details.alias)) {
-        let aliasCountId =
-          [getSearchEngineId(engine), details.alias, source].join(".");
-        histogram.add(aliasCountId);
-      }
+      Services.telemetry.getKeyedHistogramById("SEARCH_COUNTS").add(countId);
     }
 
     // Dispatch the search signal to other handlers.
     this._handleSearchAction(engine, source, details);
   },
 
   _recordSearch(engine, source, action = null) {
     let scalarKey = action ? "search_" + action : "search";
@@ -525,17 +504,17 @@ let BrowserUsageTelemetry = {
       return;
     }
 
     // The search was not a one-off. It was a search with the default search engine.
     if (details.isSuggestion) {
       // It came from a suggested search, so count it as such.
       this._recordSearch(engine, sourceName, "suggestion");
       return;
-    } else if (details.alias) {
+    } else if (details.isAlias) {
       // This one came from a search that used an alias.
       this._recordSearch(engine, sourceName, "alias");
       return;
     }
 
     // The search signal was generated by typing something and pressing enter.
     this._recordSearch(engine, sourceName, "enter");
   },
--- a/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js
+++ b/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js
@@ -104,19 +104,16 @@ add_task(async function setup() {
   Services.search.addEngineWithDetails("MozSearch", "", "mozalias", "", "GET",
                                        "http://example.com/?q={searchTerms}");
 
   // Make it the default search engine.
   let engine = Services.search.getEngineByName("MozSearch");
   let originalEngine = Services.search.currentEngine;
   Services.search.currentEngine = engine;
 
-  // Give it some mock internal aliases.
-  engine.wrappedJSObject.__internalAliases = ["@mozaliasfoo", "@mozaliasbar"];
-
   // And the first one-off engine.
   Services.search.moveEngine(engine, 0);
 
   // Enable search suggestions in the urlbar.
   let suggestionsEnabled = Services.prefs.getBoolPref(SUGGEST_URLBAR_PREF);
   Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, true);
 
   // Enable the urlbar one-off buttons.
@@ -173,19 +170,16 @@ add_task(async function test_simpleQuery
   // Check if the scalars contain the expected values.
   const scalars = getParentProcessScalars(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, true, false);
   checkKeyedScalar(scalars, SCALAR_URLBAR, "search_enter", 1);
   Assert.equal(Object.keys(scalars[SCALAR_URLBAR]).length, 1,
                "This search must only increment one entry in the scalar.");
 
   // Make sure SEARCH_COUNTS contains identical values.
   checkKeyedHistogram(search_hist, "other-MozSearch.urlbar", 1);
-  checkKeyedHistogram(search_hist, "other-MozSearch.mozalias.urlbar", undefined);
-  checkKeyedHistogram(search_hist, "other-MozSearch.@mozaliasfoo.urlbar", undefined);
-  checkKeyedHistogram(search_hist, "other-MozSearch.@mozaliasbar.urlbar", undefined);
 
   // Also check events.
   let events = Services.telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
   events = (events.parent || []).filter(e => e[1] == "navigation" && e[2] == "search");
   checkEvents(events, [["navigation", "search", "urlbar", "enter", {engine: "other-MozSearch"}]]);
 
   // Check the histograms as well.
   let resultIndexes = resultIndexHist.snapshot();
@@ -230,19 +224,16 @@ add_task(async function test_searchAlias
   // Check if the scalars contain the expected values.
   const scalars = getParentProcessScalars(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, true, false);
   checkKeyedScalar(scalars, SCALAR_URLBAR, "search_alias", 1);
   Assert.equal(Object.keys(scalars[SCALAR_URLBAR]).length, 1,
                "This search must only increment one entry in the scalar.");
 
   // Make sure SEARCH_COUNTS contains identical values.
   checkKeyedHistogram(search_hist, "other-MozSearch.urlbar", 1);
-  checkKeyedHistogram(search_hist, "other-MozSearch.mozalias.urlbar", undefined);
-  checkKeyedHistogram(search_hist, "other-MozSearch.@mozaliasfoo.urlbar", undefined);
-  checkKeyedHistogram(search_hist, "other-MozSearch.@mozaliasbar.urlbar", undefined);
 
   // Also check events.
   let events = Services.telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
   events = (events.parent || []).filter(e => e[1] == "navigation" && e[2] == "search");
   checkEvents(events, [["navigation", "search", "urlbar", "alias", {engine: "other-MozSearch"}]]);
 
   // Check the histograms as well.
   let resultIndexes = resultIndexHist.snapshot();
@@ -261,46 +252,16 @@ add_task(async function test_searchAlias
   let resultMethods = resultMethodHist.snapshot();
   checkHistogramResults(resultMethods,
     URLBAR_SELECTED_RESULT_METHODS.enter,
     "FX_URLBAR_SELECTED_RESULT_METHOD");
 
   BrowserTestUtils.removeTab(tab);
 });
 
-add_task(async function test_internalSearchAlias() {
-  let search_hist = getAndClearKeyedHistogram("SEARCH_COUNTS");
-
-  let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
-
-  info("Search using an internal search alias.");
-  let p = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
-  await searchInAwesomebar("@mozaliasfoo query");
-  EventUtils.synthesizeKey("KEY_Enter");
-  await p;
-
-  checkKeyedHistogram(search_hist, "other-MozSearch.urlbar", 1);
-  checkKeyedHistogram(search_hist, "other-MozSearch.mozalias.urlbar", undefined);
-  checkKeyedHistogram(search_hist, "other-MozSearch.@mozaliasfoo.urlbar", 1);
-  checkKeyedHistogram(search_hist, "other-MozSearch.@mozaliasbar.urlbar", undefined);
-
-  info("Search using the other internal search alias.");
-  p = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
-  await searchInAwesomebar("@mozaliasbar query");
-  EventUtils.synthesizeKey("KEY_Enter");
-  await p;
-
-  checkKeyedHistogram(search_hist, "other-MozSearch.urlbar", 2);
-  checkKeyedHistogram(search_hist, "other-MozSearch.mozalias.urlbar", undefined);
-  checkKeyedHistogram(search_hist, "other-MozSearch.@mozaliasfoo.urlbar", 1);
-  checkKeyedHistogram(search_hist, "other-MozSearch.@mozaliasbar.urlbar", 1);
-
-  BrowserTestUtils.removeTab(tab);
-});
-
 // Performs a search using the first result, a one-off button, and the Return
 // (Enter) key.
 add_task(async function test_oneOff_enter() {
   Services.telemetry.clearScalars();
   Services.telemetry.clearEvents();
 
   let resultIndexHist = getAndClearHistogram("FX_URLBAR_SELECTED_RESULT_INDEX");
   let resultTypeHist = getAndClearHistogram("FX_URLBAR_SELECTED_RESULT_TYPE");
@@ -322,19 +283,16 @@ add_task(async function test_oneOff_ente
   // Check if the scalars contain the expected values.
   const scalars = getParentProcessScalars(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, true, false);
   checkKeyedScalar(scalars, SCALAR_URLBAR, "search_oneoff", 1);
   Assert.equal(Object.keys(scalars[SCALAR_URLBAR]).length, 1,
                "This search must only increment one entry in the scalar.");
 
   // Make sure SEARCH_COUNTS contains identical values.
   checkKeyedHistogram(search_hist, "other-MozSearch.urlbar", 1);
-  checkKeyedHistogram(search_hist, "other-MozSearch.mozalias.urlbar", undefined);
-  checkKeyedHistogram(search_hist, "other-MozSearch.@mozaliasfoo.urlbar", undefined);
-  checkKeyedHistogram(search_hist, "other-MozSearch.@mozaliasbar.urlbar", undefined);
 
   // Also check events.
   let events = Services.telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
   events = (events.parent || []).filter(e => e[1] == "navigation" && e[2] == "search");
   checkEvents(events, [["navigation", "search", "urlbar", "oneoff", {engine: "other-MozSearch"}]]);
 
   // Check the histograms as well.
   let resultIndexes = resultIndexHist.snapshot();
@@ -569,127 +527,8 @@ add_task(async function test_suggestion_
     let resultMethods = resultMethodHist.snapshot();
     checkHistogramResults(resultMethods,
       URLBAR_SELECTED_RESULT_METHODS.rightClickEnter,
       "FX_URLBAR_SELECTED_RESULT_METHOD");
 
     BrowserTestUtils.removeTab(tab);
   });
 });
-
-add_task(async function test_privateWindow() {
-  // Mock the search service's search provider info so that its
-  // recordSearchURLTelemetry() function adds the in-content SEARCH_COUNTS
-  // telemetry for our test engine.
-  Services.search.QueryInterface(Ci.nsIObserver).observe(
-    null,
-    "test:setSearchProviderInfo",
-    JSON.stringify({
-      "example": {
-        "regexp": "^http://example\\.com/",
-        "queryParam": "q",
-      },
-    })
-  );
-
-  let search_hist = getAndClearKeyedHistogram("SEARCH_COUNTS");
-
-  // First, do a bunch of searches in a private window.
-  let win = await BrowserTestUtils.openNewBrowserWindow({ private: true });
-
-  info("Search in a private window and the pref does not exist");
-  let p = BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
-  await searchInAwesomebar("query", win);
-  EventUtils.synthesizeKey("KEY_Enter", undefined, win);
-  await p;
-
-  // SEARCH_COUNTS should be incremented.
-  checkKeyedHistogram(search_hist, "other-MozSearch.urlbar", 1);
-  checkKeyedHistogram(search_hist, "example.in-content:organic:none", 1);
-
-  info("Search again in a private window after setting the pref to true");
-  Services.prefs.setBoolPref("browser.engagement.search_counts.pbm", true);
-  p = BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
-  await searchInAwesomebar("another query", win);
-  EventUtils.synthesizeKey("KEY_Enter", undefined, win);
-  await p;
-
-  // SEARCH_COUNTS should *not* be incremented.
-  checkKeyedHistogram(search_hist, "other-MozSearch.urlbar", 1);
-  checkKeyedHistogram(search_hist, "example.in-content:organic:none", 1);
-
-  info("Search again in a private window after setting the pref to false");
-  Services.prefs.setBoolPref("browser.engagement.search_counts.pbm", false);
-  p = BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
-  await searchInAwesomebar("another query", win);
-  EventUtils.synthesizeKey("KEY_Enter", undefined, win);
-  await p;
-
-  // SEARCH_COUNTS should be incremented.
-  checkKeyedHistogram(search_hist, "other-MozSearch.urlbar", 2);
-  checkKeyedHistogram(search_hist, "example.in-content:organic:none", 2);
-
-  info("Search again in a private window after clearing the pref");
-  Services.prefs.clearUserPref("browser.engagement.search_counts.pbm");
-  p = BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
-  await searchInAwesomebar("another query", win);
-  EventUtils.synthesizeKey("KEY_Enter", undefined, win);
-  await p;
-
-  // SEARCH_COUNTS should be incremented.
-  checkKeyedHistogram(search_hist, "other-MozSearch.urlbar", 3);
-  checkKeyedHistogram(search_hist, "example.in-content:organic:none", 3);
-
-  await BrowserTestUtils.closeWindow(win);
-
-  // Now, do a bunch of searches in a non-private window.  Telemetry should
-  // always be recorded regardless of the pref's value.
-  win = await BrowserTestUtils.openNewBrowserWindow();
-
-  info("Search in a non-private window and the pref does not exist");
-  p = BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
-  await searchInAwesomebar("query", win);
-  EventUtils.synthesizeKey("KEY_Enter", undefined, win);
-  await p;
-
-  // SEARCH_COUNTS should be incremented.
-  checkKeyedHistogram(search_hist, "other-MozSearch.urlbar", 4);
-  checkKeyedHistogram(search_hist, "example.in-content:organic:none", 4);
-
-  info("Search again in a non-private window after setting the pref to true");
-  Services.prefs.setBoolPref("browser.engagement.search_counts.pbm", true);
-  p = BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
-  await searchInAwesomebar("another query", win);
-  EventUtils.synthesizeKey("KEY_Enter", undefined, win);
-  await p;
-
-  // SEARCH_COUNTS should be incremented.
-  checkKeyedHistogram(search_hist, "other-MozSearch.urlbar", 5);
-  checkKeyedHistogram(search_hist, "example.in-content:organic:none", 5);
-
-  info("Search again in a non-private window after setting the pref to false");
-  Services.prefs.setBoolPref("browser.engagement.search_counts.pbm", false);
-  p = BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
-  await searchInAwesomebar("another query", win);
-  EventUtils.synthesizeKey("KEY_Enter", undefined, win);
-  await p;
-
-  // SEARCH_COUNTS should be incremented.
-  checkKeyedHistogram(search_hist, "other-MozSearch.urlbar", 6);
-  checkKeyedHistogram(search_hist, "example.in-content:organic:none", 6);
-
-  info("Search again in a non-private window after clearing the pref");
-  Services.prefs.clearUserPref("browser.engagement.search_counts.pbm");
-  p = BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
-  await searchInAwesomebar("another query", win);
-  EventUtils.synthesizeKey("KEY_Enter", undefined, win);
-  await p;
-
-  // SEARCH_COUNTS should be incremented.
-  checkKeyedHistogram(search_hist, "other-MozSearch.urlbar", 7);
-  checkKeyedHistogram(search_hist, "example.in-content:organic:none", 7);
-
-  await BrowserTestUtils.closeWindow(win);
-
-  // Reset the search provider info.
-  Services.search.QueryInterface(Ci.nsIObserver)
-    .observe(null, "test:setSearchProviderInfo", "");
-});
--- a/browser/modules/test/browser/head.js
+++ b/browser/modules/test/browser/head.js
@@ -122,20 +122,16 @@ function getAndClearKeyedHistogram(name)
 }
 
 
 /**
  * Check that the keyed histogram contains the right value.
  */
 function checkKeyedHistogram(h, key, expectedValue) {
   const snapshot = h.snapshot();
-  if (expectedValue === undefined) {
-    Assert.ok(!(key in snapshot), `The histogram must not contain ${key}.`);
-    return;
-  }
   Assert.ok(key in snapshot, `The histogram must contain ${key}.`);
   Assert.equal(snapshot[key].sum, expectedValue, `The key ${key} must contain ${expectedValue}.`);
 }
 
 /**
  * Return the scalars from the parent-process.
  */
 function getParentProcessScalars(aChannel, aKeyed = false, aClear = false) {
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -185,44 +185,48 @@ var OS_UNSUPPORTED_PARAMS = [
 // specifies an updateURL, but not an updateInterval.
 const SEARCH_DEFAULT_UPDATE_INTERVAL = 7;
 
 // The default interval before checking again for the name of the
 // default engine for the region, in seconds. Only used if the response
 // from the server doesn't specify an interval.
 const SEARCH_GEO_DEFAULT_UPDATE_INTERVAL = 2592000; // 30 days.
 
+// Regular expressions used to identify common search URLS.
+const SEARCH_URL_REGEX = new RegExp([
+  /^https:\/\/www\.(google)\.(?:.+)\/search/,
+  /^https:\/\/(?:.*)search\.(yahoo)\.com\/search/,
+  /^https:\/\/www\.(bing)\.com\/search/,
+  /^https:\/\/(duckduckgo)\.com\//,
+  /^https:\/\/www\.(baidu)\.com\/(?:s|baidu)/,
+].map(regex => regex.source).join("|"));
+
 // Used to identify various parameters (query, code, etc.) in search URLS.
 const SEARCH_PROVIDER_INFO = {
   "google": {
-    "regexp": /^https:\/\/www\.(google)\.(?:.+)\/search/,
     "queryParam": "q",
     "codeParam": "client",
     "codePrefixes": ["firefox"],
     "followonParams": ["oq", "ved", "ei"],
   },
   "duckduckgo": {
-    "regexp": /^https:\/\/(duckduckgo)\.com\//,
     "queryParam": "q",
     "codeParam": "t",
     "codePrefixes": ["ff"],
   },
   "yahoo": {
-    "regexp": /^https:\/\/(?:.*)search\.(yahoo)\.com\/search/,
     "queryParam": "p",
   },
   "baidu": {
-    "regexp": /^https:\/\/www\.(baidu)\.com\/(?:s|baidu)/,
     "queryParam": "wd",
     "codeParam": "tn",
     "codePrefixes": ["monline_dg"],
     "followonParams": ["oq"],
   },
   "bing": {
-    "regexp": /^https:\/\/www\.(bing)\.com\/search/,
     "queryParam": "q",
     "codeParam": "pc",
     "codePrefixes": ["MOZ", "MZ"],
   },
 };
 
 const SEARCH_COUNTS_HISTOGRAM_KEY = "SEARCH_COUNTS";
 /**
@@ -4558,32 +4562,23 @@ SearchService.prototype = {
     } catch (ex) {
       // Decoding errors will cause this match to be ignored.
       return gEmptyParseSubmissionResult;
     }
 
     return new ParseSubmissionResult(mapEntry.engine, terms, offset, length);
   },
 
-  __searchProviderInfo: null,
-  get _searchProviderInfo() {
-    if (!this.__searchProviderInfo) {
-      this.__searchProviderInfo = SEARCH_PROVIDER_INFO;
-    }
-    return this.__searchProviderInfo;
-  },
-
   recordSearchURLTelemetry(url) {
-    let entry = Object.entries(this._searchProviderInfo).find(
-      ([_, info]) => info.regexp.test(url)
-    );
-    if (!entry) {
+    let matches = url.match(SEARCH_URL_REGEX);
+    if (!matches) {
       return;
     }
-    let [provider, searchProviderInfo] = entry;
+    let provider = matches.filter((e, i) => e && i != 0)[0];
+    let searchProviderInfo = SEARCH_PROVIDER_INFO[provider];
     let queries = new URLSearchParams(url.split("#")[0].split("?")[1]);
     if (!queries.get(searchProviderInfo.queryParam)) {
       return;
     }
     // Default to organic to simplify things.
     // We override type in the sap cases.
     let type = "organic";
     let code;
@@ -4660,28 +4655,16 @@ SearchService.prototype = {
         // Locale changed. Re-init. We rely on observers, because we can't
         // return this promise to anyone.
         // FYI, This is also used by the search tests to do an async reinit.
         // Locales are removed during shutdown, so ignore this message
         if (!Services.startup.shuttingDown) {
           this._asyncReInit();
         }
         break;
-
-      case "test:setSearchProviderInfo":
-        if (aVerb) {
-          let infoByProvider = JSON.parse(aVerb);
-          for (let info of Object.values(infoByProvider)) {
-            info.regexp = new RegExp(info.regexp);
-          }
-          this.__searchProviderInfo = infoByProvider;
-        } else {
-          this.__searchProviderInfo = SEARCH_PROVIDER_INFO;
-        }
-        break;
     }
   },
 
   // nsITimerCallback
   notify: function SRCH_SVC_notify(aTimer) {
     LOG("_notify: checking for updates");
 
     if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true))
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -7958,19 +7958,17 @@
     "description": "Time elapsed between before responding to Slow Add-on Warning UI (ms). Not updated if the user doesn't respond at all."
   },
   "SEARCH_COUNTS": {
     "record_in_processes": ["main", "content"],
     "expires_in_version": "never",
     "kind": "count",
     "keyed": true,
     "releaseChannelCollection": "opt-out",
-    "alert_emails": ["adw@mozilla.com"],
-    "bug_numbers": [1089670, 1482158, 1499193],
-    "description": "Records search counts for search access points and in content searches. For search access points in general and for the urlbar when an internal @engine shorcut is not used, the format is: <engine-name>.<search-access-point> For the urlbar when an internal @engine shortcut is used, the format is: <engine-name>.<@engine>.urlbar For in content searches, the format is <provider>.in-content:[sap|sap-follow-on|organic]:[code|none]"
+    "description": "Records search counts for search access points and in content searches. For search access points, the format is: <engine-name>.<search-access-point> For in content searches, the format is <provider>.in-content:[sap|sap-follow-on|organic]:[code|none]"
   },
   "SEARCH_RESET_RESULT": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["fqueze@mozilla.com"],
     "bug_numbers": [1203168],
     "expires_in_version": "65",
     "kind": "enumerated",
     "n_values": 5,
--- a/toolkit/components/telemetry/histogram-whitelists.json
+++ b/toolkit/components/telemetry/histogram-whitelists.json
@@ -392,16 +392,17 @@
     "PROCESS_CRASH_SUBMIT_SUCCESS",
     "PWMGR_MANAGE_DELETED_ALL",
     "PWMGR_MANAGE_SORTED",
     "PWMGR_NUM_HTTPAUTH_PASSWORDS",
     "PWMGR_PASSWORD_INPUT_IN_FORM",
     "PWMGR_USERNAME_PRESENT",
     "REQUESTS_OF_ORIGINAL_CONTENT",
     "SAFE_MODE_USAGE",
+    "SEARCH_COUNTS",
     "SERVICE_WORKER_CONTROLLED_DOCUMENTS",
     "SERVICE_WORKER_LIFE_TIME",
     "SERVICE_WORKER_REGISTRATIONS",
     "SERVICE_WORKER_REGISTRATION_LOADING",
     "SERVICE_WORKER_REQUEST_PASSTHROUGH",
     "SERVICE_WORKER_SPAWN_ATTEMPTS",
     "SERVICE_WORKER_UPDATED",
     "SERVICE_WORKER_WAS_SPAWNED",
@@ -977,16 +978,17 @@
     "PWMGR_PASSWORD_INPUT_IN_FORM",
     "PWMGR_USERNAME_PRESENT",
     "RANGE_CHECKSUM_ERRORS",
     "READER_MODE_DOWNLOAD_RESULT",
     "READER_MODE_PARSE_RESULT",
     "REFRESH_DRIVER_TICK",
     "REQUESTS_OF_ORIGINAL_CONTENT",
     "SAFE_MODE_USAGE",
+    "SEARCH_COUNTS",
     "SEARCH_SERVICE_COUNTRY_FETCH_CAUSED_SYNC_INIT",
     "SEARCH_SERVICE_COUNTRY_FETCH_RESULT",
     "SEARCH_SERVICE_COUNTRY_FETCH_TIME_MS",
     "SEARCH_SERVICE_COUNTRY_TIMEOUT",
     "SEARCH_SERVICE_INIT_SYNC",
     "SEARCH_SERVICE_NONUS_COUNTRY_MISMATCHED_PLATFORM_OSX",
     "SEARCH_SERVICE_NONUS_COUNTRY_MISMATCHED_PLATFORM_WIN",
     "SEARCH_SERVICE_US_COUNTRY_MISMATCHED_PLATFORM_OSX",