Bug 1096248 - Disable restyling of autocomplete search page items. r=paolo

This commit is contained in:
Blair McBride 2014-11-12 23:24:28 +13:00
parent 8b93afd63f
commit 0c9bd6cce5
2 changed files with 12 additions and 1 deletions

View File

@ -22,6 +22,7 @@ const PREF_ENABLED = [ "autocomplete.enabled", true ];
const PREF_AUTOFILL = [ "autoFill", true ];
const PREF_AUTOFILL_TYPED = [ "autoFill.typed", true ];
const PREF_AUTOFILL_SEARCHENGINES = [ "autoFill.searchEngines", true ];
const PREF_RESTYLESEARCHES = [ "restyleSearches", false ];
const PREF_DELAY = [ "delay", 50 ];
const PREF_BEHAVIOR = [ "matchBehavior", MATCH_BOUNDARY_ANYWHERE ];
const PREF_DEFAULT_BEHAVIOR = [ "default.behavior", DEFAULT_BEHAVIOR ];
@ -371,6 +372,7 @@ XPCOMUtils.defineLazyGetter(this, "Prefs", () => {
store.autofill = prefs.get(...PREF_AUTOFILL);
store.autofillTyped = prefs.get(...PREF_AUTOFILL_TYPED);
store.autofillSearchEngines = prefs.get(...PREF_AUTOFILL_SEARCHENGINES);
store.restyleSearches = prefs.get(...PREF_RESTYLESEARCHES);
store.delay = prefs.get(...PREF_DELAY);
store.matchBehavior = prefs.get(...PREF_BEHAVIOR);
store.filterJavaScript = prefs.get(...PREF_FILTER_JS);
@ -1044,7 +1046,7 @@ Search.prototype = {
}
// Restyle past searches, unless they are bookmarks or special results.
if (match.style == "favicon") {
if (Prefs.restyleSearches && match.style == "favicon") {
this._maybeRestyleSearchMatch(match);
}

View File

@ -15,11 +15,20 @@ add_task(function* test_searchEngine() {
addBookmark({ uri: uri2, title: "Terms - SearchEngine Search" });
do_log_info("Past search terms should be styled, unless bookmarked");
Services.prefs.setBoolPref("browser.urlbar.restyleSearches", true);
yield check_autocomplete({
search: "term",
matches: [ { uri: uri1, title: "Terms", searchEngine: "SearchEngine", style: ["favicon", "search"] },
{ uri: uri2, title: "Terms - SearchEngine Search", style: ["bookmark"] } ]
});
do_log_info("Past search terms should not be styled if restyling is disabled");
Services.prefs.setBoolPref("browser.urlbar.restyleSearches", false);
yield check_autocomplete({
search: "term",
matches: [ { uri: uri1, title: "Terms - SearchEngine Search" },
{ uri: uri2, title: "Terms - SearchEngine Search", style: ["bookmark"] } ]
});
yield cleanup();
});