Bug 1334774 - re-introduce the hostname into ssl error messages, r?nihanth draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Sun, 29 Jan 2017 17:36:01 +0100
changeset 467777 d43342cbf1c5a9f4d96ed88fdfbfd55d267cdef8
parent 467750 e7b795db8b5b20c472d8070030e9b08c99a01db6
child 543773 184a9732e947dfc67e4bc802f530a06095dee127
push id43270
push usergijskruitbosch@gmail.com
push dateSun, 29 Jan 2017 16:37:04 +0000
reviewersnihanth
bugs1334774
milestone54.0a1
Bug 1334774 - re-introduce the hostname into ssl error messages, r?nihanth MozReview-Commit-ID: CexcCq5qo1v
browser/base/content/aboutNetError.xhtml
browser/base/content/test/general/browser_aboutCertError.js
--- 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");