Bug 1284835: Replaced Hardcoded URLs with Services.urlFormatter.formatURLPref r=johannh
authorSyeda Asra Arshia Qadri <asra.qadri@gmail.com>
Wed, 13 Mar 2019 08:23:00 +0000
changeset 521667 3a2f408c40dfae660f297434a152b4b01d3c508c
parent 521666 d7348960f8da0999dfdec1c17f3d66f330f696b1
child 521668 440f5cace4fb738b5e22d8fb3f1756341d90b5b8
push id10867
push userdvarga@mozilla.com
push dateThu, 14 Mar 2019 15:20:45 +0000
treeherdermozilla-beta@abad13547875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1284835
milestone67.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 1284835: Replaced Hardcoded URLs with Services.urlFormatter.formatURLPref r=johannh Bug 1284835: Replaced Hardcoded URLs with Services.urlFormatter.formatURLPref r=reviewers Differential Revision: https://phabricator.services.mozilla.com/D21834
browser/actors/NetErrorChild.jsm
browser/base/content/aboutNetError-new.xhtml
browser/base/content/aboutNetError.js
--- a/browser/actors/NetErrorChild.jsm
+++ b/browser/actors/NetErrorChild.jsm
@@ -378,20 +378,36 @@ class NetErrorChild extends ActorChild {
       }
     }
 
     let div = doc.getElementById("certificateErrorText");
     div.textContent = msg.data.info;
     this._setTechDetails(msg, doc);
     let learnMoreLink = doc.getElementById("learnMoreLink");
     let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
+    learnMoreLink.setAttribute("href", baseURL + "connection-not-secure");
     let errWhatToDo = doc.getElementById("es_nssBadCert_" + msg.data.codeString);
     let es = doc.getElementById("errorWhatToDoText");
     let errWhatToDoTitle = doc.getElementById("edd_nssBadCert");
     let est = doc.getElementById("errorWhatToDoTitleText");
+    let searchParams = new URLSearchParams(doc.documentURI.split("?")[1]);
+    let error = searchParams.get("e");
+
+    if (error == "sslv3Used") {
+      learnMoreLink.setAttribute("href", baseURL + "sslv3-error-messages");
+    }
+
+    if (error == "nssFailure2") {
+      let shortDesc = doc.getElementById("errorShortDescText").textContent;
+      // nssFailure2 also gets us other non-overrideable errors. Choose
+      // a "learn more" link based on description:
+      if (shortDesc.includes("MOZILLA_PKIX_ERROR_KEY_PINNING_FAILURE")) {
+        learnMoreLink.setAttribute("href", baseURL + "certificate-pinning-reports");
+      }
+    }
 
     // This is set to true later if the user's system clock is at fault for this error.
     let clockSkew = false;
 
     doc.body.setAttribute("code", msg.data.codeString);
 
     // Need to do this here (which is not exactly at load but a few ticks later),
     // because this is the first time we have access to the error code.
--- a/browser/base/content/aboutNetError-new.xhtml
+++ b/browser/base/content/aboutNetError-new.xhtml
@@ -177,17 +177,17 @@
           <div id="wrongSystemTimeWithoutReferencePanel">
             &certerror.wrongSystemTimeWithoutReference;
           </div>
 
           <!-- Long Description (Note: See netError.dtd for used XHTML tags) -->
           <div id="errorLongDesc" />
 
           <div id="learnMoreContainer">
-            <p><a href="https://support.mozilla.org/kb/what-does-your-connection-is-not-secure-mean" id="learnMoreLink" target="new" data-telemetry-id="learn_more_link">&errorReporting.learnMore;</a></p>
+            <p><a id="learnMoreLink" target="new" data-telemetry-id="learn_more_link">&errorReporting.learnMore;</a></p>
           </div>
         </div>
 
         <!-- UI for option to report certificate errors to Mozilla. Removed on
              init for other error types .-->
         <div id="prefChangeContainer" class="button-container">
           <p>&prefReset.longDesc;</p>
           <button id="prefResetButton" class="primary">&prefReset.label;</button>
--- a/browser/base/content/aboutNetError.js
+++ b/browser/base/content/aboutNetError.js
@@ -217,18 +217,16 @@ function initPage() {
   var ld = document.getElementById("errorLongDesc");
   if (ld) {
     // eslint-disable-next-line no-unsanitized/property
     ld.innerHTML = errDesc.innerHTML;
   }
 
   if (err == "sslv3Used") {
     document.getElementById("learnMoreContainer").style.display = "block";
-    let learnMoreLink = document.getElementById("learnMoreLink");
-    learnMoreLink.href = "https://support.mozilla.org/kb/how-resolve-sslv3-error-messages-firefox";
     document.body.className = "certerror";
   }
 
   // remove undisplayed errors to avoid bug 39098
   var errContainer = document.getElementById("errorContainer");
   errContainer.remove();
 
   if (err == "remoteXUL") {
@@ -243,23 +241,16 @@ function initPage() {
     document.getElementById("netErrorButtonContainer").style.display = "none";
   }
 
   window.addEventListener("AboutNetErrorOptions", function(evt) {
     // Pinning errors are of type nssFailure2
     if (getErrorCode() == "nssFailure2") {
       let shortDesc = document.getElementById("errorShortDescText").textContent;
       document.getElementById("learnMoreContainer").style.display = "block";
-      let learnMoreLink = document.getElementById("learnMoreLink");
-      // nssFailure2 also gets us other non-overrideable errors. Choose
-      // a "learn more" link based on description:
-      if (shortDesc.includes("MOZILLA_PKIX_ERROR_KEY_PINNING_FAILURE")) {
-        learnMoreLink.href = "https://support.mozilla.org/kb/certificate-pinning-reports";
-      }
-
       var options = JSON.parse(evt.detail);
       if (options && options.enabled) {
         var checkbox = document.getElementById("automaticallyReportInFuture");
         showCertificateErrorReporting();
         if (options.automatic) {
           // set the checkbox
           checkbox.checked = true;
         }