Bug 1535278: Cert error pages in iframes should not say 'Warning: Potential Security Risk Ahead' r=johannh

Differential Revision: https://phabricator.services.mozilla.com/D23792
This commit is contained in:
Syeda Asra Arshia Qadri
2019-03-22 21:09:10 +00:00
parent f64ab18b40
commit 09c839a6ae
2 changed files with 21 additions and 1 deletions

View File

@@ -170,7 +170,7 @@ function initPage() {
document.body.classList.add(className);
}
if (gNewErrorPagesEnabled && gIsCertError && className == "badStsCert") {
if (gNewErrorPagesEnabled && gIsCertError && (window !== window.top || className == "badStsCert")) {
l10nErrId += "_sts";
}

View File

@@ -312,3 +312,23 @@ add_task(async function checkViewCertificate() {
}
Services.prefs.clearUserPref(PREF_NEW_CERT_ERRORS);
});
add_task(async function checkBadStsCertHeadline() {
info("Loading a bad sts cert error page and checking that the correct headline is shown");
for (let useFrame of [false, true]) {
let tab = await openErrorPage(BAD_CERT, useFrame);
let browser = tab.linkedBrowser;
let titleContent = await ContentTask.spawn(browser, {frame: useFrame}, async function({frame}) {
let doc = frame ? content.document.querySelector("iframe").contentDocument : content.document;
let titleText = doc.querySelector(".title-text");
return titleText.textContent;
});
if (useFrame) {
ok(titleContent.endsWith("Security Issue"), "Did Not Connect: Potential Security Issue");
} else {
ok(titleContent.endsWith("Risk Ahead"), "Warning: Potential Security Risk Ahead");
}
BrowserTestUtils.removeTab(gBrowser.selectedTab);
}
});