Bug 1106926 - Insuring that removing a hidden one click search provider also removes it from the browser.search.hiddenOneOffs pref. r=florian

This commit is contained in:
Chris
2015-02-02 16:50:52 -08:00
parent 52480e1bb4
commit 945e1de50a
5 changed files with 105 additions and 0 deletions

View File

@@ -413,6 +413,18 @@ BrowserGlue.prototype = {
#endif
break;
case "browser-search-engine-modified":
// Ensure we cleanup the hiddenOneOffs pref when removing
// an engine, and that newly added engines are visible.
if (data == "engine-added" || data == "engine-removed") {
let engineName = subject.QueryInterface(Ci.nsISearchEngine).name;
let hiddenPref =
Services.prefs.getCharPref("browser.search.hiddenOneOffs");
let hiddenEngines = hiddenPref ? hiddenPref.split(",") : [];
hiddenEngines = hiddenEngines.filter(x => x !== engineName);
Services.prefs.setCharPref("browser.search.hiddenOneOffs",
hiddenEngines.join(","));
}
if (data != "engine-default" && data != "engine-current") {
break;
}