Bug 1645246 - fluent shouldn't release-crash if one translation clobbers another element listed for translation, r=zbraniecki,smaug

See https://bugzilla.mozilla.org/show_bug.cgi?id=1645246#c4 for what causes the crash.
I'm avoiding translating as well as attempting to update prototypes
for disconnected elements, which I've verified fixes the crash.

Differential Revision: https://phabricator.services.mozilla.com/D79508
This commit is contained in:
Gijs Kruitbosch 2020-06-17 13:07:15 +00:00
Родитель 9f02d32e17
Коммит 7a932125e9
1 изменённых файлов: 8 добавлений и 0 удалений

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

@ -485,6 +485,14 @@ bool DOMLocalization::ApplyTranslations(
hasMissingTranslation = true;
continue;
}
// If we have a proto, we expect all elements are connected up.
// If they're not, they may have been removed by earlier translations.
// We will have added an error in L10nOverlays in this case.
// This is an error in fluent use, but shouldn't be crashing. There's
// also no point translating the element - skip it:
if (aProto && !elem->IsInComposedDoc()) {
continue;
}
L10nOverlays::TranslateElement(*elem, aTranslations[i].Value(), errors,
aRv);
if (NS_WARN_IF(aRv.Failed())) {