Backed out 2 changesets (bug 1588785) for causing bc perma failures in browser_searchDefaultEngine.js on a CLOSED TREE
authorOana Pop Rus <opoprus@mozilla.com>
Fri, 18 Oct 2019 18:45:58 +0300
changeset 559517 10da1f86b789ba3b559da74030f1c317a27c4be7
parent 559516 2afde003f4b1ff56511fe58226711cdb442df950
child 559518 b92c29aab7c6442c3886adef72b301e31c07a6b2
push id12177
push usercsabou@mozilla.com
push dateMon, 21 Oct 2019 14:52:16 +0000
treeherdermozilla-beta@1918a9cd33bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1588785
milestone71.0a1
backs out6ad4b26b21d7e3e0f1dab4f625419b577a595410
4a4afa268baf1e86fe4c922bda42dc2ef76d2b3b
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
Backed out 2 changesets (bug 1588785) for causing bc perma failures in browser_searchDefaultEngine.js on a CLOSED TREE Backed out changeset 6ad4b26b21d7 (bug 1588785) Backed out changeset 4a4afa268baf (bug 1588785)
browser/app/profile/firefox.js
browser/base/content/browser.js
browser/components/search/test/browser/browser_searchbar_default.js
browser/components/urlbar/tests/browser/browser_action_searchengine.js
browser/components/urlbar/tests/browser/browser_urlbarPlaceholder.js
browser/modules/test/browser/browser_ContentSearch.js
docshell/test/browser/browser_uriFixupIntegration.js
docshell/test/unit/test_nsDefaultURIFixup_info.js
docshell/test/unit/test_nsDefaultURIFixup_search.js
modules/libpref/init/all.js
toolkit/components/search/SearchService.jsm
toolkit/components/search/tests/xpcshell/head_search.js
toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js
toolkit/components/search/tests/xpcshell/test_defaultEngine.js
toolkit/components/search/tests/xpcshell/test_defaultEngine_fallback.js
toolkit/components/search/tests/xpcshell/test_defaultPrivateEngine.js
toolkit/components/search/tests/xpcshell/test_list_json_locale.js
toolkit/components/search/tests/xpcshell/test_list_json_no_private_default.js
toolkit/components/search/tests/xpcshell/test_list_json_searchdefault.js
toolkit/components/search/tests/xpcshell/test_list_json_searchorder.js
toolkit/components/search/tests/xpcshell/test_notifications.js
toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -388,16 +388,18 @@ pref("browser.search.hiddenOneOffs", "")
 
 // Mirrors whether the search-container widget is in the navigation toolbar.
 pref("browser.search.widget.inNavBar", false);
 
 // Enables display of the options for the user using a separate default search
 // engine in private browsing mode.
 #ifdef EARLY_BETA_OR_EARLIER
   pref("browser.search.separatePrivateDefault.ui.enabled", true);
+#else
+  pref("browser.search.separatePrivateDefault.ui.enabled", false);
 #endif
 // The maximum amount of times the private default banner is shown.
 pref("browser.search.separatePrivateDefault.ui.banner.max", 0);
 
 pref("browser.sessionhistory.max_entries", 50);
 
 // Built-in default permissions.
 pref("permissions.manager.defaultsUrl", "resource://app/defaults/permissions");
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4398,17 +4398,17 @@ const BrowserSearch = {
   init() {
     Services.obs.addObserver(this, "browser-search-engine-modified");
   },
 
   delayedStartupInit() {
     // Asynchronously initialize the search service if necessary, to get the
     // current engine for working out the placeholder.
     this._updateURLBarPlaceholderFromDefaultEngine(
-      PrivateBrowsingUtils.isWindowPrivate(window),
+      this._usePrivateSettings,
       // Delay the update for this until so that we don't change it while
       // the user is looking at it / isn't expecting it.
       true
     ).then(() => {
       this._searchInitComplete = true;
     });
   },
 
@@ -4434,34 +4434,41 @@ const BrowserSearch = {
         break;
       case "engine-added":
         // An engine was added to the search service.  If a page is offering the
         // engine, then the engine needs to be removed from the corresponding
         // browser's offered engines.
         this._removeMaybeOfferedEngine(engineName);
         break;
       case "engine-default":
-        if (
-          this._searchInitComplete &&
-          !PrivateBrowsingUtils.isWindowPrivate(window)
-        ) {
+        if (this._searchInitComplete && !this._usePrivateSettings) {
           this._updateURLBarPlaceholder(engineName, false);
         }
         break;
       case "engine-default-private":
-        if (
-          this._searchInitComplete &&
-          PrivateBrowsingUtils.isWindowPrivate(window)
-        ) {
+        if (this._searchInitComplete && this._usePrivateSettings) {
           this._updateURLBarPlaceholder(engineName, true);
         }
         break;
     }
   },
 
+  /**
+   * @returns True if we are using a separate default private engine, and
+   *          we are in a private window.
+   */
+  get _usePrivateSettings() {
+    return (
+      Services.prefs.getBoolPref(
+        "browser.search.separatePrivateDefault",
+        true
+      ) && PrivateBrowsingUtils.isWindowPrivate(window)
+    );
+  },
+
   _addMaybeOfferedEngine(engineName) {
     let selectedBrowserOffersEngine = false;
     for (let browser of gBrowser.browsers) {
       for (let i = 0; i < (browser.hiddenEngines || []).length; i++) {
         if (browser.hiddenEngines[i].title == engineName) {
           if (!browser.engines) {
             browser.engines = [];
           }
@@ -4509,17 +4516,17 @@ const BrowserSearch = {
    * initialized quickly before the user sees anything.
    *
    * Note: If the preference doesn't exist, we don't do anything as the default
    * placeholder is a string which doesn't have the engine name.
    */
   initPlaceHolder() {
     const prefName =
       "browser.urlbar.placeholderName" +
-      (PrivateBrowsingUtils.isWindowPrivate(window) ? ".private" : "");
+      (this._usePrivateSettings ? ".private" : "");
     let engineName = Services.prefs.getStringPref(prefName, "");
     if (engineName) {
       // We can do this directly, since we know we're at DOMContentLoaded.
       this._setURLBarPlaceholder(engineName);
     }
   },
 
   /**
--- a/browser/components/search/test/browser/browser_searchbar_default.js
+++ b/browser/components/search/test/browser/browser_searchbar_default.js
@@ -45,23 +45,16 @@ add_task(async function setup() {
   });
 
   await Services.search.addEngineWithDetails("MozSearch2", {
     alias: "mozalias2",
     method: "GET",
     template: templatePrivate + "{searchTerms}",
   });
 
-  await SpecialPowers.pushPrefEnv({
-    set: [
-      ["browser.search.separatePrivateDefault.ui.enabled", true],
-      ["browser.search.separatePrivateDefault", false],
-    ],
-  });
-
   let originalEngine = await Services.search.getDefault();
   let originalPrivateEngine = await Services.search.getDefaultPrivate();
 
   let engineDefault = Services.search.getEngineByName("MozSearch1");
   await Services.search.setDefault(engineDefault);
 
   let engineOneOff = Services.search.getEngineByName("MozSearch2");
 
--- a/browser/components/urlbar/tests/browser/browser_action_searchengine.js
+++ b/browser/components/urlbar/tests/browser/browser_action_searchengine.js
@@ -3,20 +3,17 @@
 
 /**
  * Tests that a search result has the correct attributes and visits the
  * expected URL for the engine.
  */
 
 add_task(async function setup() {
   await SpecialPowers.pushPrefEnv({
-    set: [
-      ["browser.search.separatePrivateDefault.ui.enabled", true],
-      ["browser.search.separatePrivateDefault", false],
-    ],
+    set: [["browser.search.separatePrivateDefault", false]],
   });
 
   const engine = await Services.search.addEngineWithDetails("MozSearch", {
     method: "GET",
     template: "http://example.com/?q={searchTerms}",
   });
   const engine2 = await Services.search.addEngineWithDetails(
     "MozSearchPrivate",
--- a/browser/components/urlbar/tests/browser/browser_urlbarPlaceholder.js
+++ b/browser/components/urlbar/tests/browser/browser_urlbarPlaceholder.js
@@ -32,20 +32,17 @@ add_task(async function setup() {
   // initialization listeners that happen on startup.
   let urlTab = await BrowserTestUtils.openNewForegroundTab(
     gBrowser,
     "about:mozilla"
   );
   BrowserTestUtils.removeTab(urlTab);
 
   await SpecialPowers.pushPrefEnv({
-    set: [
-      ["browser.search.separatePrivateDefault.ui.enabled", true],
-      ["browser.search.separatePrivateDefault", false],
-    ],
+    set: [["browser.search.separatePrivateDefault", false]],
   });
 
   registerCleanupFunction(async () => {
     await Services.search.setDefault(originalEngine);
     for (let tab of tabs) {
       BrowserTestUtils.removeTab(tab);
     }
   });
--- a/browser/modules/test/browser/browser_ContentSearch.js
+++ b/browser/modules/test/browser/browser_ContentSearch.js
@@ -17,17 +17,16 @@ var plainURIIconTested = false;
 
 add_task(async function setup() {
   const originalEngine = await Services.search.getDefault();
   const originalPrivateEngine = await Services.search.getDefaultPrivate();
 
   await SpecialPowers.pushPrefEnv({
     set: [
       ["browser.newtab.preload", false],
-      ["browser.search.separatePrivateDefault.ui.enabled", true],
       ["browser.search.separatePrivateDefault", true],
     ],
   });
 
   await promiseNewEngine("testEngine.xml", {
     setAsCurrent: true,
     testPath:
       "chrome://mochitests/content/browser/browser/components/search/test/browser/",
--- a/docshell/test/browser/browser_uriFixupIntegration.js
+++ b/docshell/test/browser/browser_uriFixupIntegration.js
@@ -9,20 +9,17 @@ const { UrlbarTestUtils } = ChromeUtils.
 
 const kSearchEngineID = "browser_urifixup_search_engine";
 const kSearchEngineURL = "http://example.com/?search={searchTerms}";
 const kPrivateSearchEngineID = "browser_urifixup_search_engine_private";
 const kPrivateSearchEngineURL = "http://example.com/?private={searchTerms}";
 
 add_task(async function setup() {
   await SpecialPowers.pushPrefEnv({
-    set: [
-      ["browser.search.separatePrivateDefault.ui.enabled", true],
-      ["browser.search.separatePrivateDefault", true],
-    ],
+    set: [["browser.search.separatePrivateDefault", true]],
   });
 
   let oldCurrentEngine = await Services.search.getDefault();
   let oldPrivateEngine = await Services.search.getDefaultPrivate();
 
   // Add new fake search engines.
   let newCurrentEngine = await Services.search.addEngineWithDetails(
     kSearchEngineID,
--- a/docshell/test/unit/test_nsDefaultURIFixup_info.js
+++ b/docshell/test/unit/test_nsDefaultURIFixup_info.js
@@ -609,17 +609,16 @@ function sanitize(input) {
 }
 
 add_task(async function setup() {
   var prefList = [
     "browser.fixup.typo.scheme",
     "keyword.enabled",
     "browser.fixup.domainwhitelist.whitelisted",
     "browser.search.separatePrivateDefault",
-    "browser.search.separatePrivateDefault.ui.enabled",
   ];
   for (let pref of prefList) {
     Services.prefs.setBoolPref(pref, true);
   }
 
   await AddonTestUtils.promiseStartupManager();
 
   Services.io
@@ -662,19 +661,16 @@ add_task(async function setup() {
       await Services.search.setDefault(oldPrivateEngine);
     }
     await Services.search.removeEngine(newCurrentEngine);
     await Services.search.removeEngine(newPrivateEngine);
     Services.prefs.clearUserPref("keyword.enabled");
     Services.prefs.clearUserPref("browser.fixup.typo.scheme");
     Services.prefs.clearUserPref(kForceHostLookup);
     Services.prefs.clearUserPref("browser.search.separatePrivateDefault");
-    Services.prefs.clearUserPref(
-      "browser.search.separatePrivateDefault.ui.enabled"
-    );
   });
 });
 
 var gSingleWordHostLookup = false;
 add_task(async function run_test() {
   // Only keywordlookup things should be affected by requiring a DNS lookup for single-word hosts:
   info(
     "Check only keyword lookup testcases should be affected by requiring DNS for single hosts"
--- a/docshell/test/unit/test_nsDefaultURIFixup_search.js
+++ b/docshell/test/unit/test_nsDefaultURIFixup_search.js
@@ -114,20 +114,16 @@ AddonTestUtils.createAppInfo(
   "42"
 );
 
 add_task(async function setup() {
   await AddonTestUtils.promiseStartupManager();
 
   Services.prefs.setBoolPref("keyword.enabled", true);
   Services.prefs.setBoolPref("browser.search.separatePrivateDefault", true);
-  Services.prefs.setBoolPref(
-    "browser.search.separatePrivateDefault.ui.enabled",
-    true
-  );
 
   Services.io
     .getProtocolHandler("resource")
     .QueryInterface(Ci.nsIResProtocolHandler)
     .setSubstitution(
       "search-extensions",
       Services.io.newURI("chrome://mozapps/locale/searchextensions/")
     );
@@ -159,19 +155,16 @@ add_task(async function setup() {
     }
     if (oldPrivateEngine) {
       await Services.search.setDefault(oldPrivateEngine);
     }
     await Services.search.removeEngine(newCurrentEngine);
     await Services.search.removeEngine(newPrivateEngine);
     Services.prefs.clearUserPref("keyword.enabled");
     Services.prefs.clearUserPref("browser.search.separatePrivateDefault");
-    Services.prefs.clearUserPref(
-      "browser.search.separatePrivateDefault.ui.enabled"
-    );
   });
 });
 
 // Make sure we fix what needs fixing
 add_task(function test_fix_unknown_schemes() {
   for (let i = 0; i < len; ++i) {
     let item = data[i];
     let flags = Services.uriFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS;
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4444,17 +4444,16 @@ pref("browser.search.update", true);
 pref("browser.search.update.log", false);
 pref("browser.search.update.interval", 21600);
 pref("browser.search.suggest.enabled", true);
 pref("browser.search.suggest.enabled.private", false);
 pref("browser.search.geoSpecificDefaults", false);
 pref("browser.search.geoip.url", "https://location.services.mozilla.com/v1/country?key=%MOZILLA_API_KEY%");
 pref("browser.search.geoip.timeout", 3000);
 pref("browser.search.separatePrivateDefault", false);
-pref("browser.search.separatePrivateDefault.ui.enabled", false);
 
 #ifdef MOZ_OFFICIAL_BRANDING
   // {moz:official} expands to "official"
   pref("browser.search.official", true);
 #endif
 
 // GMPInstallManager prefs
 
--- a/toolkit/components/search/SearchService.jsm
+++ b/toolkit/components/search/SearchService.jsm
@@ -29,16 +29,23 @@ XPCOMUtils.defineLazyModuleGetters(this,
 });
 
 XPCOMUtils.defineLazyServiceGetters(this, {
   gEnvironment: ["@mozilla.org/process/environment;1", "nsIEnvironment"],
 });
 
 XPCOMUtils.defineLazyPreferenceGetter(
   this,
+  "gSeparatePrivateDefault",
+  SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault",
+  false
+);
+
+XPCOMUtils.defineLazyPreferenceGetter(
+  this,
   "gGeoSpecificDefaultsEnabled",
   SearchUtils.BROWSER_SEARCH_PREF + "geoSpecificDefaults",
   false
 );
 
 XPCOMUtils.defineLazyPreferenceGetter(
   this,
   "gModernConfig",
@@ -657,26 +664,16 @@ SearchService.prototype = {
    *   - visibleDefaultEngines
    *       The list of visible default engines supplied by the region server.
    *
    * All of the above except `searchDefaultExpir` have associated hash fields
    * to validate the value is set by the application.
    */
   _metaData: {},
 
-  // This reflects the combined values of the prefs for enabling the separate
-  // private default UI, and for the user choosing a separate private engine.
-  // If either one is disabled, then we don't enable the separate private default.
-  get _separatePrivateDefault() {
-    return (
-      this._separatePrivateDefaultPrefValue &&
-      this._separatePrivateDefaultEnabledPrefValue
-    );
-  },
-
   /**
    * Resets the locally stored data to the original empty values in preparation
    * for a reinit or a reset.
    */
   _resetLocalData() {
     this._engines.clear();
     this.__sortedEngines = null;
     this._currentEngine = null;
@@ -721,32 +718,16 @@ SearchService.prototype = {
    *   to be absolutely certain of the correct default engine and/ or ordering of
    *   visible engines.
    * @returns {number}
    *   A Components.results success code on success, otherwise a failure code.
    */
   async _init(skipRegionCheck) {
     SearchUtils.log("_init start");
 
-    XPCOMUtils.defineLazyPreferenceGetter(
-      this,
-      "_separatePrivateDefaultPrefValue",
-      SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault",
-      false,
-      this._onSeparateDefaultPrefChanged.bind(this)
-    );
-
-    XPCOMUtils.defineLazyPreferenceGetter(
-      this,
-      "_separatePrivateDefaultEnabledPrefValue",
-      SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault.ui.enabled",
-      false,
-      this._onSeparateDefaultPrefChanged.bind(this)
-    );
-
     try {
       // See if we have a cache file so we don't have to parse a bunch of XML.
       let cache = await this._readCacheFile();
 
       // The init flow is not going to block on a fetch from an external service,
       // but we're kicking it off as soon as possible to prevent UI flickering as
       // much as possible.
       this._ensureKnownRegionPromise = ensureKnownRegion(this)
@@ -983,17 +964,17 @@ SearchService.prototype = {
   /**
    * @returns {SearchEngine}
    *   The engine that is the default for this locale/region in private browsing
    *   mode, ignoring any user changes to the default engine.
    *   Note: if there is no default for this locale/region, then the non-private
    *   browsing engine will be returned.
    */
   get originalPrivateDefaultEngine() {
-    return this._originalDefaultEngine(this._separatePrivateDefault);
+    return this._originalDefaultEngine(gSeparatePrivateDefault);
   },
 
   resetToOriginalDefaultEngine() {
     let originalDefaultEngine = this.originalDefaultEngine;
     originalDefaultEngine.hidden = false;
     this.defaultEngine = originalDefaultEngine;
   },
 
@@ -1297,27 +1278,19 @@ SearchService.prototype = {
 
     // If the defaultEngine has changed between the previous load and this one,
     // dispatch the appropriate notifications.
     if (prevCurrentEngine && this.defaultEngine !== prevCurrentEngine) {
       SearchUtils.notifyAction(
         this._currentEngine,
         SearchUtils.MODIFIED_TYPE.DEFAULT
       );
-      // If we've not got a separate private active, notify update of the
-      // private so that the UI updates correctly.
-      if (!this._separatePrivateDefault) {
-        SearchUtils.notifyAction(
-          this._currentEngine,
-          SearchUtils.MODIFIED_TYPE.DEFAULT_PRIVATE
-        );
-      }
     }
     if (
-      this._separatePrivateDefault &&
+      gSeparatePrivateDefault &&
       prevPrivateEngine &&
       this.defaultPrivateEngine !== prevPrivateEngine
     ) {
       SearchUtils.notifyAction(
         this._currentEngine,
         SearchUtils.MODIFIED_TYPE.DEFAULT_PRIVATE
       );
     }
@@ -2644,17 +2617,17 @@ SearchService.prototype = {
     }
 
     // Bug 1575649 - We can't just check the default private engine here when
     // we're not using separate, as that re-checks the normal default, and
     // triggers update of the default search engine, which messes up various
     // tests. Really, removeEngine should always commit to updating any
     // changed defaults.
     if (
-      this._separatePrivateDefault &&
+      gSeparatePrivateDefault &&
       engineToRemove == this.defaultPrivateEngine
     ) {
       this._currentPrivateEngine = null;
     }
 
     if (engineToRemove._readOnly || engineToRemove.isBuiltin) {
       // Just hide it (the "hidden" setter will notify) and remove its alias to
       // avoid future conflicts with other engines.
@@ -2916,40 +2889,32 @@ SearchService.prototype = {
       privateMode ? "privateHash" : "hash",
       getVerificationHash(newName)
     );
 
     SearchUtils.notifyAction(
       this[currentEngine],
       SearchUtils.MODIFIED_TYPE[privateMode ? "DEFAULT_PRIVATE" : "DEFAULT"]
     );
-    // If we've not got a separate private active, notify update of the
-    // private so that the UI updates correctly.
-    if (!privateMode && !this._separatePrivateDefault) {
-      SearchUtils.notifyAction(
-        this[currentEngine],
-        SearchUtils.MODIFIED_TYPE.DEFAULT_PRIVATE
-      );
-    }
   },
 
   get defaultEngine() {
     return this._getEngineDefault(false);
   },
 
   set defaultEngine(newEngine) {
     this._setEngineDefault(false, newEngine);
   },
 
   get defaultPrivateEngine() {
-    return this._getEngineDefault(this._separatePrivateDefault);
+    return this._getEngineDefault(gSeparatePrivateDefault);
   },
 
   set defaultPrivateEngine(newEngine) {
-    this._setEngineDefault(this._separatePrivateDefault, newEngine);
+    this._setEngineDefault(gSeparatePrivateDefault, newEngine);
   },
 
   async getDefault() {
     await this.init(true);
     return this.defaultEngine;
   },
 
   async setDefault(engine) {
@@ -2962,29 +2927,16 @@ SearchService.prototype = {
     return this.defaultPrivateEngine;
   },
 
   async setDefaultPrivate(engine) {
     await this.init(true);
     return (this.defaultPrivateEngine = engine);
   },
 
-  _onSeparateDefaultPrefChanged() {
-    // We should notify if the normal default, and the currently saved private
-    // default are different. Otherwise, save the energy.
-    if (this.defaultEngine != this._getEngineDefault(true)) {
-      SearchUtils.notifyAction(
-        // Always notify with the new private engine, the function checks
-        // the preference value for us.
-        this.defaultPrivateEngine,
-        SearchUtils.MODIFIED_TYPE.DEFAULT_PRIVATE
-      );
-    }
-  },
-
   async _getEngineInfo(engine) {
     if (!engine) {
       // The defaultEngine getter will throw if there's no engine at all,
       // which shouldn't happen unless an add-on or a test deleted all of them.
       // Our preferences UI doesn't let users do that.
       Cu.reportError("getDefaultEngineInfo: No default engine");
       return ["NONE", { name: "NONE" }];
     }
@@ -3102,17 +3054,17 @@ SearchService.prototype = {
     let [shortName, defaultSearchEngineData] = await this._getEngineInfo(
       this.defaultEngine
     );
     const result = {
       defaultSearchEngine: shortName,
       defaultSearchEngineData,
     };
 
-    if (this._separatePrivateDefault) {
+    if (gSeparatePrivateDefault) {
       let [
         privateShortName,
         defaultPrivateSearchEngineData,
       ] = await this._getEngineInfo(this.defaultPrivateEngine);
       result.defaultPrivateSearchEngine = privateShortName;
       result.defaultPrivateSearchEngineData = defaultPrivateSearchEngineData;
     }
 
--- a/toolkit/components/search/tests/xpcshell/head_search.js
+++ b/toolkit/components/search/tests/xpcshell/head_search.js
@@ -131,25 +131,16 @@ async function promiseSaveGlobalMetadata
 async function forceExpiration() {
   let metadata = await promiseGlobalMetadata();
 
   // Make the current geodefaults expire 1s ago.
   metadata.searchDefaultExpir = Date.now() - 1000;
   await promiseSaveGlobalMetadata(metadata);
 }
 
-function promiseDefaultNotification(type = "normal") {
-  return SearchTestUtils.promiseSearchNotification(
-    SearchUtils.MODIFIED_TYPE[
-      type == "private" ? "DEFAULT_PRIVATE" : "DEFAULT"
-    ],
-    SearchUtils.TOPIC_ENGINE_MODIFIED
-  );
-}
-
 /**
  * Clean the profile of any cache file left from a previous run.
  *
  * @returns {boolean}
  *   Indicates if the cache file existed.
  */
 function removeCacheFile() {
   let file = do_get_profile().clone();
--- a/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js
+++ b/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js
@@ -103,20 +103,16 @@ class SearchConfigTest {
 
     // Disable region checks.
     Services.prefs.setBoolPref("browser.search.geoSpecificDefaults", false);
     Services.prefs.setCharPref("browser.search.geoip.url", "");
 
     // Enable separatePrivateDefault testing. We test with this on, as we have
     // separate tests for ensuring the normal = private when this is off.
     Services.prefs.setBoolPref(
-      SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault.ui.enabled",
-      true
-    );
-    Services.prefs.setBoolPref(
       SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault",
       true
     );
 
     await AddonTestUtils.promiseStartupManager();
     await Services.search.init();
 
     // Note: we don't use the helper function here, so that we have at least
--- a/toolkit/components/search/tests/xpcshell/test_defaultEngine.js
+++ b/toolkit/components/search/tests/xpcshell/test_defaultEngine.js
@@ -8,59 +8,42 @@
 
 "use strict";
 
 add_task(async function setup() {
   useHttpServer();
   await AddonTestUtils.promiseStartupManager();
 });
 
-function promiseDefaultNotification() {
-  return SearchTestUtils.promiseSearchNotification(
-    SearchUtils.MODIFIED_TYPE.DEFAULT,
-    SearchUtils.TOPIC_ENGINE_MODIFIED
-  );
-}
-
 add_task(async function test_defaultEngine() {
   let search = Services.search;
   await search.init();
 
   let originalDefault = search.defaultEngine;
 
   let [engine1, engine2] = await addTestEngines([
     { name: "Test search engine", xmlFileName: "engine.xml" },
     { name: "A second test engine", xmlFileName: "engine2.xml" },
   ]);
 
-  let promise = promiseDefaultNotification();
   search.defaultEngine = engine1;
-  Assert.equal(await promise, engine1);
   Assert.equal(search.defaultEngine, engine1);
-
-  promise = promiseDefaultNotification();
   search.defaultEngine = engine2;
-  Assert.equal(await promise, engine2);
   Assert.equal(search.defaultEngine, engine2);
-
-  promise = promiseDefaultNotification();
   search.defaultEngine = engine1;
-  Assert.equal(await promise, engine1);
   Assert.equal(search.defaultEngine, engine1);
 
   // Test that hiding the currently-default engine affects the defaultEngine getter
   // We fallback first to the original default...
   engine1.hidden = true;
   Assert.equal(search.defaultEngine, originalDefault);
 
   // ... and then to the first visible engine in the list, so move our second
   // engine to that position.
   await search.moveEngine(engine2, 0);
   originalDefault.hidden = true;
   Assert.equal(search.defaultEngine, engine2);
 
   // Test that setting defaultEngine to an already-hidden engine works, but
   // doesn't change the return value of the getter
-  promise = promiseDefaultNotification();
   search.defaultEngine = engine1;
-  Assert.equal(await promise, engine1);
   Assert.equal(search.defaultEngine, engine2);
 });
--- a/toolkit/components/search/tests/xpcshell/test_defaultEngine_fallback.js
+++ b/toolkit/components/search/tests/xpcshell/test_defaultEngine_fallback.js
@@ -2,20 +2,16 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 add_task(async function setup() {
   useHttpServer();
   useTestEngineConfig();
 
   Services.prefs.setCharPref(SearchUtils.BROWSER_SEARCH_PREF + "region", "US");
   Services.prefs.setBoolPref(
-    SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault.ui.enabled",
-    true
-  );
-  Services.prefs.setBoolPref(
     SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault",
     true
   );
 
   await AddonTestUtils.promiseStartupManager();
 });
 
 function getDefault(privateMode) {
--- a/toolkit/components/search/tests/xpcshell/test_defaultPrivateEngine.js
+++ b/toolkit/components/search/tests/xpcshell/test_defaultPrivateEngine.js
@@ -13,20 +13,16 @@ let engine2;
 let originalDefault;
 let originalPrivateDefault;
 
 add_task(async function setup() {
   useTestEngineConfig();
 
   Services.prefs.setCharPref(SearchUtils.BROWSER_SEARCH_PREF + "region", "US");
   Services.prefs.setBoolPref(
-    SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault.ui.enabled",
-    true
-  );
-  Services.prefs.setBoolPref(
     SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault",
     true
   );
 
   useHttpServer();
   await AddonTestUtils.promiseStartupManager();
 
   await Services.search.init();
@@ -44,41 +40,29 @@ add_task(async function test_defaultPriv
     "Should have the original private default as the default private engine"
   );
   Assert.equal(
     Services.search.defaultEngine,
     originalDefault,
     "Should have the original default as the default engine"
   );
 
-  let promise = promiseDefaultNotification("private");
   Services.search.defaultPrivateEngine = engine1;
   Assert.equal(
-    await promise,
-    engine1,
-    "Should have notified setting the private engine to the new one"
-  );
-  Assert.equal(
     Services.search.defaultPrivateEngine,
     engine1,
     "Should have set the private engine to the new one"
   );
   Assert.equal(
     Services.search.defaultEngine,
     originalDefault,
     "Should not have changed the original default engine"
   );
-  promise = promiseDefaultNotification("private");
   await Services.search.setDefaultPrivate(engine2);
   Assert.equal(
-    await promise,
-    engine2,
-    "Should have notified setting the private engine to the new one using async api"
-  );
-  Assert.equal(
     Services.search.defaultPrivateEngine,
     engine2,
     "Should have set the private engine to the new one using the async api"
   );
   // We use the names here as for some reason the getDefaultPrivate promise
   // returns something which is an nsISearchEngine but doesn't compare
   // exactly to what engine2 is.
   Assert.equal(
@@ -87,24 +71,18 @@ add_task(async function test_defaultPriv
     "Should have got the correct private engine with the async api"
   );
   Assert.equal(
     Services.search.defaultEngine,
     originalDefault,
     "Should not have changed the original default engine"
   );
 
-  promise = promiseDefaultNotification("private");
   await Services.search.setDefaultPrivate(engine1);
   Assert.equal(
-    await promise,
-    engine1,
-    "Should have notified reverting the private engine to the selected one using async api"
-  );
-  Assert.equal(
     Services.search.defaultPrivateEngine,
     engine1,
     "Should have reverted the private engine to the selected one using the async api"
   );
 
   engine1.hidden = true;
   Assert.equal(
     Services.search.defaultPrivateEngine,
@@ -124,78 +102,45 @@ add_task(async function test_defaultPriv
     originalPrivateDefault,
     "Setting the default engine should not affect the private default"
   );
 
   Services.search.defaultEngine = originalDefault;
 });
 
 add_task(async function test_defaultPrivateEngine_turned_off() {
-  Services.search.defaultEngine = originalDefault;
-  Services.search.defaultPrivateEngine = engine1;
-
-  let promise = promiseDefaultNotification("private");
   Services.prefs.setBoolPref(
     SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault",
     false
   );
-  Assert.equal(
-    await promise,
-    originalDefault,
-    "Should have notified setting the first engine correctly."
-  );
 
-  promise = promiseDefaultNotification("normal");
-  let privatePromise = promiseDefaultNotification("private");
   Services.search.defaultPrivateEngine = engine1;
   Assert.equal(
-    await promise,
-    engine1,
-    "Should have notified setting the first engine correctly."
-  );
-  Assert.equal(
-    await privatePromise,
-    engine1,
-    "Should have notified setting of the private engine as well."
-  );
-  Assert.equal(
     Services.search.defaultPrivateEngine,
     engine1,
     "Should be set to the first engine correctly"
   );
   Assert.equal(
     Services.search.defaultEngine,
     engine1,
     "Should keep the default engine in sync with the pref off"
   );
-  promise = promiseDefaultNotification("normal");
   Services.search.defaultPrivateEngine = engine2;
   Assert.equal(
-    await promise,
-    engine2,
-    "Should have notified setting the second engine correctly."
-  );
-  Assert.equal(
     Services.search.defaultPrivateEngine,
     engine2,
     "Should be set to the second engine correctly"
   );
   Assert.equal(
     Services.search.defaultEngine,
     engine2,
     "Should keep the default engine in sync with the pref off"
   );
-  promise = promiseDefaultNotification("normal");
   Services.search.defaultPrivateEngine = engine1;
   Assert.equal(
-    await promise,
-    engine1,
-    "Should have notified resetting to the first engine again"
-  );
-  Assert.equal(
     Services.search.defaultPrivateEngine,
     engine1,
     "Should be reset to the first engine again"
   );
   Assert.equal(
     Services.search.defaultEngine,
     engine1,
     "Should keep the default engine in sync with the pref off"
@@ -239,44 +184,8 @@ add_task(async function test_defaultPriv
     "Should not change anything if attempted to be set to a hidden engine"
   );
   Assert.equal(
     Services.search.defaultEngine,
     engine2,
     "Should also keep the normal default if attempted to be set to a hidden engine"
   );
 });
-
-add_task(async function test_defaultPrivateEngine_ui_turned_off() {
-  engine1.hidden = false;
-  engine2.hidden = false;
-  Services.prefs.setBoolPref(
-    SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault",
-    true
-  );
-
-  Services.search.defaultEngine = engine2;
-  Services.search.defaultPrivateEngine = engine1;
-
-  let promise = promiseDefaultNotification("private");
-  Services.prefs.setBoolPref(
-    SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault.ui.enabled",
-    false
-  );
-  Assert.equal(
-    await promise,
-    engine2,
-    "Should have notified for resetting of the private pref."
-  );
-
-  promise = promiseDefaultNotification("normal");
-  Services.search.defaultPrivateEngine = engine1;
-  Assert.equal(
-    await promise,
-    engine1,
-    "Should have notified setting the first engine correctly."
-  );
-  Assert.equal(
-    Services.search.defaultPrivateEngine,
-    engine1,
-    "Should be set to the first engine correctly"
-  );
-});
--- a/toolkit/components/search/tests/xpcshell/test_list_json_locale.js
+++ b/toolkit/components/search/tests/xpcshell/test_list_json_locale.js
@@ -4,20 +4,16 @@
 /* Check default search engine is picked from list.json searchDefault */
 
 "use strict";
 
 add_task(function test_setup() {
   useTestEngineConfig();
 
   Services.prefs.setBoolPref(
-    SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault.ui.enabled",
-    true
-  );
-  Services.prefs.setBoolPref(
     SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault",
     true
   );
   Services.prefs.setCharPref("browser.search.region", "US");
 });
 
 add_task(async function test_listJSONlocale() {
   Services.locale.availableLocales = ["de"];
--- a/toolkit/components/search/tests/xpcshell/test_list_json_no_private_default.js
+++ b/toolkit/components/search/tests/xpcshell/test_list_json_no_private_default.js
@@ -7,20 +7,16 @@
 
 "use strict";
 
 // Check that current engine matches with US searchDefault from list.json
 add_task(async function test_searchDefaultEngineUS() {
   useTestEngineConfig("resource://test/data1/");
 
   Services.prefs.setBoolPref(
-    SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault.ui.enabled",
-    true
-  );
-  Services.prefs.setBoolPref(
     SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault",
     true
   );
   Services.prefs.setCharPref(SearchUtils.BROWSER_SEARCH_PREF + "region", "US");
 
   await AddonTestUtils.promiseStartupManager();
   await Services.search.init();
 
--- a/toolkit/components/search/tests/xpcshell/test_list_json_searchdefault.js
+++ b/toolkit/components/search/tests/xpcshell/test_list_json_searchdefault.js
@@ -4,21 +4,16 @@
 /* Check default search engine is picked from list.json searchDefault */
 
 "use strict";
 
 // Check that current engine matches with US searchDefault from list.json
 add_task(async function test_searchDefaultEngineUS() {
   useTestEngineConfig();
 
-  Services.prefs.setBoolPref(
-    SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault.ui.enabled",
-    true
-  );
-
   Services.prefs.setCharPref(SearchUtils.BROWSER_SEARCH_PREF + "region", "US");
 
   await AddonTestUtils.promiseStartupManager();
   await Services.search.init();
 
   Assert.ok(Services.search.isInitialized, "search initialized");
 
   Assert.equal(
--- a/toolkit/components/search/tests/xpcshell/test_list_json_searchorder.js
+++ b/toolkit/components/search/tests/xpcshell/test_list_json_searchorder.js
@@ -3,21 +3,16 @@
 
 /* Check default search engine is picked from list.json searchDefault */
 
 "use strict";
 
 add_task(async function setup() {
   await AddonTestUtils.promiseStartupManager();
 
-  Services.prefs.setBoolPref(
-    SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault.ui.enabled",
-    true
-  );
-
   useTestEngineConfig();
 });
 
 async function checkOrder(expectedOrder) {
   await asyncReInit();
   Assert.ok(Services.search.isInitialized, "search initialized");
 
   const sortedEngines = await Services.search.getEngines();
--- a/toolkit/components/search/tests/xpcshell/test_notifications.js
+++ b/toolkit/components/search/tests/xpcshell/test_notifications.js
@@ -51,20 +51,16 @@ class SearchObserver {
   }
 }
 
 add_task(async function setup() {
   await AddonTestUtils.promiseStartupManager();
   useHttpServer();
 
   Services.prefs.setBoolPref(
-    SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault.ui.enabled",
-    true
-  );
-  Services.prefs.setBoolPref(
     SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault",
     true
   );
 
   originalDefaultEngine = await Services.search.getDefault();
 });
 
 add_task(async function test_addingEngine() {
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
@@ -1889,20 +1889,16 @@ async function checkDefaultSearch(privat
     .getProtocolHandler("resource")
     .QueryInterface(Ci.nsIResProtocolHandler);
   resProt.setSubstitution(
     "search-extensions",
     Services.io.newURI("file://" + searchExtensions.path)
   );
 
   // Start off with separate default engine for private browsing turned off.
-  Preferences.set(
-    "browser.search.separatePrivateDefault.ui.enabled",
-    privateOn
-  );
   Preferences.set("browser.search.separatePrivateDefault", privateOn);
 
   let data = await TelemetryEnvironment.testCleanRestart().onInitialized();
   checkEnvironmentData(data);
   Assert.ok(!("defaultSearchEngine" in data.settings));
   Assert.ok(!("defaultSearchEngineData" in data.settings));
   Assert.ok(!("defaultPrivateSearchEngine" in data.settings));
   Assert.ok(!("defaultPrivateSearchEngineData" in data.settings));