Bug 1176205: Disable search suggestions by default and hide the UI on non-nightly builds. r=adw, r=mak

--HG--
extra : commitid : 8hJgI1Cizvt
extra : rebase_source : b248a1013c6d6a8b271111cf820ad125ba7969b1
extra : source : 257dc5010bad8257c3da5da41279ad2c3b06f3a3
This commit is contained in:
Dave Townsend 2015-06-24 14:09:59 -07:00
Родитель fb3cc0a1d7
Коммит 56edefa873
17 изменённых файлов: 48 добавлений и 43 удалений

Просмотреть файл

@ -348,7 +348,11 @@ pref("browser.urlbar.match.url", "@");
pref("browser.urlbar.suggest.history", true);
pref("browser.urlbar.suggest.bookmark", true);
pref("browser.urlbar.suggest.openpage", true);
#ifdef NIGHTLY_BUILD
pref("browser.urlbar.suggest.searches", true);
#else
pref("browser.urlbar.suggest.searches", false);
#endif
// Restrictions to current suggestions can also be applied (intersection).
// Typed suggestion works only if history is set to true.

Просмотреть файл

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/AppConstants.jsm");
var gPrivacyPane = {
/**
@ -103,6 +105,8 @@ var gPrivacyPane = {
gPrivacyPane.showCookies);
setEventListener("clearDataSettings", "command",
gPrivacyPane.showClearPrivateDataSettings);
document.getElementById("searchesSuggestion").hidden = !AppConstants.NIGHTLY_BUILD;
},
// HISTORY MODE

Просмотреть файл

@ -258,6 +258,7 @@
accesskey="&locbar.openpage.accesskey;"
preference="browser.urlbar.suggest.openpage"/>
<checkbox id="searchesSuggestion" label="&locbar.searches.label;"
hidden="true"
onsyncfrompreference="return gPrivacyPane.writeSuggestionPref();"
accesskey="&locbar.searches.accesskey;"
preference="browser.urlbar.suggest.searches"/>

Просмотреть файл

@ -19,8 +19,5 @@ function test() {
test_dependent_cookie_elements,
test_dependent_clearonclose_elements,
test_dependent_prefs,
// reset all preferences to their default values once we're done
reset_preferences
]);
}

Просмотреть файл

@ -18,8 +18,5 @@ function test() {
test_custom_retention("rememberForms", "remember"),
test_custom_retention("rememberForms", "custom"),
test_historymode_retention("remember", "remember"),
// reset all preferences to their default values once we're done
reset_preferences
]);
}

Просмотреть файл

@ -27,8 +27,5 @@ function test() {
test_custom_retention("alwaysClear", "remember"),
test_custom_retention("alwaysClear", "custom"),
test_historymode_retention("remember", "remember"),
// reset all preferences to their default values once we're done
reset_preferences
]));
}

Просмотреть файл

@ -12,15 +12,16 @@ function test() {
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([
let tests = [
test_locbar_suggestion_retention("history", true),
test_locbar_suggestion_retention("bookmark", true),
test_locbar_suggestion_retention("searches", true),
test_locbar_suggestion_retention("openpage", false),
test_locbar_suggestion_retention("history", true),
test_locbar_suggestion_retention("history", false),
];
// reset all preferences to their default values once we're done
reset_preferences
]);
if (AppConstants.NIGHTLY_BUILD)
tests.push(test_locbar_suggestion_retention("searches", true)),
run_test_subset(tests);
}

Просмотреть файл

@ -27,8 +27,5 @@ function test() {
// history mode should now be remember
test_historymode_retention("remember", "remember"),
// reset all preferences to their default values once we're done
reset_preferences
]);
}

Просмотреть файл

@ -315,11 +315,18 @@ function test_locbar_suggestion_retention(suggestion, autocomplete) {
};
}
const gPrefCache = new Map();
function cache_preferences(win) {
let prefs = win.document.querySelectorAll("#privacyPreferences > preference");
for (let pref of prefs)
gPrefCache.set(pref.name, pref.value);
}
function reset_preferences(win) {
let prefs = win.document.querySelectorAll("#privacyPreferences > preference");
for (let i = 0; i < prefs.length; ++i)
if (prefs[i].hasUserValue)
prefs[i].reset();
for (let pref of prefs)
pref.value = gPrefCache.get(pref.name);
}
let testRunner;
@ -334,7 +341,7 @@ function run_test_subset(subset) {
});
testRunner = {
tests: subset,
tests: [cache_preferences, ...subset, reset_preferences],
counter: 0,
runNext: function() {
if (this.counter == this.tests.length) {

Просмотреть файл

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/AppConstants.jsm");
var gPrivacyPane = {
@ -69,6 +70,8 @@ var gPrivacyPane = {
this._initTrackingProtection();
#endif
this._initAutocomplete();
document.getElementById("searchesSuggestion").hidden = !AppConstants.NIGHTLY_BUILD;
},
// HISTORY MODE

Просмотреть файл

@ -284,6 +284,7 @@
accesskey="&locbar.openpage.accesskey;"
preference="browser.urlbar.suggest.openpage"/>
<checkbox id="searchesSuggestion" label="&locbar.searches.label;"
hidden="true"
onsyncfrompreference="return gPrivacyPane.writeSuggestionPref();"
accesskey="&locbar.searches.accesskey;"
preference="browser.urlbar.suggest.searches"/>

Просмотреть файл

@ -20,8 +20,5 @@ function test() {
test_dependent_cookie_elements,
test_dependent_clearonclose_elements,
test_dependent_prefs,
// reset all preferences to their default values once we're done
reset_preferences
]);
}

Просмотреть файл

@ -19,8 +19,5 @@ function test() {
test_custom_retention("rememberForms", "remember"),
test_custom_retention("rememberForms", "custom"),
test_historymode_retention("remember", "remember"),
// reset all preferences to their default values once we're done
reset_preferences
]);
}

Просмотреть файл

@ -28,8 +28,5 @@ function test() {
test_custom_retention("alwaysClear", "remember"),
test_custom_retention("alwaysClear", "custom"),
test_historymode_retention("remember", "remember"),
// reset all preferences to their default values once we're done
reset_preferences
]));
}

Просмотреть файл

@ -12,15 +12,16 @@ function test() {
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([
let tests = [
test_locbar_suggestion_retention("history", true),
test_locbar_suggestion_retention("bookmark", true),
test_locbar_suggestion_retention("searches", true),
test_locbar_suggestion_retention("openpage", false),
test_locbar_suggestion_retention("history", true),
test_locbar_suggestion_retention("history", false),
];
// reset all preferences to their default values once we're done
reset_preferences
]);
if (AppConstants.NIGHTLY_BUILD)
tests.push(test_locbar_suggestion_retention("searches", true)),
run_test_subset(tests);
}

Просмотреть файл

@ -28,8 +28,5 @@ function test() {
// history mode should now be remember
test_historymode_retention("remember", "remember"),
// reset all preferences to their default values once we're done
reset_preferences
]);
}

Просмотреть файл

@ -321,11 +321,18 @@ function test_locbar_suggestion_retention(suggestion, autocomplete) {
};
}
const gPrefCache = new Map();
function cache_preferences(win) {
let prefs = win.document.querySelectorAll("#privacyPreferences > preference");
for (let pref of prefs)
gPrefCache.set(pref.name, pref.value);
}
function reset_preferences(win) {
let prefs = win.document.getElementsByTagName("preference");
for (let i = 0; i < prefs.length; ++i)
if (prefs[i].hasUserValue)
prefs[i].reset();
let prefs = win.document.querySelectorAll("#privacyPreferences > preference");
for (let pref of prefs)
pref.value = gPrefCache.get(pref.name);
}
let testRunner;
@ -336,7 +343,7 @@ function run_test_subset(subset) {
waitForExplicitFinish();
testRunner = {
tests: subset,
tests: [cache_preferences, ...subset, reset_preferences],
counter: 0,
runNext: function() {
if (this.counter == this.tests.length) {