From 0ecb2989e88a14111517dd4480c8db701cca17aa Mon Sep 17 00:00:00 2001 From: Cykesiopka Date: Wed, 12 Aug 2015 00:30:00 -0400 Subject: [PATCH] Bug 443811 - Use long date format for cert date output. r=keeler --- security/manager/ssl/TransportSecurityInfo.cpp | 10 ++++------ security/manager/ssl/nsNSSCertHelper.cpp | 17 ++++++++++------- security/manager/ssl/nsNSSCertValidity.cpp | 16 ++++++++++------ 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/security/manager/ssl/TransportSecurityInfo.cpp b/security/manager/ssl/TransportSecurityInfo.cpp index be6a8e63f4da..91fbd8276456 100644 --- a/security/manager/ssl/TransportSecurityInfo.cpp +++ b/security/manager/ssl/TransportSecurityInfo.cpp @@ -838,12 +838,10 @@ GetDateBoundary(nsIX509Cert* ix509, if (NS_FAILED(rv)) return; - dateTimeFormat->FormatPRTime(nullptr, kDateFormatShort, - kTimeFormatNoSeconds, timeToUse, - formattedDate); - dateTimeFormat->FormatPRTime(nullptr, kDateFormatShort, - kTimeFormatNoSeconds, now, - nowDate); + dateTimeFormat->FormatPRTime(nullptr, kDateFormatLong, kTimeFormatNoSeconds, + timeToUse, formattedDate); + dateTimeFormat->FormatPRTime(nullptr, kDateFormatLong, kTimeFormatNoSeconds, + now, nowDate); } static void diff --git a/security/manager/ssl/nsNSSCertHelper.cpp b/security/manager/ssl/nsNSSCertHelper.cpp index 13e230d08a7a..cf4832f2e805 100644 --- a/security/manager/ssl/nsNSSCertHelper.cpp +++ b/security/manager/ssl/nsNSSCertHelper.cpp @@ -1658,14 +1658,15 @@ ProcessSECAlgorithmID(SECAlgorithmID *algID, } static nsresult -ProcessTime(PRTime dispTime, const char16_t *displayName, - nsIASN1Sequence *parentSequence) +ProcessTime(PRTime dispTime, const char16_t* displayName, + nsIASN1Sequence* parentSequence) { nsresult rv; nsCOMPtr dateFormatter = do_CreateInstance(NS_DATETIMEFORMAT_CONTRACTID, &rv); - if (NS_FAILED(rv)) + if (NS_FAILED(rv)) { return rv; + } nsString text; nsString tempString; @@ -1673,8 +1674,9 @@ ProcessTime(PRTime dispTime, const char16_t *displayName, PRExplodedTime explodedTime; PR_ExplodeTime(dispTime, PR_LocalTimeParameters, &explodedTime); - dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatShort, kTimeFormatSecondsForce24Hour, - &explodedTime, tempString); + dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatLong, + kTimeFormatSecondsForce24Hour, + &explodedTime, tempString); text.Append(tempString); text.AppendLiteral("\n("); @@ -1682,8 +1684,9 @@ ProcessTime(PRTime dispTime, const char16_t *displayName, PRExplodedTime explodedTimeGMT; PR_ExplodeTime(dispTime, PR_GMTParameters, &explodedTimeGMT); - dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatShort, kTimeFormatSecondsForce24Hour, - &explodedTimeGMT, tempString); + dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatLong, + kTimeFormatSecondsForce24Hour, + &explodedTimeGMT, tempString); text.Append(tempString); text.AppendLiteral(" GMT)"); diff --git a/security/manager/ssl/nsNSSCertValidity.cpp b/security/manager/ssl/nsNSSCertValidity.cpp index 3e7b4719b406..5571c228f0ea 100644 --- a/security/manager/ssl/nsNSSCertValidity.cpp +++ b/security/manager/ssl/nsNSSCertValidity.cpp @@ -60,7 +60,8 @@ NS_IMETHODIMP nsX509CertValidity::GetNotBeforeLocalTime(nsAString &aNotBeforeLoc nsAutoString date; PRExplodedTime explodedTime; PR_ExplodeTime(mNotBefore, PR_LocalTimeParameters, &explodedTime); - dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatShort, kTimeFormatSecondsForce24Hour, + dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatLong, + kTimeFormatSecondsForce24Hour, &explodedTime, date); aNotBeforeLocalTime = date; return NS_OK; @@ -79,7 +80,7 @@ NS_IMETHODIMP nsX509CertValidity::GetNotBeforeLocalDay(nsAString &aNotBeforeLoca nsAutoString date; PRExplodedTime explodedTime; PR_ExplodeTime(mNotBefore, PR_LocalTimeParameters, &explodedTime); - dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatShort, kTimeFormatNone, + dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatLong, kTimeFormatNone, &explodedTime, date); aNotBeforeLocalDay = date; return NS_OK; @@ -99,7 +100,8 @@ NS_IMETHODIMP nsX509CertValidity::GetNotBeforeGMT(nsAString &aNotBeforeGMT) nsAutoString date; PRExplodedTime explodedTime; PR_ExplodeTime(mNotBefore, PR_GMTParameters, &explodedTime); - dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatShort, kTimeFormatSecondsForce24Hour, + dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatLong, + kTimeFormatSecondsForce24Hour, &explodedTime, date); aNotBeforeGMT = date; return NS_OK; @@ -130,7 +132,8 @@ NS_IMETHODIMP nsX509CertValidity::GetNotAfterLocalTime(nsAString &aNotAfterLocal nsAutoString date; PRExplodedTime explodedTime; PR_ExplodeTime(mNotAfter, PR_LocalTimeParameters, &explodedTime); - dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatShort, kTimeFormatSecondsForce24Hour, + dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatLong, + kTimeFormatSecondsForce24Hour, &explodedTime, date); aNotAfterLocaltime = date; return NS_OK; @@ -149,7 +152,7 @@ NS_IMETHODIMP nsX509CertValidity::GetNotAfterLocalDay(nsAString &aNotAfterLocalD nsAutoString date; PRExplodedTime explodedTime; PR_ExplodeTime(mNotAfter, PR_LocalTimeParameters, &explodedTime); - dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatShort, kTimeFormatNone, + dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatLong, kTimeFormatNone, &explodedTime, date); aNotAfterLocalDay = date; return NS_OK; @@ -168,7 +171,8 @@ NS_IMETHODIMP nsX509CertValidity::GetNotAfterGMT(nsAString &aNotAfterGMT) nsAutoString date; PRExplodedTime explodedTime; PR_ExplodeTime(mNotAfter, PR_GMTParameters, &explodedTime); - dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatShort, kTimeFormatSecondsForce24Hour, + dateFormatter->FormatPRExplodedTime(nullptr, kDateFormatLong, + kTimeFormatSecondsForce24Hour, &explodedTime, date); aNotAfterGMT = date; return NS_OK;