Bug 1470487 - Move netmonitor security localization to client. r=Honza

--HG--
extra : rebase_source : d31f01e59685d1c2ba59ed7fbaef837f88102e9b
This commit is contained in:
J. Ryan Stinnett 2018-06-22 18:32:39 -05:00
Родитель 7a3561c266
Коммит 9c965eb38f
4 изменённых файлов: 48 добавлений и 56 удалений

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

@ -466,12 +466,6 @@ certmgr.certdetail.sha1fingerprint=SHA1 Fingerprint:
# This string is used as a label in the security tab.
certmgr.certificateTransparency.label=Transparency:
# LOCALIZATION NOTE (certmgr.certificateTransparency.status.none):
# This string is used to indicate that there are no signed certificate
# timestamps available. This is a property for the 'Transparency'
# field in the security tab.
certmgr.certificateTransparency.status.none=No SCT records
# LOCALIZATION NOTE (certmgr.certificateTransparency.status.ok):
# This string is used to indicate that there are valid signed certificate
# timestamps. This is a property for the 'Transparency'

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

@ -30,12 +30,24 @@ const DISABLED_LABEL = L10N.getStr("netmonitor.security.disabled");
const CONNECTION_LABEL = L10N.getStr("netmonitor.security.connection");
const PROTOCOL_VERSION_LABEL = L10N.getStr("netmonitor.security.protocolVersion");
const KEA_GROUP_LABEL = L10N.getStr("netmonitor.security.keaGroup");
const KEA_GROUP_NONE = L10N.getStr("netmonitor.security.keaGroup.none");
const KEA_GROUP_CUSTOM = L10N.getStr("netmonitor.security.keaGroup.custom");
const KEA_GROUP_UNKNOWN = L10N.getStr("netmonitor.security.keaGroup.unknown");
const SIGNATURE_SCHEME_LABEL = L10N.getStr("netmonitor.security.signatureScheme");
const SIGNATURE_SCHEME_NONE = L10N.getStr("netmonitor.security.signatureScheme.none");
const SIGNATURE_SCHEME_UNKNOWN =
L10N.getStr("netmonitor.security.signatureScheme.unknown");
const HSTS_LABEL = L10N.getStr("netmonitor.security.hsts");
const HPKP_LABEL = L10N.getStr("netmonitor.security.hpkp");
const CERTIFICATE_LABEL = L10N.getStr("netmonitor.security.certificate");
const CERTIFICATE_TRANSPARENCY_LABEL =
L10N.getStr("certmgr.certificateTransparency.label");
L10N.getStr("certmgr.certificateTransparency.label");
const CERTIFICATE_TRANSPARENCY_POLICY_COMPLIANT =
L10N.getStr("certmgr.certificateTransparency.status.ok");
const CERTIFICATE_TRANSPARENCY_POLICY_NOT_ENOUGH_SCTS =
L10N.getStr("certmgr.certificateTransparency.status.notEnoughSCTS");
const CERTIFICATE_TRANSPARENCY_POLICY_NOT_DIVERSE_SCTS =
L10N.getStr("certmgr.certificateTransparency.status.notDiverseSCTS");
const SUBJECT_INFO_LABEL = L10N.getStr("certmgr.subjectinfo.label");
const CERT_DETAIL_COMMON_NAME_LABEL = L10N.getStr("certmgr.certdetail.cn");
const CERT_DETAIL_ORG_LABEL = L10N.getStr("certmgr.certdetail.o");
@ -122,6 +134,38 @@ class SecurityPanel extends Component {
const HOST_HEADER_LABEL = L10N.getFormatStr("netmonitor.security.hostHeader",
getUrlHost(url));
// Localize special values for key exchange group name.
if (securityInfo.keaGroupName == "none") {
securityInfo.keaGroupName = KEA_GROUP_NONE;
}
if (securityInfo.keaGroupName == "custom") {
securityInfo.keaGroupName = KEA_GROUP_CUSTOM;
}
if (securityInfo.keaGroupName == "unknown group") {
securityInfo.keaGroupName = KEA_GROUP_UNKNOWN;
}
// Localize special values for certificate signature scheme.
if (securityInfo.signatureSchemeName == "none") {
securityInfo.signatureSchemeName = SIGNATURE_SCHEME_NONE;
}
if (securityInfo.signatureSchemeName == "unknown signature") {
securityInfo.signatureSchemeName = SIGNATURE_SCHEME_UNKNOWN;
}
// Localize special values for certificate transparency status.
if (securityInfo.certificateTransparency == 5) {
securityInfo.certificateTransparency = CERTIFICATE_TRANSPARENCY_POLICY_COMPLIANT;
}
if (securityInfo.certificateTransparency == 6) {
securityInfo.certificateTransparency =
CERTIFICATE_TRANSPARENCY_POLICY_NOT_ENOUGH_SCTS;
}
if (securityInfo.certificateTransparency == 7) {
securityInfo.certificateTransparency =
CERTIFICATE_TRANSPARENCY_POLICY_NOT_DIVERSE_SCTS;
}
object = {
[CONNECTION_LABEL]: {
[PROTOCOL_VERSION_LABEL]:

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

@ -81,7 +81,7 @@ types.addDictType("netevent.secinfo", {
signatureSchemeName: "string",
protocolVersion: "string",
cert: "nullable:netevent.cert",
certificateTransparency: "nullable:string",
certificateTransparency: "number",
hsts: "boolean",
hpkp: "boolean",
errorMessage: "nullable:string",

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

@ -63,8 +63,6 @@ const {components, Cc, Ci} = require("chrome");
loader.lazyImporter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const Services = require("Services");
const { LocalizationHelper } = require("devtools/shared/l10n");
const L10N = new LocalizationHelper("devtools/client/locales/netmonitor.properties");
// The cache used in the `nsIURL` function.
const gNSURLStore = new Map();
@ -644,28 +642,9 @@ var NetworkHelper = {
// Key exchange group name.
info.keaGroupName = SSLStatus.keaGroupName;
// Localise two special values.
if (info.keaGroupName == "none") {
info.keaGroupName = L10N.getStr("netmonitor.security.keaGroup.none");
}
if (info.keaGroupName == "custom") {
info.keaGroupName = L10N.getStr("netmonitor.security.keaGroup.custom");
}
if (info.keaGroupName == "unknown group") {
info.keaGroupName = L10N.getStr("netmonitor.security.keaGroup.unknown");
}
// Certificate signature scheme.
info.signatureSchemeName = SSLStatus.signatureSchemeName;
// Localise two special values.
if (info.signatureSchemeName == "none") {
info.signatureSchemeName =
L10N.getStr("netmonitor.security.signatureScheme.none");
}
if (info.signatureSchemeName == "unknown signature") {
info.signatureSchemeName =
L10N.getStr("netmonitor.security.signatureScheme.unknown");
}
// Protocol version.
info.protocolVersion =
@ -674,33 +653,8 @@ var NetworkHelper = {
// Certificate.
info.cert = this.parseCertificateInfo(SSLStatus.serverCert);
info.certificateTransparency = null;
switch (SSLStatus.certificateTransparencyStatus) {
case SSLStatus.CERTIFICATE_TRANSPARENCY_NOT_APPLICABLE:
default:
break;
case SSLStatus.CERTIFICATE_TRANSPARENCY_NONE:
info.certificateTransparency =
L10N.getStr("certmgr.certificateTransparency.status.none");
break;
case SSLStatus.CERTIFICATE_TRANSPARENCY_POLICY_COMPLIANT:
info.certificateTransparency =
L10N.getStr("certmgr.certificateTransparency.status.ok");
break;
case SSLStatus.CERTIFICATE_TRANSPARENCY_POLICY_NOT_ENOUGH_SCTS:
info.certificateTransparency =
L10N.getStr(
"certmgr.certificateTransparency.status.notEnoughSCTS"
);
break;
case SSLStatus.CERTIFICATE_TRANSPARENCY_POLICY_NOT_DIVERSE_SCTS:
info.certificateTransparency =
L10N.getStr(
"certmgr.certificateTransparency.status.notDiverseSCTS"
);
break;
}
// Certificate transparency status.
info.certificateTransparency = SSLStatus.certificateTransparencyStatus;
// HSTS and HPKP if available.
if (httpActivity.hostname) {