diff --git a/browser/base/content/test/about/browser_aboutCertError.js b/browser/base/content/test/about/browser_aboutCertError.js index 47504f1a3da9..515a5d825d80 100644 --- a/browser/base/content/test/about/browser_aboutCertError.js +++ b/browser/base/content/test/about/browser_aboutCertError.js @@ -497,18 +497,26 @@ add_task(async function checkSandboxedIframe() { let bc = browser.browsingContext.children[0]; await SpecialPowers.spawn(bc, [], async function() { let doc = content.document; + + // aboutNetError.js is using async localization to format several messages + // and in result the translation may be applied later. + // We want to return the textContent of the element only after + // the translation completes, so let's wait for it here. + let elements = [ + doc.querySelector(".title-text"), + doc.getElementById("errorCode"), + ]; + await ContentTaskUtils.waitForCondition(() => { + return elements.every(elem => !!elem.textContent.trim().length); + }); + let titleText = doc.querySelector(".title-text"); Assert.ok( titleText.textContent.endsWith("Security Issue"), "Title shows Did Not Connect: Potential Security Issue" ); - // Wait until fluent sets the errorCode inner text. - let el; - await ContentTaskUtils.waitForCondition(() => { - el = doc.getElementById("errorCode"); - return el.textContent != ""; - }, "error code has been set inside the advanced button panel"); + let el = doc.getElementById("errorCode"); Assert.equal( el.textContent, diff --git a/browser/base/content/test/about/browser_aboutCertError_exception.js b/browser/base/content/test/about/browser_aboutCertError_exception.js index b8f33433e6d0..cb6a3de3eb61 100644 --- a/browser/base/content/test/about/browser_aboutCertError_exception.js +++ b/browser/base/content/test/about/browser_aboutCertError_exception.js @@ -138,6 +138,16 @@ add_task(async function checkBadStsCert() { : content.document; let advancedButton = doc.getElementById("advancedButton"); advancedButton.click(); + + // aboutNetError.js is using async localization to format several messages + // and in result the translation may be applied later. + // We want to return the textContent of the element only after + // the translation completes, so let's wait for it here. + let elements = [doc.getElementById("badCertTechnicalInfo")]; + await ContentTaskUtils.waitForCondition(() => { + return elements.every(elem => !!elem.textContent.trim().length); + }); + return doc.getElementById("badCertTechnicalInfo").textContent; } ); diff --git a/browser/base/content/test/about/browser_aboutNetError_csp_iframe.js b/browser/base/content/test/about/browser_aboutNetError_csp_iframe.js index ee6a0d641c45..91f9e6260f32 100644 --- a/browser/base/content/test/about/browser_aboutNetError_csp_iframe.js +++ b/browser/base/content/test/about/browser_aboutNetError_csp_iframe.js @@ -92,6 +92,19 @@ async function setupPage(htmlPageName, blockedPage) { // to open the blocked page in a new window/tab await SpecialPowers.spawn(iframe, [], async function() { let doc = content.document; + + // aboutNetError.js is using async localization to format several messages + // and in result the translation may be applied later. + // We want to return the textContent of the element only after + // the translation completes, so let's wait for it here. + let elements = [ + doc.getElementById("errorLongDesc"), + doc.getElementById("openInNewWindowButton"), + ]; + await ContentTaskUtils.waitForCondition(() => { + return elements.every(elem => !!elem.textContent.trim().length); + }); + let textLongDescription = doc.getElementById("errorLongDesc").textContent; Assert.ok( textLongDescription.includes(