Bug 1334774 - re-introduce the hostname into ssl error messages, r=nhnt11 a=jcristau
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Sun, 29 Jan 2017 17:36:01 +0100
changeset 375858 cd8688f42f8a32f24906ef5de60000e2759546ea
parent 375857 1b1e50873a309d820b87daebb2f69adcb9858a5d
child 375859 b64834039927fddd9380a9b45d11516e405c6cb2
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnhnt11, jcristau
bugs1334774
milestone53.0a2
Bug 1334774 - re-introduce the hostname into ssl error messages, r=nhnt11 a=jcristau 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");