Bug 1220781 - Hide the exception button, not advanced section for badStsCert or cert errors in frames;r=MattN
authorBrian Grinstead <bgrinstead@mozilla.com>
Mon, 02 Nov 2015 16:09:16 -0800
changeset 271082 7ec97368b2d6267b9e622702eaf5a3892f56b3b6
parent 270924 98729e8f5395b6e1e3dd1c9b26f68bdc8a143b11
child 271083 796a983be3090f5dd7be52e81c4da05e64e26038
push id67553
push usercbook@mozilla.com
push dateWed, 04 Nov 2015 11:31:24 +0000
treeherdermozilla-inbound@8868503916ba [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1220781
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1220781 - Hide the exception button, not advanced section for badStsCert or cert errors in frames;r=MattN
browser/base/content/aboutcerterror/aboutCertError.xhtml
browser/base/content/test/general/browser_aboutCertError.js
--- a/browser/base/content/aboutcerterror/aboutCertError.xhtml
+++ b/browser/base/content/aboutcerterror/aboutCertError.xhtml
@@ -90,17 +90,17 @@
         if (cssClass == "expertBadCert") {
           toggleVisibility('advancedPanel');
         }
 
         // Disallow overrides if this is a Strict-Transport-Security
         // host and the cert is bad (STS Spec section 7.3) or if the
         // certerror is in a frame (bug 633691).
         if (cssClass == "badStsCert" || window != top) {
-          document.getElementById("advancedPanel").setAttribute("hidden", "true");
+          document.getElementById("exceptionDialogButton").setAttribute("hidden", "true");
         }
         if (cssClass != "badStsCert") {
           document.getElementById("badStsCertExplanation").setAttribute("hidden", "true");
         }
 
         var tech = document.getElementById("technicalContentText");
         if (tech)
           tech.textContent = getDescription();
--- a/browser/base/content/test/general/browser_aboutCertError.js
+++ b/browser/base/content/test/general/browser_aboutCertError.js
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // This is testing the aboutCertError page (Bug 1207107).  It's a start,
-// but should be expanded to include cert_domain_link / badStsCert
+// but should be expanded to include cert_domain_link
 
 const GOOD_PAGE = "https://example.com/";
 const BAD_CERT = "https://expired.example.com/";
+const BAD_STS_CERT = "https://badchain.include-subdomains.pinning.example.com:443";
 
 add_task(function* checkReturnToAboutHome() {
   info("Loading a bad cert page directly and making sure 'return to previous page' goes to about:home");
   let browser;
   let certErrorLoaded;
   let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, () => {
     gBrowser.selectedTab = gBrowser.addTab(BAD_CERT);
     browser = gBrowser.selectedBrowser;
@@ -63,16 +64,36 @@ add_task(function* checkReturnToPrevious
 
   is(browser.webNavigation.canGoBack, false, "!webNavigation.canGoBack");
   is(browser.webNavigation.canGoForward, true, "webNavigation.canGoForward");
   is(gBrowser.currentURI.spec, GOOD_PAGE, "Went back");
 
   gBrowser.removeCurrentTab();
 });
 
+add_task(function* checkBadStsCert() {
+  info("Loading a badStsCert and making sure exception button doesn't show up");
+  let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, GOOD_PAGE);
+  let browser = gBrowser.selectedBrowser;
+
+  info("Loading and waiting for the cert error");
+  let certErrorLoaded = waitForCertErrorLoad(browser);
+  BrowserTestUtils.loadURI(browser, BAD_STS_CERT);
+  yield certErrorLoaded;
+
+  let exceptionButtonHidden = yield ContentTask.spawn(browser, null, function* () {
+    let doc = content.document;
+    let exceptionButton = doc.getElementById("exceptionDialogButton");
+    return exceptionButton.hidden;
+  });
+  ok(exceptionButtonHidden, "Exception button is hidden");
+
+  gBrowser.removeCurrentTab();
+});
+
 function waitForCertErrorLoad(browser) {
   return new Promise(resolve => {
     info("Waiting for DOMContentLoaded event");
     browser.addEventListener("DOMContentLoaded", function load() {
       browser.removeEventListener("DOMContentLoaded", load, false, true);
       resolve();
     }, false, true);
   });