Bug 1490457 - Support dynamically inserted localization links when a document didn`t have any links during parse. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D5612

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Zibi Braniecki 2018-09-11 23:19:26 +00:00
Родитель 5b41e41329
Коммит 84ee6e9599
1 изменённых файлов: 7 добавлений и 0 удалений

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

@ -3361,6 +3361,13 @@ nsIDocument::LocalizationLinkAdded(Element* aLinkElement)
AutoTArray<nsString, 1> resourceIds;
resourceIds.AppendElement(href);
mDocumentL10n->AddResourceIds(resourceIds);
} else if (mReadyState == READYSTATE_COMPLETE) {
// Otherwise, if the document has already been parsed
// we need to lazily initialize the localization.
AutoTArray<nsString, 1> resourceIds;
resourceIds.AppendElement(href);
InitializeLocalization(resourceIds);
mDocumentL10n->TriggerInitialDocumentTranslation();
} else {
// Otherwise, we're still parsing the document.
// In that case, add it to the pending list. This list