From 3881c4ca80d1b4b2f43be695438ecaf90ee4f86c Mon Sep 17 00:00:00 2001 From: Zibi Braniecki Date: Wed, 17 Nov 2021 23:31:45 +0000 Subject: [PATCH] Bug 1687118 - Bail early from DocumentL10n::TriggerInitialTranslation if mReady is not available. r=emilio,nordzilla Differential Revision: https://phabricator.services.mozilla.com/D131253 --- dom/l10n/DocumentL10n.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dom/l10n/DocumentL10n.cpp b/dom/l10n/DocumentL10n.cpp index b5a5fd82a58e..c65f53c73aed 100644 --- a/dom/l10n/DocumentL10n.cpp +++ b/dom/l10n/DocumentL10n.cpp @@ -117,6 +117,13 @@ void DocumentL10n::TriggerInitialTranslation() { if (mState >= DocumentL10nState::InitialTranslationTriggered) { return; } + if (!mReady) { + // If we don't have `mReady` it means that we are in shutdown mode. + // See bug 1687118 for details. + InitialTranslationCompleted(false); + return; + } + mInitialTranslationStart = mozilla::TimeStamp::Now(); AutoAllowLegacyScriptExecution exemption;