Bug 1451992 - Spawn errors when encountering missing/empty search l10n ids. r=jaws

MozReview-Commit-ID: 7WbtaNqO1Dg

--HG--
extra : amend_source : c24f8fc6fd1d8fa76853c097e803a22784f7c621
This commit is contained in:
Zibi Braniecki 2018-04-05 15:41:12 +02:00
Родитель 8b23aaae8b
Коммит c59039715d
1 изменённых файлов: 15 добавлений и 7 удалений

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

@ -477,16 +477,24 @@ var gSearchResultsPane = {
// Map the localized messages taking value or a selected attribute and
// building a string of concatenated translated strings out of it.
let keywords = messages.map((msg, i) => {
if (msg === null) {
console.warn(`Missing search l10n id "${refs[i][0]}"`);
let [refId, refAttr] = refs[i];
if (!msg) {
console.error(`Missing search l10n id "${refId}"`);
return null;
}
if (refs[i][1]) {
let attr = msg.attrs.find(a => a.name === refs[i][1]);
if (attr) {
return attr.value;
if (refAttr) {
let attr = msg.attrs.find(a => a.name === refAttr);
if (!attr) {
console.error(`Missing search l10n id "${refId}.${refAttr}"`);
return null;
}
return null;
if (attr.value === "") {
console.error(`Empty value added to search-l10n-ids "${refId}.${refAttr}"`);
}
return attr.value;
}
if (msg.value === "") {
console.error(`Empty value added to search-l10n-ids "${refId}"`);
}
return msg.value;
}).filter(keyword => keyword !== null).join(" ");