Bug 1545743 - Don't use validity.not{After,Before}LocalTime for parsing date information in NetErrorChild.jsm. r=prathiksha

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Johann Hofmann 2019-05-13 20:18:07 +00:00
Родитель 2a4fc64e5e
Коммит 94bea848e4
2 изменённых файлов: 14 добавлений и 26 удалений

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

@ -275,29 +275,19 @@ 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("certErrorExpiredNow3",
[hostString, notAfterLocalTime], 2);
msg += "\n";
} else {
technicalInfo.textContent = "";
msg += gPipNSSBundle.formatStringFromName("certErrorNotYetValidNow3",
[hostString, notBeforeLocalTime], 2);
msg += "\n";
}
} else {
// If something goes wrong, we assume the cert expired.
technicalInfo.textContent = "";
msg += gPipNSSBundle.formatStringFromName("certErrorExpiredNow3",
[hostString, notAfterLocalTime], 2);
msg += "\n";
let msg;
if (input.data.validity.notBefore && (Date.now() < input.data.validity.notAfter)) {
let notBeforeLocalTime = formatter.format(new Date(input.data.validity.notBefore));
msg = gPipNSSBundle.formatStringFromName("certErrorNotYetValidNow3",
[hostString, notBeforeLocalTime], 2);
} else {
let notAfterLocalTime = formatter.format(new Date(input.data.validity.notAfter));
msg = gPipNSSBundle.formatStringFromName("certErrorExpiredNow3",
[hostString, notAfterLocalTime], 2);
}
msg += "\n";
technicalInfo.textContent = "";
technicalInfo.append(msg);
}
technicalInfo.append("\n");

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

@ -3238,10 +3238,8 @@ var BrowserOnClick = {
let errorInfo = getDetailedCertErrorInfo(location,
securityInfo);
let validityInfo = {
notAfter: securityInfo.serverCert.validity.notAfter,
notBefore: securityInfo.serverCert.validity.notBefore,
notAfterLocalTime: securityInfo.serverCert.validity.notAfterLocalTime,
notBeforeLocalTime: securityInfo.serverCert.validity.notBeforeLocalTime,
notAfter: securityInfo.serverCert.validity.notAfter / 1000,
notBefore: securityInfo.serverCert.validity.notBefore / 1000,
};
browser.messageManager.sendAsyncMessage("CertErrorDetails", {
code: securityInfo.errorCode,