Bug 1588469 - Show Search in a Private Window even if search suggestions in address bar are disabled. r=Standard8

Stop filtering search results when browser.urlbar.suggest.searches is false,
that pref is intended to filter search suggestions coming from the network, and
we should completely avoid hitting the network when it's set, rather than
filtering entries (that may instead cover real bugs).

Differential Revision: https://phabricator.services.mozilla.com/D49172

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Marco Bonardo 2019-10-18 14:21:54 +00:00
Родитель 9105b2fe51
Коммит 21f39cc00f
2 изменённых файлов: 22 добавлений и 1 удалений

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

@ -455,8 +455,13 @@ function getAcceptableMatchSources(context) {
case UrlbarUtils.RESULT_SOURCE.SEARCH:
if (
restrictTokenType === UrlbarTokenizer.TYPE.RESTRICT_SEARCH ||
(!restrictTokenType && UrlbarPrefs.get("suggest.searches"))
!restrictTokenType
) {
// We didn't check browser.urlbar.suggest.searches here, because it
// just controls search suggestions. If a search suggestion arrives
// here, we lost already, because we broke user's privacy by hitting
// the network. Thus, it's better to leave things go through and
// notice the bug, rather than hiding it with a filter.
acceptedSources.push(source);
}
break;

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

@ -119,6 +119,22 @@ add_task(async function test_search() {
await AssertPrivateResult(window, await Services.search.getDefault(), false);
});
add_task(async function test_search_disabled_suggestions() {
info(
"Test that 'Search in a Private Window' appears if suggestions are disabled"
);
await SpecialPowers.pushPrefEnv({
set: [["browser.urlbar.suggest.searches", false]],
});
await UrlbarTestUtils.promiseAutocompleteResultPopup({
window,
waitForFocus,
value: "unique198273982173",
});
await AssertPrivateResult(window, await Services.search.getDefault(), false);
await SpecialPowers.popPrefEnv();
});
add_task(async function test_oneoff_selected_keyboard() {
info(
"Test that 'Search in a Private Window' with keyboard opens the selected one-off engine if there's no private engine"