Bug 1334774 - re-introduce the hostname into ssl error messages, r?nihanth
MozReview-Commit-ID: CexcCq5qo1v
--- a/browser/base/content/aboutNetError.xhtml
+++ b/browser/base/content/aboutNetError.xhtml
@@ -346,16 +346,19 @@
window.addEventListener("AboutNetErrorCaptivePortalFreed", () => {
document.location.reload();
});
}
function initPageCertError() {
document.body.className = "certerror";
document.title = document.getElementById("certErrorPageTitle").textContent;
+ for (let host of document.querySelectorAll(".hostname")) {
+ host.textContent = document.location.hostname;
+ }
setupAdvancedButton(true);
document.getElementById("learnMoreContainer").style.display = "block";
let checkbox = document.getElementById("automaticallyReportInFuture");
checkbox.addEventListener("change", function({target: {checked}}) {
document.dispatchEvent(new CustomEvent("AboutNetErrorSetAutomatic", {
--- a/browser/base/content/test/general/browser_aboutCertError.js
+++ b/browser/base/content/test/general/browser_aboutCertError.js
@@ -212,30 +212,35 @@ add_task(function* checkWrongSystemTimeW
message = yield Task.spawn(setUpPage);
is(message.divDisplay, "none", "Wrong time message information is not visible");
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
add_task(function* checkAdvancedDetails() {
- info("Loading a bad cert page and verifying the advanced details section");
+ info("Loading a bad cert page and verifying the main error and advanced details section");
let browser;
let certErrorLoaded;
yield BrowserTestUtils.openNewForegroundTab(gBrowser, () => {
gBrowser.selectedTab = gBrowser.addTab(BAD_CERT);
browser = gBrowser.selectedBrowser;
certErrorLoaded = waitForCertErrorLoad(browser);
}, false);
info("Loading and waiting for the cert error");
yield certErrorLoaded;
let message = yield ContentTask.spawn(browser, null, function* () {
let doc = content.document;
+ let shortDescText = doc.getElementById("errorShortDescText");
+ info("Main error text: " + shortDescText.textContent);
+ ok(shortDescText.textContent.includes("expired.example.com"),
+ "Should list hostname in error message.");
+
let advancedButton = doc.getElementById("advancedButton");
advancedButton.click();
let el = doc.getElementById("errorCode");
return { textContent: el.textContent, tagName: el.tagName };
});
is(message.textContent, "SEC_ERROR_EXPIRED_CERTIFICATE",
"Correct error message found");
is(message.tagName, "a", "Error message is a link");