зеркало из https://github.com/mozilla/gecko-dev.git
Bug 739751 - Don't inline autocomplete results shorter than the searcString to avoid confusing in-the-middle autocomplete.
r=gavin
This commit is contained in:
Родитель
f0c623c2f5
Коммит
9bb1156b94
|
@ -1389,6 +1389,15 @@ urlInlineComplete.prototype = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't try to autofill if the search term includes any whitespace.
|
||||||
|
// This may confuse completeDefaultIndex cause the AUTOCOMPLETE_MATCH
|
||||||
|
// tokenizer ends up trimming the search string and returning a value
|
||||||
|
// that doesn't match it, or is even shorter.
|
||||||
|
if (/\s/.test(this._currentSearchString)) {
|
||||||
|
this._finishSearch();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Do a synchronous search on the table of domains.
|
// Do a synchronous search on the table of domains.
|
||||||
let query = this._syncQuery;
|
let query = this._syncQuery;
|
||||||
query.params.search_string = this._currentSearchString.toLowerCase();
|
query.params.search_string = this._currentSearchString.toLowerCase();
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* 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/. */
|
||||||
|
|
||||||
|
// Inline should never return matches shorter than the search string, since
|
||||||
|
// that largely confuses completeDefaultIndex
|
||||||
|
|
||||||
|
add_autocomplete_test([
|
||||||
|
"Do not autofill whitespaced entry 1",
|
||||||
|
"mozilla.org ",
|
||||||
|
"mozilla.org ",
|
||||||
|
function () {
|
||||||
|
addVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
|
||||||
|
transition: TRANSITION_TYPED });
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
add_autocomplete_test([
|
||||||
|
"Do not autofill whitespaced entry 2",
|
||||||
|
"mozilla.org/ ",
|
||||||
|
"mozilla.org/ ",
|
||||||
|
function () {
|
||||||
|
addVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
|
||||||
|
transition: TRANSITION_TYPED });
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
add_autocomplete_test([
|
||||||
|
"Do not autofill whitespaced entry 3",
|
||||||
|
"mozilla.org/link ",
|
||||||
|
"mozilla.org/link ",
|
||||||
|
function () {
|
||||||
|
addVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
|
||||||
|
transition: TRANSITION_TYPED });
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
add_autocomplete_test([
|
||||||
|
"Do not autofill whitespaced entry 4",
|
||||||
|
"mozilla.org/link/ ",
|
||||||
|
"mozilla.org/link/ ",
|
||||||
|
function () {
|
||||||
|
addVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
|
||||||
|
transition: TRANSITION_TYPED });
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
add_autocomplete_test([
|
||||||
|
"Do not autofill whitespaced entry 5",
|
||||||
|
"moz illa ",
|
||||||
|
"moz illa ",
|
||||||
|
function () {
|
||||||
|
addVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
|
||||||
|
transition: TRANSITION_TYPED });
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
add_autocomplete_test([
|
||||||
|
"Do not autofill whitespaced entry 6",
|
||||||
|
" mozilla",
|
||||||
|
" mozilla",
|
||||||
|
function () {
|
||||||
|
addVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
|
||||||
|
transition: TRANSITION_TYPED });
|
||||||
|
}
|
||||||
|
]);
|
|
@ -4,5 +4,6 @@ tail =
|
||||||
|
|
||||||
[test_autocomplete_functional.js]
|
[test_autocomplete_functional.js]
|
||||||
[test_casing.js]
|
[test_casing.js]
|
||||||
|
[test_do_not_trim.js]
|
||||||
[test_keywords.js]
|
[test_keywords.js]
|
||||||
[test_typed.js]
|
[test_typed.js]
|
||||||
|
|
Загрузка…
Ссылка в новой задаче