Bug 1364002 - Store the user-made search suggestion choice along with userMadeSearchSuggestionChoice. r=past
MozReview-Commit-ID: 46vXbafZvq9
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -918,18 +918,23 @@ file, You can obtain one at http://mozil
this.completeDefaultIndex = this._prefs.getBoolPref(aData);
break;
case "delay":
this.timeout = this._prefs.getIntPref(aData);
break;
case "formatting.enabled":
this._formattingEnabled = this._prefs.getBoolPref(aData);
break;
+ case "suggest.searches":
+ // Mirror the value for future use, see the comment in the
+ // binding's constructor.
+ this._prefs.setBoolPref("searchSuggestionsChoice",
+ this._prefs.getBoolPref("suggest.searches"));
+ // fall-through.
case "userMadeSearchSuggestionsChoice":
- case "suggest.searches":
this._cacheUserMadeSearchSuggestionsChoice();
if (this._userMadeSearchSuggestionsChoice) {
this.popup.searchSuggestionsNotificationWasDismissed(
this._prefs.getBoolPref("suggest.searches")
);
}
break;
case "trimURLs":
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -593,16 +593,31 @@ BrowserGlue.prototype = {
// apply distribution customizations
// prefs are applied in _onAppDefaults()
this._distributionCustomizer.applyCustomizations();
// handle any UI migration
this._migrateUI();
+ // This is support code for the location bar search suggestions; passing
+ // from opt-in to opt-out should respect the user's choice, thus we need
+ // to cache that choice in a pref for future use.
+ // Note: this is not in migrateUI because we need to uplift it. This
+ // code is also short-lived, since we can remove it as soon as opt-out
+ // search suggestions shipped in release (Bug 1344928).
+ try {
+ let urlbarPrefs = Services.prefs.getBranch("browser.urlbar.");
+ if (!urlbarPrefs.prefHasUserValue("searchSuggestionsChoice") &&
+ urlbarPrefs.getBoolPref("userMadeSearchSuggestionsChoice")) {
+ urlbarPrefs.setBoolPref("searchSuggestionsChoice",
+ urlbarPrefs.getBoolPref("suggest.searches"));
+ }
+ } catch (ex) { /* missing any of the prefs is not critical */ }
+
listeners.init();
PageThumbs.init();
DirectoryLinksProvider.init();
NewTabUtils.init();
NewTabUtils.links.addProvider(DirectoryLinksProvider);
AboutNewTab.init();