Bug 1530335 Use the same date/time format everywhere on cert error pages r=johannh

Differential Revision: https://phabricator.services.mozilla.com/D27875

--HG--
extra : moz-landing-system : lando
This commit is contained in:
monikamaheshwari 2019-05-06 06:13:58 +00:00
Родитель c31395f603
Коммит bb5ca39415
3 изменённых файлов: 15 добавлений и 12 удалений

Просмотреть файл

@ -59,6 +59,10 @@ const PREF_SERVICES_SETTINGS_LAST_FETCHED = "services.settings.last_update
const PREF_SSL_IMPACT_ROOTS = ["security.tls.version.", "security.ssl3."];
let formatter = new Services.intl.DateTimeFormat(undefined, {
dateStyle: "long",
});
function getSerializedSecurityInfo(docShell) {
let serhelper = Cc["@mozilla.org/network/serialization-helper;1"]
.getService(Ci.nsISerializationHelper);
@ -273,23 +277,25 @@ class NetErrorChild extends ActorChild {
if (input.data.isNotValidAtThisTime) {
let nowTime = new Date().getTime() * 1000;
let msg = "";
let notAfterLocalTime = formatter.format(new Date(input.data.validity.notAfterLocalTime));
if (input.data.validity.notBefore) {
let notBeforeLocalTime = formatter.format(new Date(input.data.validity.notBeforeLocalTime));
if (nowTime > input.data.validity.notAfter) {
technicalInfo.textContent = "";
msg += gPipNSSBundle.formatStringFromName("certErrorExpiredNow2",
[hostString], 1);
msg += gPipNSSBundle.formatStringFromName("certErrorExpiredNow3",
[hostString, notAfterLocalTime], 2);
msg += "\n";
} else {
technicalInfo.textContent = "";
msg += gPipNSSBundle.formatStringFromName("certErrorNotYetValidNow2",
[hostString], 1);
msg += gPipNSSBundle.formatStringFromName("certErrorNotYetValidNow3",
[hostString, notBeforeLocalTime], 2);
msg += "\n";
}
} else {
// If something goes wrong, we assume the cert expired.
technicalInfo.textContent = "";
msg += gPipNSSBundle.formatStringFromName("certErrorExpiredNow2",
[hostString], 1);
msg += gPipNSSBundle.formatStringFromName("certErrorExpiredNow3",
[hostString, notAfterLocalTime], 2);
msg += "\n";
}
technicalInfo.append(msg);
@ -480,9 +486,6 @@ class NetErrorChild extends ActorChild {
let now = Date.now();
let certRange = this._getCertValidityRange(docShell);
let formatter = new Services.intl.DateTimeFormat(undefined, {
dateStyle: "short",
});
let approximateDate = now - difference * 1000;
// If the difference is more than a day, we last fetched the date in the last 5 days,

Просмотреть файл

@ -41,7 +41,7 @@ add_task(async function checkWrongSystemTimeWarning() {
Services.prefs.setIntPref(PREF_SERVICES_SETTINGS_LAST_FETCHED, Math.floor(Date.now() / 1000));
let formatter = new Services.intl.DateTimeFormat(undefined, {
dateStyle: "short",
dateStyle: "long",
});
// For this test, we want to trick Firefox into believing that

Просмотреть файл

@ -285,11 +285,11 @@ certErrorMismatchMultiple3=Websites prove their identity via certificates. %1$S
# LOCALIZATION NOTE (certErrorExpiredNow): Do not translate %1$S (date+time of expired certificate) or %2$S (current date+time)
certErrorExpiredNow=The certificate expired on %1$S. The current time is %2$S.
certErrorExpiredNow2=Websites prove their identity via certificates, which are valid for a set time period. The certificate for %S appears to be expired.
certErrorExpiredNow3=Websites prove their identity via certificates, which are valid for a set time period. The certificate for %1$S expired on %2$S.
# LOCALIZATION NOTE (certErrorNotYetValidNow): Do not translate %1$S (date+time certificate will become valid) or %2$S (current date+time)
certErrorNotYetValidNow=The certificate will not be valid until %1$S. The current time is %2$S.
certErrorNotYetValidNow2=Websites prove their identity via certificates, which are valid for a set time period. The certificate for %S appears to be not yet valid.
certErrorNotYetValidNow3=Websites prove their identity via certificates, which are valid for a set time period. The certificate for %1$S will not be valid until %2$S.
certErrorMitM=Websites prove their identity via certificates, which are issued by certificate authorities.
# LOCALIZATION NOTE (certErrorMitM2): %S is brandShortName