From 9cfd5538903d2e8307d03727b8310760b946fdc6 Mon Sep 17 00:00:00 2001 From: Tyler Steiman Date: Thu, 7 Jan 2016 14:02:44 +0200 Subject: [PATCH] Bug 1231312 Simplify the string in browser.properties about certificate errors sent to website owners. r=past --- browser/base/content/browser.js | 24 +++++++++++++------ .../en-US/chrome/browser/browser.properties | 14 +++++------ 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 8213641c387..f8469accfe7 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -3121,8 +3121,7 @@ function getDetailedCertErrorInfo(location, securityInfoAsString) { if (!securityInfoAsString) return ""; - let details = []; - details.push(location); + let certErrorDetails = location; const serhelper = Cc["@mozilla.org/network/serialization-helper;1"] .getService(Ci.nsISerializationHelper); @@ -3132,7 +3131,7 @@ function getDetailedCertErrorInfo(location, securityInfoAsString) { let errors = Cc["@mozilla.org/nss_errors_service;1"] .getService(Ci.nsINSSErrorsService); let code = securityInfo.errorCode; - details.push(errors.getErrorMessage(errors.getXPCOMFromNSSError(code))); + certErrorDetails += "\r\n\r\n" + errors.getErrorMessage(errors.getXPCOMFromNSSError(code)); const sss = Cc["@mozilla.org/ssservice;1"] .getService(Ci.nsISiteSecurityService); @@ -3143,8 +3142,15 @@ function getDetailedCertErrorInfo(location, securityInfoAsString) { Ci.nsISocketProvider.NO_PERMANENT_STORAGE : 0; let uri = Services.io.newURI(location, null, null); - details.push(sss.isSecureHost(sss.HEADER_HSTS, uri.host, flags)); - details.push(sss.isSecureHost(sss.HEADER_HPKP, uri.host, flags)); + + let hasHSTS = sss.isSecureHost(sss.HEADER_HSTS, uri.host, flags); + let hasHPKP = sss.isSecureHost(sss.HEADER_HPKP, uri.host, flags); + certErrorDetails += "\r\n\r\n" + + gNavigatorBundle.getFormattedString("certErrorDetailsHSTS.label", + [hasHSTS]); + certErrorDetails += "\r\n" + + gNavigatorBundle.getFormattedString("certErrorDetailsKeyPinning.label", + [hasHPKP]); let certChain = ""; if (securityInfo.failedCertChain) { @@ -3155,8 +3161,12 @@ function getDetailedCertErrorInfo(location, securityInfoAsString) { certChain += getPEMString(cert); } } - details.push(certChain); - return gNavigatorBundle.getFormattedString("certErrorDetails.label", details, 5); + + certErrorDetails += "\r\n\r\n" + + gNavigatorBundle.getString("certErrorDetailsCertChain.label") + + "\r\n\r\n" + certChain; + + return certErrorDetails; } // TODO: can we pull getDERString and getPEMString in from pippki.js instead of diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties index 2cd9a04013c..41f1c89f8da 100644 --- a/browser/locales/en-US/chrome/browser/browser.properties +++ b/browser/locales/en-US/chrome/browser/browser.properties @@ -799,13 +799,13 @@ unmuteTab.accesskey = M weakCryptoOverriding.message = %S recommends that you don't enter your password, credit card and other personal information on this website. revokeOverride.label = Don't Trust This Website revokeOverride.accesskey = D -# LOCALIZATION NOTE (certErrorDetails.label): This is a text string that -# appears in the about:certerror page, so that the user can copy and send it to -# the server administrators for troubleshooting. %1$S is the visited URL, %2$S -# is the error message, %3$S is true or false, depending on whether the server -# supports HSTS, %4$S is true or false, depending on whether the server -# supports HPKP, %5$S is the certificate chain in PEM format. -certErrorDetails.label = %1$S\r\n\r\n%2$S\r\n\r\nHTTP Strict Transport Security: %3$S\r\nHTTP Public Key Pinning: %4$S\r\n\r\nCertificate chain:\r\n\r\n%5$S + +# LOCALIZATION NOTE (certErrorDetails*.label): These are text strings that +# appear in the about:certerror page, so that the user can copy and send them to +# the server administrators for troubleshooting. +certErrorDetailsHSTS.label = HTTP Strict Transport Security: %S +certErrorDetailsKeyPinning.label = HTTP Public Key Pinning: %S +certErrorDetailsCertChain.label = Certificate chain: # LOCALIZATION NOTE (tabgroups.migration.anonGroup): # %S is the group number/ID