Bug 1755996 - Add pref for removal of search engine infobar. r=Standard8

Differential Revision: https://phabricator.services.mozilla.com/D139044
This commit is contained in:
mcheang 2022-02-17 20:17:23 +00:00
parent 5e6b8da43a
commit 9e18125789
6 changed files with 13 additions and 13 deletions

View File

@ -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();
});
});

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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