Bug 1470516 - remove or fix localized values in securityInfo, r=rpl a=lizzard
authorShane Caraveo <scaraveo@mozilla.com>
Mon, 02 Jul 2018 15:45:18 -0300
changeset 477854 97d009f65f60e473a957ac5930589d8b2127a109
parent 477853 ab4de937c2d276d352627bbcb43eace6f3610c21
child 477855 dfca0c7dd6d7cf5d3166b661151405cf51a0d103
push id9445
push userarchaeopteryx@coole-files.de
push dateSat, 07 Jul 2018 21:43:02 +0000
treeherdermozilla-beta@0a939a1cd7f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrpl, lizzard
bugs1470516
milestone62.0
Bug 1470516 - remove or fix localized values in securityInfo, r=rpl a=lizzard MozReview-Commit-ID: 3xURSfbPTmS
toolkit/components/extensions/schemas/web_request.json
toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html
toolkit/modules/addons/SecurityInfo.jsm
--- a/toolkit/components/extensions/schemas/web_request.json
+++ b/toolkit/components/extensions/schemas/web_request.json
@@ -184,20 +184,20 @@
           "subject": {
             "type": "string"
           },
           "issuer": {
             "type": "string"
           },
           "validity": {
             "type": "object",
-            "description": "Contains start and end dates in GMT.",
+            "description": "Contains start and end timestamps.",
             "properties": {
-              "startGMT": { "type": "string" },
-              "endGMT": { "type": "string" }
+              "start": { "type": "integer" },
+              "end": { "type": "integer" }
             }
           },
           "fingerprint": {
             "type": "object",
             "properties": {
               "sha1": { "type": "string" },
               "sha256": { "type": "string" }
             }
@@ -209,19 +209,16 @@
             "type": "boolean"
           },
           "subjectPublicKeyInfoDigest": {
             "type": "object",
             "properties": {
               "sha256": { "type": "string" }
             }
           },
-          "keyUsages": {
-            "type": "string"
-          },
           "rawDER": {
             "optional": true,
             "type": "array",
             "items": {
               "type": "integer"
             }
           }
         }
--- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html
@@ -32,16 +32,18 @@ function getExtension() {
                               "security info reflects https");
 
       if (options.certificateChain) {
         // Some of the tests here only produce a single cert in the chain.
         browser.test.assertTrue(securityInfo.certificates.length >= 1, "have certificate chain");
       } else {
         browser.test.assertTrue(securityInfo.certificates.length == 1, "no certificate chain");
       }
+      let cert = securityInfo.certificates[0];
+      browser.test.assertTrue(cert.validity.start < Date.now() < cert.validity.end, "cert validity is correct");
       if (options.rawDER) {
         for (let cert of securityInfo.certificates) {
           browser.test.assertTrue(cert.rawDER.length > 0, "have rawDER");
         }
       }
     }
 
     browser.webRequest.onHeadersReceived.addListener(async (details) => {
--- a/toolkit/modules/addons/SecurityInfo.jsm
+++ b/toolkit/modules/addons/SecurityInfo.jsm
@@ -205,29 +205,28 @@ const SecurityInfo = {
     if (!cert) {
       return {};
     }
 
     let certData = {
       subject: cert.subjectName,
       issuer: cert.issuerName,
       validity: {
-        startGMT: cert.validity.notBeforeGMT,
-        endGMT: cert.validity.notAfterGMT,
+        start: cert.validity.notBefore,
+        end: cert.validity.notAfter,
       },
       fingerprint: {
         sha1: cert.sha1Fingerprint,
         sha256: cert.sha256Fingerprint,
       },
       serialNumber: cert.serialNumber,
       isBuiltInRoot: cert.isBuiltInRoot,
       subjectPublicKeyInfoDigest: {
         sha256: cert.sha256SubjectPublicKeyInfoDigest,
       },
-      keyUsages: cert.keyUsages,
     };
     if (options.rawDER) {
       certData.rawDER = cert.getRawDER({});
     }
     return certData;
   },
 
   // Bug 1355903 Transparency is currently disabled using security.pki.certificate_transparency.mode