Bug 1096695 - hardcode strings for beta to give more info about sslv3 being dead, r=bz,gavin, a=lmandel
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 13 Nov 2014 15:06:38 +0000
changeset 226050 d585e4e50468
parent 226049 4bb1c6116c39
child 226051 117eb4e49c72
push id4124
push usergijskruitbosch@gmail.com
push date2014-11-13 15:07 +0000
treeherdermozilla-beta@d585e4e50468 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, gavin, lmandel
bugs1096695
milestone34.0
Bug 1096695 - hardcode strings for beta to give more info about sslv3 being dead, r=bz,gavin, a=lmandel
browser/base/content/aboutneterror/alert.svg
browser/base/content/aboutneterror/netError.css
browser/base/content/aboutneterror/netError.xhtml
browser/base/jar.mn
docshell/base/nsDocShell.cpp
new file mode 100644
--- /dev/null
+++ b/browser/base/content/aboutneterror/alert.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xml:space="preserve">
+<g>
+	<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="20" y1="4" x2="20" y2="36">
+		<stop offset="0" style="stop-color:#E63B2E"/>
+		<stop offset="1" style="stop-color:#C33931"/>
+	</linearGradient>
+	<path fill="url(#SVGID_1_)" d="M13.373,4L4,13.372v13.256L13.373,36h13.255L36,26.628V13.372L26.627,4H13.373z M22.176,8.704   l-0.48,14.304h-3.424L17.76,8.704H22.176z M20,31.296c-1.44,0-2.592-1.184-2.592-2.592c0-1.44,1.152-2.592,2.592-2.592   c1.472,0,2.592,1.152,2.592,2.592C22.592,30.112,21.472,31.296,20,31.296z"/>
+	<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="20" y1="-3.728928e-10" x2="20" y2="40">
+		<stop offset="0" style="stop-color:#E63B2E"/>
+		<stop offset="1" style="stop-color:#C33931"/>
+	</linearGradient>
+	<path fill="url(#SVGID_2_)" d="M28.284,0H11.716L0,11.716v16.569L11.716,40h16.569L40,28.284V11.716L28.284,0z M38,27.456   L27.456,38H12.544L2,27.456V12.544L12.544,2h14.911L38,12.544V27.456z"/>
+</g>
+</svg>
--- a/browser/base/content/aboutneterror/netError.css
+++ b/browser/base/content/aboutneterror/netError.css
@@ -34,16 +34,20 @@ ul {
 
 #errorTitleText {
   background: url("info.svg") left 0 no-repeat;
   background-size: 1.2em;
   -moz-margin-start: -2em;
   -moz-padding-start: 2em;
 }
 
+#errorTitleText[sslv3] {
+  background-image: url("alert.svg");
+}
+
 #errorTitleText:-moz-dir(rtl) {
   background-position: right 0;
 }
 
 #errorTryAgain {
   margin-top: 1.2em;
   min-width: 150px
 }
--- a/browser/base/content/aboutneterror/netError.xhtml
+++ b/browser/base/content/aboutneterror/netError.xhtml
@@ -69,16 +69,26 @@
         // desc == -1 if not found; if so, return an empty string
         // instead of what would turn out to be portions of the URI
         if (desc == -1)
           return "";
 
         return decodeURIComponent(url.slice(desc + 2));
       }
 
+      function getLocale()
+      {
+        var url = document.documentURI;
+        var matches = url.match(/l\=([^&]+)\&/);
+        if (!matches) {
+          return "";
+        }
+        return matches[1];
+      }
+
       function retryThis(buttonEl)
       {
         // Note: The application may wish to handle switching off "offline mode"
         // before this event handler runs, but using a capturing event handler.
 
         // Session history has the URL of the page that failed
         // to load, not the one of the error page. So, just call
         // reload(), which will also repost POST data correctly.
@@ -121,16 +131,37 @@
         var ld = document.getElementById("errorLongDesc");
         if (ld)
         {
           ld.parentNode.replaceChild(errDesc, ld);
           // change id to the replaced child's id so styling works
           errDesc.id = "errorLongDesc";
         }
 
+        if (err == "nssFailure2" && getLocale() == "en-US" &&
+            sd.textContent.contains("ssl_error_no_cypher_overlap")) {
+          errTitle.textContent = "Unable to Connect Securely";
+          errTitle.setAttribute("sslv3", "true");
+          sd.textContent = "Firefox cannot guarantee the safety of your data on " +
+            location.hostname + " because it uses SSLv3, a broken security protocol.";
+          errDesc.textContent = "Advanced info: ssl_error_no_cypher_overlap";
+          var learnMoreBtn = document.createElement("button");
+          learnMoreBtn.id = "errorTryAgain";
+          learnMoreBtn.textContent = "Learn More\u2026";
+          learnMoreBtn.setAttribute("autocomplete", "off");
+          learnMoreBtn.addEventListener("click", function(e) {
+            try {
+              location.href = "https://support.mozilla.org/kb/how-resolve-sslv3-error-messages-firefox";
+            } catch (ex) {/* Avoid breaking in case this throws weird errors */}
+            e.target.disabled = true;
+          });
+          var retryBtn = document.getElementById("errorTryAgain");
+          retryBtn.parentNode.replaceChild(learnMoreBtn, retryBtn);
+        }
+
         // remove undisplayed errors to avoid bug 39098
         var errContainer = document.getElementById("errorContainer");
         errContainer.parentNode.removeChild(errContainer);
 
         var className = getCSSClass();
         if (className && className != "expertBadCert") {
           // Associate a CSS class with the root of the page, if one was passed in,
           // to allow custom styling.
--- a/browser/base/jar.mn
+++ b/browser/base/jar.mn
@@ -44,16 +44,17 @@ browser.jar:
         content/browser/abouthome/settings@2x.png      (content/abouthome/settings@2x.png)
         content/browser/abouthome/restore@2x.png       (content/abouthome/restore@2x.png)
         content/browser/abouthome/restore-large@2x.png (content/abouthome/restore-large@2x.png)
         content/browser/abouthome/mozilla@2x.png       (content/abouthome/mozilla@2x.png)
 
         content/browser/aboutneterror/netError.xhtml   (content/aboutneterror/netError.xhtml)
         content/browser/aboutneterror/netError.css     (content/aboutneterror/netError.css)
         content/browser/aboutneterror/info.svg         (content/aboutneterror/info.svg)
+        content/browser/aboutneterror/alert.svg        (content/aboutneterror/alert.svg)
 
 #ifdef MOZ_SERVICES_HEALTHREPORT
         content/browser/abouthealthreport/abouthealth.xhtml   (content/abouthealthreport/abouthealth.xhtml)
         content/browser/abouthealthreport/abouthealth.js      (content/abouthealthreport/abouthealth.js)
         content/browser/abouthealthreport/abouthealth.css     (content/abouthealthreport/abouthealth.css)
 #endif
         content/browser/aboutaccounts/aboutaccounts.xhtml                     (content/aboutaccounts/aboutaccounts.xhtml)
         content/browser/aboutaccounts/aboutaccounts.js                        (content/aboutaccounts/aboutaccounts.js)
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -185,16 +185,17 @@
 #include "nsISHistory.h"
 #include "nsISecureBrowserUI.h"
 #include "nsIStringBundle.h"
 #include "nsISupportsArray.h"
 #include "nsIURIFixup.h"
 #include "nsIURILoader.h"
 #include "nsIWebBrowserFind.h"
 #include "nsIWidget.h"
+#include "nsIChromeRegistry.h"
 #include "mozilla/dom/EncodingUtils.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/URLSearchParams.h"
 
 static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
 
 #if defined(DEBUG_bryner) || defined(DEBUG_chb)
 //#define DEBUG_DOCSHELL_FOCUS
@@ -4987,16 +4988,27 @@ nsDocShell::LoadErrorPage(nsIURI *aURI, 
       nsCString manifestParam;
       SAFE_ESCAPE(manifestParam,
                   NS_ConvertUTF16toUTF8(manifestURL).get(),
                   url_Path);
       errorPageUrl.AppendLiteral("&m=");
       errorPageUrl.AppendASCII(manifestParam.get());
     }
 
+    // In some cases we need to hardcode new strings in the en-US case.
+    // Pass the locale because about:neterror doesn't know it:
+    nsCOMPtr<nsIXULChromeRegistry> xulreg =
+      mozilla::services::GetXULChromeRegistryService();
+    if (xulreg) {
+      nsAutoCString locale;
+      xulreg->GetSelectedLocale(NS_LITERAL_CSTRING("global"), locale);
+      errorPageUrl.AppendLiteral("&l=");
+      errorPageUrl.AppendASCII(locale.get());
+    }
+
     // netError.xhtml's getDescription only handles the "d" parameter at the
     // end of the URL, so append it last.
     errorPageUrl.AppendLiteral("&d=");
     errorPageUrl.AppendASCII(escapedDescription.get());
 
     nsCOMPtr<nsIURI> errorPageURI;
     rv = NS_NewURI(getter_AddRefs(errorPageURI), errorPageUrl);
     NS_ENSURE_SUCCESS(rv, rv);