Bug 1362937 - [Form Autofill] Handle undefined profile fields in autocomplete filtering. r=MattN

MozReview-Commit-ID: JvETH3KBjxY

--HG--
extra : rebase_source : 8c0b4087e4ec3f323bcbd1d3acbd0153bca31164
This commit is contained in:
steveck-chung 2017-05-08 16:48:40 +08:00
Родитель e07521d38d
Коммит a9c4650c1d
2 изменённых файлов: 6 добавлений и 1 удалений

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

@ -284,7 +284,7 @@ ProfileStorage.prototype = {
return !!name; return !!name;
} }
return name.toLowerCase().startsWith(lcSearchString); return name && name.toLowerCase().startsWith(lcSearchString);
}); });
log.debug("getByFilter: Returning", result.length, "result(s)"); log.debug("getByFilter: Returning", result.length, "result(s)");

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

@ -143,6 +143,11 @@ add_task(function* test_getByFilter() {
filter = {info: {fieldName: "street-address"}, searchString: ".*"}; filter = {info: {fieldName: "street-address"}, searchString: ".*"};
profiles = profileStorage.getByFilter(filter); profiles = profileStorage.getByFilter(filter);
do_check_eq(profiles.length, 0); do_check_eq(profiles.length, 0);
// Prevent broken while searching the property that is not existed.
filter = {info: {fieldName: "tel"}, searchString: "1"};
profiles = profileStorage.getByFilter(filter);
do_check_eq(profiles.length, 0);
}); });
add_task(function* test_add() { add_task(function* test_add() {