diff --git a/browser/modules/test/browser/browser_PartnerLinkAttribution.js b/browser/modules/test/browser/browser_PartnerLinkAttribution.js index 1d9c1bb2fe6f..1f27bcba8b80 100644 --- a/browser/modules/test/browser/browser_PartnerLinkAttribution.js +++ b/browser/modules/test/browser/browser_PartnerLinkAttribution.js @@ -37,9 +37,6 @@ function submitHandler(request, response) { } add_task(async function setup() { - // This ensures the infobar is not shown in this test. - const { sinon } = ChromeUtils.import("resource://testing-common/Sinon.jsm"); - sinon.stub(BrowserSearch, "removalOfSearchEngineNotificationBox"); // Ensure the initial init is complete. await Services.search.init(); @@ -91,7 +88,6 @@ add_task(async function setup() { await PlacesUtils.history.clear(); gCUITestUtils.removeSearchBar(); await settingsWritten; - sinon.restore(); }); }); diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index d9f183a988aa..8896bd6c03c0 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4109,6 +4109,7 @@ pref("browser.search.suggest.enabled", true); pref("browser.search.suggest.enabled.private", false); pref("browser.search.separatePrivateDefault", false); pref("browser.search.separatePrivateDefault.ui.enabled", false); +pref("browser.search.removeEngineInfobar.enabled", true); // GMPInstallManager prefs diff --git a/testing/profiles/common/user.js b/testing/profiles/common/user.js index 06f8d0703f78..fa41766dd498 100644 --- a/testing/profiles/common/user.js +++ b/testing/profiles/common/user.js @@ -28,6 +28,8 @@ user_pref("browser.pagethumbnails.capturing_disabled", true); // Tell the search service we are running in the US. This also has the desired // side-effect of preventing our geoip lookup. user_pref("browser.search.region", "US"); +// disable infobar for tests +user_pref("browser.search.removeEngineInfobar.enabled", false); // Disable webapp updates. Yes, it is supposed to be an integer. user_pref("browser.webapps.checkForUpdates", 0); // We do not wish to display datareporting policy notifications as it might diff --git a/toolkit/components/search/SearchService.jsm b/toolkit/components/search/SearchService.jsm index bba1087de8de..fd77b2ca3bbe 100644 --- a/toolkit/components/search/SearchService.jsm +++ b/toolkit/components/search/SearchService.jsm @@ -600,7 +600,8 @@ SearchService.prototype = { newCurrentEngine !== prevCurrentEngine && prevMetaData && settings.metaData && - !this._hasUserMetaDataChanged(prevMetaData) + !this._hasUserMetaDataChanged(prevMetaData) && + Services.prefs.getBoolPref("browser.search.removeEngineInfobar.enabled") ) { this._showRemovalOfSearchEngineNotificationBox( prevCurrentEngine, @@ -837,7 +838,8 @@ SearchService.prototype = { if ( prevMetaData && settings.metaData && - !this._hasUserMetaDataChanged(prevMetaData) + !this._hasUserMetaDataChanged(prevMetaData) && + Services.prefs.getBoolPref("browser.search.removeEngineInfobar.enabled") ) { this._showRemovalOfSearchEngineNotificationBox( prevCurrentEngine.name, diff --git a/toolkit/components/search/tests/xpcshell/test_selectedEngine.js b/toolkit/components/search/tests/xpcshell/test_selectedEngine.js index 8f0382d6349c..8f7ac3eae225 100644 --- a/toolkit/components/search/tests/xpcshell/test_selectedEngine.js +++ b/toolkit/components/search/tests/xpcshell/test_selectedEngine.js @@ -4,17 +4,14 @@ const kDefaultEngineName = "engine1"; add_task(async function setup() { - // Stub removal of search engine notification box. - // This ensures that BrowserSearch.win is not accessed in this test. - sinon.stub( - await Services.search.wrappedJSObject, - "_showRemovalOfSearchEngineNotificationBox" - ); - useHttpServer(); await AddonTestUtils.promiseStartupManager(); await SearchTestUtils.useTestEngines("data1"); Assert.ok(!Services.search.isInitialized); + Services.prefs.setBoolPref( + "browser.search.removeEngineInfobar.enabled", + false + ); }); // Check that the default engine matches the defaultenginename pref diff --git a/toolkit/components/search/tests/xpcshell/xpcshell.ini b/toolkit/components/search/tests/xpcshell/xpcshell.ini index 88256ac7a60e..c067057088de 100644 --- a/toolkit/components/search/tests/xpcshell/xpcshell.ini +++ b/toolkit/components/search/tests/xpcshell/xpcshell.ini @@ -4,6 +4,8 @@ head = head_search.js dupe-manifest = tags=searchmain skip-if = toolkit == 'android' +prefs = + browser.search.removeEngineInfobar.enabled=true support-files = data/engine.xml