Bug 1318070 - Make sure multi-word queries are rejected when keyword.enabled is false r=mak

MozReview-Commit-ID: 6kMU2oTy456

--HG--
extra : rebase_source : 26632a932b17bccd3da318dcbf0a45323acf71ae
This commit is contained in:
Wes Kocher 2017-03-21 10:57:20 -07:00
Родитель 2f3bcc34da
Коммит cdf08f2266
2 изменённых файлов: 20 добавлений и 0 удалений

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

@ -1569,6 +1569,20 @@ Search.prototype = {
fixupInfo = Services.uriFixup.getFixupURIInfo(this._originalSearchString,
flags);
} catch (e) {
if (e.result == Cr.NS_ERROR_MALFORMED_URI && !Prefs.keywordEnabled) {
let value = PlacesUtils.mozActionURI("visiturl", {
url: this._originalSearchString,
input: this._originalSearchString,
});
this._addMatch({
value,
comment: this._originalSearchString,
style: "action visiturl",
frecency: 0,
});
return true;
}
return false;
}

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

@ -141,6 +141,12 @@ add_task(function*() {
searchParam: "enable-actions",
matches: [ makeVisitMatch("bacon", "http://bacon/", { heuristic: true }) ]
});
do_print("visit two word query, keyword.enabled = false");
yield check_autocomplete({
search: "bacon lovers",
searchParam: "enable-actions",
matches: [ makeVisitMatch("bacon lovers", "bacon lovers", { heuristic: true }) ]
});
Services.prefs.setBoolPref("keyword.enabled", keywordEnabled);
do_print("visit url, scheme+host");