bug 427293: add a pref to unhide the buttons on the bad-cert error page by default for advanced users. r=johnath, ui-r=beltzner, sr=jst, a=beltzner
authordveditz@cruzio.com
Fri, 02 May 2008 00:24:27 -0700
changeset 14875 6c07625fa0f40226368990a641518a93bc7e70fb
parent 14874 2207ba1be49f8806db30fce94e96cf047c25c56f
child 14876 f6a92c9a7c341885be351faa24a860bd966c4ae7
push id20
push userbsmedberg@mozilla.com
push dateFri, 02 May 2008 18:38:33 +0000
treeherdermozilla-central@7a96b5181691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohnath, beltzner, jst, beltzner
bugs427293
milestone1.9pre
bug 427293: add a pref to unhide the buttons on the bad-cert error page by default for advanced users. r=johnath, ui-r=beltzner, sr=jst, a=beltzner
browser/app/profile/firefox.js
docshell/base/nsDocShell.cpp
docshell/resources/content/netError.xhtml
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -440,16 +440,17 @@ pref("profile.allow_automigration", fals
 pref("custtoolbar.personal_toolbar_folder", "");
 
 // pref to control the alert notification 
 pref("alerts.slideIncrement", 1);
 pref("alerts.slideIncrementTime", 10);
 pref("alerts.totalOpenTime", 4000);
 
 pref("browser.xul.error_pages.enabled", true);
+pref("browser.xul.error_pages.expert_bad_cert", false);
 
 // We want to make sure mail URLs are handled externally...
 pref("network.protocol-handler.external.mailto", true); // for mail
 pref("network.protocol-handler.external.news", true);   // for news
 pref("network.protocol-handler.external.snews", true);  // for secure news
 pref("network.protocol-handler.external.nntp", true);   // also news
 // ...without warning dialogs
 pref("network.protocol-handler.warn-external.mailto", false);
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -3031,16 +3031,22 @@ nsDocShell::DisplayLoadError(nsresult aE
             // No channel, let's obtain the generic error message
             if (nsserr) {
                 nsserr->GetErrorMessage(aError, messageStr);
             }
         }
         if (!messageStr.IsEmpty()) {
             if (errorClass == nsINSSErrorsService::ERROR_CLASS_BAD_CERT) {
                 error.AssignLiteral("nssBadCert");
+                PRBool expert = PR_FALSE;
+                mPrefs->GetBoolPref("browser.xul.error_pages.expert_bad_cert",
+                                    &expert);
+                if (expert) {
+                    cssClass.AssignLiteral("expertBadCert");
+                }
             } else {
                 error.AssignLiteral("nssFailure2");
             }
         }
     } else if (NS_ERROR_PHISHING_URI == aError || NS_ERROR_MALWARE_URI == aError) {
         nsCAutoString host;
         aURI->GetHost(host);
         CopyUTF8toUTF16(host, formatStrs[0]);
--- a/docshell/resources/content/netError.xhtml
+++ b/docshell/resources/content/netError.xhtml
@@ -158,30 +158,34 @@
           errDesc.id = "errorLongDesc";
         }
 
         // remove undisplayed errors to avoid bug 39098
         var errContainer = document.getElementById("errorContainer");
         errContainer.parentNode.removeChild(errContainer);
 
         var className = getCSSClass();
-        if (className) {
+        if (className && className != "expertBadCert") {
           // Associate a CSS class with the root of the page, if one was passed in,
           // to allow custom styling.
+          // Not "expertBadCert" though, don't want to deal with the favicon
           document.documentElement.className = className;
 
           // Also, if they specified a CSS class, they must supply their own
           // favicon.  In order to trigger the browser to repaint though, we
           // need to remove/add the link element. 
           var favicon = document.getElementById("favicon");
           var faviconParent = favicon.parentNode;
           faviconParent.removeChild(favicon);
           favicon.setAttribute("href", "chrome://global/skin/icons/" + className + "_favicon.png");
           faviconParent.appendChild(favicon);
         }
+        if (className == "expertBadCert") {
+          showSecuritySection();
+        }
         
         if (err == "nssBadCert") {
           // Remove the "Try again" button for security exceptions, since it's
           // almost certainly useless.
           document.getElementById("errorTryAgain").style.display = "none";
           document.getElementById("errorPageContainer").setAttribute("class", "certerror");
           addDomainErrorLink();
         }