diff options
Diffstat (limited to 'toolkit/components/certviewer/tests')
26 files changed, 2748 insertions, 0 deletions
diff --git a/toolkit/components/certviewer/tests/browser/adjustedCerts.js b/toolkit/components/certviewer/tests/browser/adjustedCerts.js new file mode 100644 index 0000000000..0b0c089a61 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/adjustedCerts.js @@ -0,0 +1,261 @@ +"use strict"; + +/* +To change this file you will have to add a function to download a file in toolkit/components/certviewer/content/certviewer.mjs (e.g: https://ourcodeworld.com/articles/read/189/how-to-create-a-file-and-generate-a-download-with-javascript-in-the-browser-without-a-server), +download adjustedCerts (e.g: download("out.txt", JSON.stringify(adjustedCerts)), do it after this line https://searchfox.org/mozilla-central/rev/e3fc8f8970491aef14d3212b2d052942f4d29818/toolkit/components/certviewer/content/certviewer.mjs#428), +then open Nightly and go to about:certificate?cert=MIIHQjCCBiqgAwIBAgIQCgYwQn9bvO1pVzllk7ZFHzANBgkqhkiG9w0BAQsFADB1MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTQwMgYDVQQDEytEaWdpQ2VydCBTSEEyIEV4dGVuZGVkIFZhbGlkYXRpb24gU2VydmVyIENBMB4XDTE4MDUwODAwMDAwMFoXDTIwMDYwMzEyMDAwMFowgccxHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5pemF0aW9uMRMwEQYLKwYBBAGCNzwCAQMTAlVTMRkwFwYLKwYBBAGCNzwCAQITCERlbGF3YXJlMRAwDgYDVQQFEwc1MTU3NTUwMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEVMBMGA1UEChMMR2l0SHViLCBJbmMuMRMwEQYDVQQDEwpnaXRodWIuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxjyq8jyXDDrBTyitcnB90865tWBzpHSbindG%2FXq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YFIe7E6LMZ3AKPDWYBPkb37jjd80OyA3cEAAAAWNBYm0KAAAEAwBHMEUCIQDRZp38cTWsWH2GdBpe%2FuPTWnsu%2Fm4BEC2%2BdIcvSykZYgIgCP5gGv6yzaazxBK2NwGdmmyuEFNSg2pARbMJlUFgU5UAdgBWFAaaL9fC7NP14b1Esj7HRna5vJkRXMDvlJhV1onQ3QAAAWNBYm0tAAAEAwBHMEUCIQCi7omUvYLm0b2LobtEeRAYnlIo7n6JxbYdrtYdmPUWJQIgVgw1AZ51vK9ENinBg22FPxb82TvNDO05T17hxXRC2IYAdgC72d%2B8H4pxtZOUI5eqkntHOFeVCqtS6BqQlmQ2jh7RhQAAAWNBYm3fAAAEAwBHMEUCIQChzdTKUU2N%2BXcqcK0OJYrN8EYynloVxho4yPk6Dq3EPgIgdNH5u8rC3UcslQV4B9o0a0w204omDREGKTVuEpxGeOQwDQYJKoZIhvcNAQELBQADggEBAHAPWpanWOW%2Fip2oJ5grAH8mqQfaunuCVE%2Bvac%2B88lkDK%2FLVdFgl2B6kIHZiYClzKtfczG93hWvKbST4NRNHP9LiaQqdNC17e5vNHnXVUGw%2ByxyjMLGqkgepOnZ2Rb14kcTOGp4i5AuJuuaMwXmCo7jUwPwfLe1NUlVBKqg6LK0Hcq4K0sZnxE8HFxiZ92WpV2AVWjRMEc%2F2z2shNoDvxvFUYyY1Oe67xINkmyQKc%2BygSBZzyLnXSFVWmHr3u5dcaaQGGAR42v6Ydr4iL38Hd4dOiBma%2BFXsXBIqWUjbST4VXmdaol7uzFMojA4zkxQDZAvF5XgJlAFadfySna%2Fteik%3D +open the file, and finally copy and paste it here like + +const adjustedCerts = <what you just copied>; +*/ + +const adjustedCerts = [ + { + certItems: [ + { + sectionId: "subject-name", + sectionItems: [ + { labelId: "business-category", info: "Private Organization" }, + { labelId: "inc-country", info: "US" }, + { labelId: "inc-state-province", info: "Delaware" }, + { labelId: "serial-number", info: "5157550" }, + { labelId: "country", info: "US" }, + { labelId: "state-province", info: "California" }, + { labelId: "locality", info: "San Francisco" }, + { labelId: "organization", info: "GitHub, Inc." }, + { labelId: "common-name", info: "github.com" }, + ], + Critical: false, + }, + { + sectionId: "issuer-name", + sectionItems: [ + { labelId: "country", info: "US" }, + { labelId: "organization", info: "DigiCert Inc" }, + { labelId: "organizational-unit", info: "www.digicert.com" }, + { + labelId: "common-name", + info: "DigiCert SHA2 Extended Validation Server CA", + }, + ], + Critical: false, + }, + { + sectionId: "validity", + sectionItems: [ + { + labelId: "not-before", + info: { + local: "5/7/2018, 9:00:00 PM (Brasilia Standard Time)", + utc: "Tue, 08 May 2018 00:00:00 GMT", + }, + }, + { + labelId: "not-after", + info: { + local: "6/3/2020, 9:00:00 AM (Brasilia Standard Time)", + utc: "Wed, 03 Jun 2020 12:00:00 GMT", + }, + }, + ], + Critical: false, + }, + { + sectionId: "subject-alt-names", + sectionItems: [ + { labelId: "dns-name", info: "github.com" }, + { labelId: "dns-name", info: "www.github.com" }, + ], + Critical: false, + }, + { + sectionId: "public-key-info", + sectionItems: [ + { labelId: "algorithm", info: "RSA" }, + { labelId: "key-size", info: 2048 }, + { labelId: "exponent", info: 65537 }, + { + labelId: "modulus", + info: "C6:3C:AA:F2:3C:97:0C:3A:C1:4F:28:AD:72:70:7D:D3:CE:B9:B5:60:73:A4:74:9B:8A:77:46:FD:7A:98:42:4C:C5:30:19:57:9A:A9:33:0B:E1:5D:4D:10:58:CA:77:99:C3:93:F3:F9:75:90:BC:BF:BB:E0:95:BA:2E:C5:8D:73:61:05:D3:10:84:A8:B3:89:B8:2F:73:8C:F0:2A:6E:BE:EE:AE:83:4B:82:11:B1:61:FD:77:61:DA:9B:1B:9A:23:FF:8C:7E:A2:01:06:DD:D1:7F:53:96:08:C1:5A:FA:E7:C0:CA:C8:44:8C:57:A7:A8:61:5F:66:0D:57:D3:B8:96:AC:B6:4A:9C:C1:EA:E8:FB:96:40:29:F6:15:30:B5:04:B0:CC:05:B6:84:C3:24:59:95:7F:A2:65:90:E5:B0:B3:1A:75:59:C4:3F:31:14:0A:D5:CC:AA:3A:85:05:52:06:32:96:07:61:DF:27:82:0C:F7:85:DB:60:31:F0:09:50:C5:B7:1A:23:E1:B0:7D:02:F5:14:1E:C9:CB:E8:7E:2A:33:04:F6:51:3F:52:98:15:E9:0B:76:47:5C:4D:4A:6B:C5:08:15:AE:F8:D1:57:E9:EA:70:14:FF:C9:45:B9:0C:7C:BC:F4:6D:E6:05:52:F9:8C:80:BB:70:56:91:0F:4B", + }, + ], + Critical: false, + }, + { + sectionId: "miscellaneous", + sectionItems: [ + { + labelId: "serial-number", + info: "0A:06:30:42:7F:5B:BC:ED:69:57:39:65:93:B6:45:1F", + }, + { + labelId: "signature-algorithm", + info: "SHA-256 with RSA Encryption", + }, + { labelId: "version", info: "3" }, + { + labelId: "download", + info: "PEM (cert)PEM (chain)", + }, + ], + Critical: false, + }, + { + sectionId: "fingerprints", + sectionItems: [ + { + labelId: "sha-256", + info: "31:11:50:0C:4A:66:01:2C:DA:E3:33:EC:3F:CA:1C:9D:DE:45:C9:54:44:0E:7E:E4:13:71:6B:FF:36:63:C0:74", + }, + { + labelId: "sha-1", + info: "CA:06:F5:6B:25:8B:7A:0D:4F:2B:05:47:09:39:47:86:51:15:19:84", + }, + ], + Critical: false, + }, + { + sectionId: "basic-constraints", + sectionItems: [{ labelId: "certificate-authority", info: false }], + Critical: true, + }, + { + sectionId: "key-usages", + sectionItems: [ + { + labelId: "purposes", + info: ["Digital Signature", "Key Encipherment"], + }, + ], + Critical: true, + }, + { + sectionId: "extended-key-usages", + sectionItems: [ + { + labelId: "purposes", + info: ["Server Authentication", "Client Authentication"], + }, + ], + Critical: false, + }, + { + sectionId: "subject-key-id", + sectionItems: [ + { + labelId: "key-id", + info: "C9:C2:53:61:66:9D:5F:AB:25:F4:26:CD:0F:38:9A:A8:49:EA:48:A9", + }, + ], + Critical: false, + }, + { + sectionId: "authority-key-id", + sectionItems: [ + { + labelId: "key-id", + info: "3D:D3:50:A5:D6:A0:AD:EE:F3:4A:60:0A:65:D3:21:D4:F8:F8:D6:0F", + }, + ], + Critical: false, + }, + { + sectionId: "crl-endpoints", + sectionItems: [ + { + labelId: "distribution-point", + info: "http://crl3.digicert.com/sha2-ev-server-g2.crl", + }, + { + labelId: "distribution-point", + info: "http://crl4.digicert.com/sha2-ev-server-g2.crl", + }, + ], + Critical: false, + }, + { + sectionId: "authority-info-aia", + sectionItems: [ + { labelId: "location", info: "http://ocsp.digicert.com" }, + { + labelId: "method", + info: "Online Certificate Status Protocol (OCSP)", + }, + { + labelId: "location", + info: "http://cacerts.digicert.com/DigiCertSHA2ExtendedValidationServerCA.crt", + }, + { labelId: "method", info: "CA Issuers" }, + ], + Critical: false, + }, + { + sectionId: "certificate-policies", + sectionItems: [ + { + labelId: "policy", + info: "ANSI Organizational Identifier ( 2.16.840 )", + }, + { labelId: "value", info: "2.16.840.1.114412.2.1" }, + { + labelId: "qualifier", + info: "Practices Statement ( 1.3.6.1.5.5.7.2.1 )", + }, + { labelId: "value", info: "https://www.digicert.com/CPS" }, + { labelId: "policy", info: "Certificate Type ( 2.23.140.1.1 )" }, + { labelId: "value", info: "Extended Validation" }, + ], + Critical: false, + }, + { + sectionId: "embedded-scts", + sectionItems: [ + { + labelId: "logid", + info: "A4:B9:09:90:B4:18:58:14:87:BB:13:A2:CC:67:70:0A:3C:35:98:04:F9:1B:DF:B8:E3:77:CD:0E:C8:0D:DC:10", + }, + { labelId: "name", info: "Google “Pilot”" }, + { labelId: "signaturealgorithm", info: "SHA-256 ECDSA" }, + { labelId: "version", info: 1 }, + { + labelId: "timestamp", + info: { + local: "5/8/2018, 5:12:39 PM (Brasilia Standard Time)", + utc: "Tue, 08 May 2018 20:12:39 GMT", + }, + }, + { + labelId: "logid", + info: "56:14:06:9A:2F:D7:C2:EC:D3:F5:E1:BD:44:B2:3E:C7:46:76:B9:BC:99:11:5C:C0:EF:94:98:55:D6:89:D0:DD", + }, + { labelId: "name", info: "DigiCert Server" }, + { labelId: "signaturealgorithm", info: "SHA-256 ECDSA" }, + { labelId: "version", info: 1 }, + { + labelId: "timestamp", + info: { + local: "5/8/2018, 5:12:39 PM (Brasilia Standard Time)", + utc: "Tue, 08 May 2018 20:12:39 GMT", + }, + }, + { + labelId: "logid", + info: "BB:D9:DF:BC:1F:8A:71:B5:93:94:23:97:AA:92:7B:47:38:57:95:0A:AB:52:E8:1A:90:96:64:36:8E:1E:D1:85", + }, + { labelId: "name", info: "Google “Skydiver”" }, + { labelId: "signaturealgorithm", info: "SHA-256 ECDSA" }, + { labelId: "version", info: 1 }, + { + labelId: "timestamp", + info: { + local: "5/8/2018, 5:12:39 PM (Brasilia Standard Time)", + utc: "Tue, 08 May 2018 20:12:39 GMT", + }, + }, + ], + Critical: false, + }, + ], + tabName: "github.com", + }, +]; diff --git a/toolkit/components/certviewer/tests/browser/browser.ini b/toolkit/components/certviewer/tests/browser/browser.ini new file mode 100644 index 0000000000..baf9b81e56 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser.ini @@ -0,0 +1,23 @@ +[DEFAULT] +support-files = + head.js + adjustedCerts.js +[browser_aboutcertificateviewer.js] +[browser_checkLongHex.js] +[browser_checkMissingCommonName.js] +[browser_checkNonEmptyFields.js] +[browser_checkNonRepeatedCertTabs.js] +[browser_checkNonUndefinedStrings.js] +[browser_checkOCSP.js] +disabled = bug 1596313 +[browser_checkStandAlonePage.js] +[browser_checkAuthorityKeyID.js] +[browser_checkValiditySection.js] +[browser_handleMultipleCertsURL.js] +disabled = bug 1626853 +[browser_openTabAndSendCertInfo.js] +support-files = + dummy_page.html +[browser_renderCertToUI.js] +[browser_certificateTabLink.js] +[browser_downloadLink.js] diff --git a/toolkit/components/certviewer/tests/browser/browser_aboutcertificateviewer.js b/toolkit/components/certviewer/tests/browser/browser_aboutcertificateviewer.js new file mode 100644 index 0000000000..efd78fc6f5 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_aboutcertificateviewer.js @@ -0,0 +1,81 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const validCert = + "about:certificate?cert=MIIGMDCCBRigAwIBAgIQCa2oS7Nau6nwv1WyRNIJnzANBgkqhkiG9w0BAQsFADBwMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMS8wLQYDVQQDEyZEaWdpQ2VydCBTSEEyIEhpZ2ggQXNzdXJhbmNlIFNlcnZlciBDQTAeFw0xOTA2MDYwMDAwMDBaFw0xOTA5MDQxMjAwMDBaMGExCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTETMBEGA1UEBxMKTWVubG8gUGFyazEXMBUGA1UEChMORmFjZWJvb2ssIEluYy4xFzAVBgNVBAMMDiouZmFjZWJvb2suY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEALPlfjd8gHkIMDeBOFhRt0e%2B%2F3fdm%2BZdzdM4s1WIHVbYztgmdEy20PUwDCviYKJX4GG%2BT9ivT8kJ%2FvWl1P%2FYqOCA54wggOaMB8GA1UdIwQYMBaAFFFo%2F5CvAgd1PMzZZWRiohK4WXI7MB0GA1UdDgQWBBTsQZVRTuib7KY9w3FfOYsZHvOC9zCBxwYDVR0RBIG%2FMIG8gg4qLmZhY2Vib29rLmNvbYINbWVzc2VuZ2VyLmNvbYILKi5mYmNkbi5uZXSCCCouZmIuY29tghAqLm0uZmFjZWJvb2suY29tggZmYi5jb22CDiouZmFjZWJvb2submV0gg4qLnh4LmZiY2RuLm5ldIIOKi54ei5mYmNkbi5uZXSCDyoubWVzc2VuZ2VyLmNvbYILKi5mYnNieC5jb22CDioueHkuZmJjZG4ubmV0ggxmYWNlYm9vay5jb20wDgYDVR0PAQH%2FBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjB1BgNVHR8EbjBsMDSgMqAw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9o0a0w204omDREGKTVuEpxGeOQwDQYJKoZIhvcNAQELBQADggEBAHAPWpanWOW%2Fip2oJ5grAH8mqQfaunuCVE%2Bvac%2B88lkDK%2FLVdFgl2B6kIHZiYClzKtfczG93hWvKbST4NRNHP9LiaQqdNC17e5vNHnXVUGw%2ByxyjMLGqkgepOnZ2Rb14kcTOGp4i5AuJuuaMwXmCo7jUwPwfLe1NUlVBKqg6LK0Hcq4K0sZnxE8HFxiZ92WpV2AVWjRMEc%2F2z2shNoDvxvFUYyY1Oe67xINkmyQKc%2BygSBZzyLnXSFVWmHr3u5dcaaQGGAR42v6Ydr4iL38Hd4dOiBma%2BFXsXBIqWUjbST4VXmdaol7uzFMojA4zkxQDZAvF5XgJlAFadfySna%2Fteik%3D"; + +async function checkForErrorSection(infoMessage, url, errorMessage, testType) { + info(infoMessage); + + await BrowserTestUtils.withNewTab(url, async function (browser) { + await SpecialPowers.spawn( + browser, + [{ errorMessage, testType }], + async function ({ errorMessage, testType }) { + let errorSection; + + if (testType === "invalid") { + await ContentTaskUtils.waitForCondition(() => { + return (errorSection = content.document + .querySelector("certificate-section") + .shadowRoot.querySelector("error-section")); + }, errorMessage); + ok(errorSection, errorMessage); + } else if (testType === "valid") { + ok(!errorSection, errorMessage); + } + } + ); + }); +} + +add_task(async function test_checkForErrorSection() { + let itemsToTest = [ + { + testType: "valid", + url: validCert, + infoMessage: "Testing for error when a valid certificate is provided.", + errorMessage: + "Error section should not be visible when URL contains a valid certificate.", + }, + { + testType: "invalid", + url: invalidCert, + infoMessage: "Testing for error when invalid certificate is provided.", + errorMessage: + "Error section should be visible when certificate is invalid.", + }, + { + testType: "invalid", + url: pem_to_der_error, + infoMessage: "Testing for error when PEM to DIR error occurs.", + errorMessage: + "Error section should be visible when PEM to DIR error occurs.", + }, + { + testType: "invalid", + url: error_parsing_cert, + infoMessage: "Testing for error when parsing error occurs.", + errorMessage: + "Error section should be visible when parsing error occurs.", + }, + ]; + + for (let i = 0; i < itemsToTest.length; i++) { + let item = itemsToTest[i]; + await checkForErrorSection( + item.infoMessage, + item.url, + item.errorMessage, + item.testType + ); + } +}); diff --git a/toolkit/components/certviewer/tests/browser/browser_certificateTabLink.js b/toolkit/components/certviewer/tests/browser/browser_certificateTabLink.js new file mode 100644 index 0000000000..9c88d2bb03 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_certificateTabLink.js @@ -0,0 +1,61 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const validCert = + "about:certificate?cert=MIIGMDCCBRigAwIBAgIQCa2oS7Nau6nwv1WyRNIJnzANBgkqhkiG9w0BAQsFADBwMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMS8wLQYDVQQDEyZEaWdpQ2VydCBTSEEyIEhpZ2ggQXNzdXJhbmNlIFNlcnZlciBDQTAeFw0xOTA2MDYwMDAwMDBaFw0xOTA5MDQxMjAwMDBaMGExCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTETMBEGA1UEBxMKTWVubG8gUGFyazEXMBUGA1UEChMORmFjZWJvb2ssIEluYy4xFzAVBgNVBAMMDiouZmFjZWJvb2suY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEALPlfjd8gHkIMDeBOFhRt0e%2B%2F3fdm%2BZdzdM4s1WIHVbYztgmdEy20PUwDCviYKJX4GG%2BT9ivT8kJ%2FvWl1P%2FYqOCA54wggOaMB8GA1UdIwQYMBaAFFFo%2F5CvAgd1PMzZZWRiohK4WXI7MB0GA1UdDgQWBBTsQZVRTuib7KY9w3FfOYsZHvOC9zCBxwYDVR0RBIG%2FMIG8gg4qLmZhY2Vib29rLmNvbYINbWVzc2VuZ2VyLmNvbYILKi5mYmNkbi5uZXSCCCouZmIuY29tghAqLm0uZmFjZWJvb2suY29tggZmYi5jb22CDiouZmFjZWJvb2submV0gg4qLn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i9RKR%2F5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2%2FS6cCZdkGCevEsXCS%2B0yx5DaMkHJ8HSXPfqIbloEpw8nL%2Be%2FIBcm2PN7EeqJSdnoDfzAIJ9VNep%2BOkuE6N36B9K"; + +add_task(async function test_certificateTabLink() { + await BrowserTestUtils.openNewForegroundTab(gBrowser, () => { + gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, validCert); + }); + + await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () { + let certificateTabs; + await ContentTaskUtils.waitForCondition(() => { + certificateTabs = content.document + .querySelector("certificate-section") + .shadowRoot.querySelectorAll(".certificate-tab"); + return certificateTabs.length; + }, "Found certificate tabs."); + + ok(certificateTabs.length, "Certificate tabs should exist."); + + let issuerNameGroups = content.document + .querySelector("certificate-section") + .shadowRoot.querySelectorAll(".issuer-name"); + let issuerNames = []; + for (let i = 0; i < issuerNameGroups.length; i++) { + issuerNames.push( + issuerNameGroups[i].shadowRoot.querySelector(".common-name") + ); + } + + for (let i = 0; i < issuerNames.length; i++) { + if (i < issuerNames.length - 1) { + issuerNames[i].shadowRoot.querySelector("a").click(); + await ContentTaskUtils.waitForCondition(() => { + return certificateTabs[i + 1].classList.contains("selected"); + }, "Clicking link should select new tab."); + ok( + certificateTabs[i + 1].classList.contains("selected"), + "Clicking link should select new tab." + ); + } else { + await ContentTaskUtils.waitForCondition(() => { + return certificateTabs[i].classList.contains("selected"); + }, "Clicking link should select new tab."); + ok( + certificateTabs[i].classList.contains("selected"), + "Clicking link should select new tab." + ); + ok( + !issuerNames[i].shadowRoot.querySelector("a"), + "Final tab's issuer name should not be link." + ); + } + } + }); + gBrowser.removeCurrentTab(); // closes about:certificate +}); diff --git a/toolkit/components/certviewer/tests/browser/browser_checkAuthorityKeyID.js b/toolkit/components/certviewer/tests/browser/browser_checkAuthorityKeyID.js new file mode 100644 index 0000000000..a923f7acb3 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_checkAuthorityKeyID.js @@ -0,0 +1,50 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +async function checkAuthorityKeyID(url, expectedKeyId) { + await BrowserTestUtils.withNewTab(url, async function (browser) { + await SpecialPowers.spawn( + browser, + [expectedKeyId], + async function (expectedKeyId) { + let certificateSection = await ContentTaskUtils.waitForCondition(() => { + return content.document.querySelector("certificate-section"); + }, "Certificate section found"); + let authorityKeySection = + certificateSection.shadowRoot.querySelector(".authority-key-id"); + let subjectNameSection = + certificateSection.shadowRoot.querySelector(".subject-name"); + if (!expectedKeyId) { + Assert.equal(authorityKeySection, null, "authorityKeySection found"); + Assert.ok(subjectNameSection, "subjectNameSection found"); + return; + } + Assert.ok(authorityKeySection, "authorityKeySection found"); + let item = authorityKeySection.shadowRoot.querySelector("info-item"); + Assert.ok(item, "item found"); + let info = item.shadowRoot.querySelector(".info").textContent; + Assert.equal(info, expectedKeyId, "Key IDs must be equal"); + } + ); + }); +} + +add_task(async function test() { + let tests = [ + { + url: "about:certificate?cert=MIIHQjCCBiqgAwIBAgIQCgYwQn9bvO1pVzllk7ZFHzANBgkqhkiG9w0BAQsFADB1MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTQwMgYDVQQDEytEaWdpQ2VydCBTSEEyIEV4dGVuZGVkIFZhbGlkYXRpb24gU2VydmVyIENBMB4XDTE4MDUwODAwMDAwMFoXDTIwMDYwMzEyMDAwMFowgccxHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5pemF0aW9uMRMwEQYLKwYBBAGCNzwCAQMTAlVTMRkwFwYLKwYBBAGCNzwCAQITCERlbGF3YXJlMRAwDgYDVQQFEwc1MTU3NTUwMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEVMBMG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j03fXSMBhtTn73rohSGIANBnqVftvDDPnEQb5p17giaVbJybfA2tdMvJTZg6pEAx9%2B3zHXRECFpWOtaJDjWbmIExPMgiCSFkBPP3MEDVb7VdHKZs0CvBQg6GmpXg9M4OHZylzS6PXXO8qBCtBdKOwdFSZWbeD9E652rkvb5FuQ8laGHcxgMc2YFlVZaqVowXEkVkkld12d4sBipeRpDWNjA2kLfeUmwsXWtugG8c8Jm9IoZY8oeUkwIDAQABMA0GCSqGSIb3DQEBCwUAA4ICAQCVj6R9C5pE9hkBx7CCr9l4TLoolaEZlKngJHBRRSy5U50MndQ24Jeis2OTxEeYX7DJ%2BOy6QZdaph6FLwALxUWPfQavBcgauKR%2FCdqLQxZc267TMFkRIZvOtHUJ4obJ5qvQAWzNnmRq18b5plznfBfn9b3F2AmHgfsNX6WryQ4geR786VObcUhKTaofcaX%2FE4J9AVzL864fJ%2FDB%2FPSqhYrtskiG6PT9Ngu20ejvgAVk5aJ%2F%2F5Swsjyg6EBl%2BdwJepq2xzI313ZkwCg2pp6oqLDlxf%2Fh585Bsqke39Ax%2B42NWNM14cethcJ7jgyZoEaL3T%2BQ3O%2Bj9XEe5FbvkKtSgMIA6f0FneA4vbF8%2FECPMEi7k3k04gU1gZSR%2FGA63GPEK%2FCLqeh%2BYVgBGKDPinnMEV%2FuBrTUDQFBlDEHlELk7F9o93lxQNs6WOGQSfybfHhySla3nqoYV2phyeZZsJ%2BxMovWWIydJhVN%2F37v0fYTZhnlquGenXHvC5MHrMq2vjUY0Uy637AzXWVNWveNyQmmn9tL4jygELHQu%2Bint4GRybH7rThcslv63D5s4zZza7cITIFjmqZ%2BPrTSVKL%2BlnQLjEMpSdfB86Y2JnMimaOyv%2BbZp1QMB5fYh0PTsjYATi9We%2BDFD42c5H7Su0vFAwCTP11AiKzfbj2oBKVVwwJj3FmkYQ%3D%3D", + expectedKeyId: false, + }, + ]; + + for (let test of tests) { + await checkAuthorityKeyID(test.url, test.expectedKeyId); + } +}); diff --git a/toolkit/components/certviewer/tests/browser/browser_checkLongHex.js b/toolkit/components/certviewer/tests/browser/browser_checkLongHex.js new file mode 100644 index 0000000000..01b54c083b --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_checkLongHex.js @@ -0,0 +1,38 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +async function checkLongHex(url, itemClass) { + await BrowserTestUtils.withNewTab(url, async function (browser) { + await SpecialPowers.spawn(browser, [itemClass], async function (itemClass) { + let certificateSection = await ContentTaskUtils.waitForCondition(() => { + return content.document.querySelector("certificate-section"); + }, "Certificate section found"); + let publicKeyInfoSection = + certificateSection.shadowRoot.querySelector(".public-key-info"); + Assert.ok(publicKeyInfoSection, "publicKeyInfoSection found"); + + let item = publicKeyInfoSection.shadowRoot.querySelector(`.${itemClass}`); + Assert.ok(item, `item ${itemClass} found`); + + let longHex = item.shadowRoot.querySelector(".long-hex"); + Assert.ok(longHex, "longHex class name found"); + }); + }); +} + +add_task(async function test() { + let tests = [ + { + url: "about:certificate?cert=MIIHQjCCBiqgAwIBAgIQCgYwQn9bvO1pVzllk7ZFHzANBgkqhkiG9w0BAQsFADB1MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTQwMgYDVQQDEytEaWdpQ2VydCBTSEEyIEV4dGVuZGVkIFZhbGlkYXRpb24gU2VydmVyIENBMB4XDTE4MDUwODAwMDAwMFoXDTIwMDYwMzEyMDAwMFowgccxHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5pemF0aW9uMRMwEQYLKwYBBAGCNzwCAQMTAlVTMRkwFwYLKwYBBAGCNzwCAQITCERlbGF3YXJlMRAwDgYDVQQFEwc1MTU3NTUwMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEVMBMGA1UEChMMR2l0SHViLCBJbmM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s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj%2B1EbddTKJd%2B82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws%2FzyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9%2BE7gUJTb0o2HLO02JQZR7rkpeDMdmztcpHWD9f", + itemClass: "public-value", + }, + ]; + + for (let test of tests) { + await checkLongHex(test.url, test.itemClass); + } +}); diff --git a/toolkit/components/certviewer/tests/browser/browser_checkMissingCommonName.js b/toolkit/components/certviewer/tests/browser/browser_checkMissingCommonName.js new file mode 100644 index 0000000000..e26612c1b8 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_checkMissingCommonName.js @@ -0,0 +1,50 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function test_check_missing_common_name() { + const kURL = + "about:certificate?cert=MIIHVDCCBTygAwIBAgIQOBNAgEopyUI1DYLsLmSWejANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ6KGM5pS%2F6ZmiMTUwMwYDVQQDDCzmlL%2FlupzkvLrmnI3lmajmlbjkvY3mhpHorYnnrqHnkIbkuK3lv4MgLSBHMTAeFw0yMDAxMjAwNjExMzBaFw0yMjAxMjAwNjExMzBaMFUxCzAJBgNVBAYTAlRXMQ8wDQYDVQQHDAboh7rngaMxEjAQBgNVBAoMCee4vee1seW6nDEhMB8GA1UEAwwYZW5nbGlzaC5wcmVzaWRlbnQuZ292LnR3MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyxCtEdUsGqr%2FVCNOMpj1TkDzBn6Gs1RBHHERU%2BsJ1q3ri6rJfydTx0rQKUbcGEMyWB2pga4dNSjzxQZ6%2BebP3kctC0H%2F%2BptEnsIOQcyD2yLN5yg8ejx6Y568z3fbU%2FRAVo4q6qGZzlBfzl2AhZM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PJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdVxrsStZf0X4OFunHB2WyBEXYKCrC%2Fgpf36j36%2BuwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEPNXubrjlpC2JgQCA2j6%2F7Nu4tCEoduL%2BbXPjqpRugc6bY%2BG7gMwRfaKonh%2B3ZwZCc7b3jajWvY9%2BrGNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxExJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS%2FjQ6fbjpKdx2qcgw%2BBRxgMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR%2B2zGp1iro2C6pSe3VkQw63d4k3jMdXH7OjysP6SHhYKGvzZ8%2Fgntsm%2BHbRsZJB%2F9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmODBCEIZ43ygknQW%2F2xzQ%2BDhNQ%2BIIX3Sj0rnP0qCglN6oH4EZw%3D"; + + await BrowserTestUtils.withNewTab(kURL, async function (browser) { + await SpecialPowers.spawn(browser, [], async function () { + let certificateSection = await ContentTaskUtils.waitForCondition(() => { + return content.document.querySelector("certificate-section"); + }, "Certificate section found"); + + let tabs = + certificateSection.shadowRoot.querySelector( + ".certificate-tabs" + ).children; + + Assert.ok(tabs, "Tabs were found"); + Assert.equal(tabs.length, 4, "There should be 4 tabs"); + for (let tab of tabs) { + Assert.ok(tab.textContent, "Tab should have non-empty label"); + Assert.notEqual( + tab.dataset.l10nId, + "certificate-viewer-unknown-group-label" + ); + // If there is another tab after this one, this tab should link to the + // next via its issuer's common name or OU, if available. + if (tab.nextElementSibling) { + tab.click(); + let infoGroup = certificateSection.shadowRoot.querySelector( + ".selected info-group.issuer-name" + ); + Assert.ok(infoGroup, "infoGroup found"); + let container = + infoGroup.shadowRoot.querySelector(".common-name") || + infoGroup.shadowRoot.querySelector(".organizational-unit"); + Assert.ok(container, "Should find container for link"); + Assert.ok( + container.shadowRoot.querySelector("a"), + "There should be a link in the container for " + + container.textContent + ); + } + } + }); + }); +}); diff --git a/toolkit/components/certviewer/tests/browser/browser_checkNonEmptyFields.js b/toolkit/components/certviewer/tests/browser/browser_checkNonEmptyFields.js new file mode 100644 index 0000000000..e6c48dc3d1 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_checkNonEmptyFields.js @@ -0,0 +1,82 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +async function checkNonEmptyFields(url) { + await BrowserTestUtils.withNewTab(url, async function (browser) { + await SpecialPowers.spawn(browser, [], async function () { + let certificateSection = await ContentTaskUtils.waitForCondition(() => { + return content.document.querySelector("certificate-section"); + }, "Certificate section found"); + + let tabs = + certificateSection.shadowRoot.querySelector( + ".certificate-tabs" + ).children; + + Assert.ok(tabs, "Tabs were found"); + Assert.greater(tabs.length, 0, "There must at least one tab"); + + function clickTabAndCheckSelection(tabID) { + let selectedTabBefore = 0; + + for (let i = 0; i < tabs.length; i++) { + if (tabs[i].className.includes("selected")) { + selectedTabBefore = i; + break; + } + } + + let tabButton = certificateSection.shadowRoot.querySelector( + `.certificate-tabs .tab[idnumber="${tabID}"]` + ); + tabButton.click(); + + if (tabID !== 0) { + Assert.notEqual( + selectedTabBefore, + tabID, + "A new tab should be selected now" + ); + } + } + + for (let i = 0; i < tabs.length; i++) { + clickTabAndCheckSelection(i); + + let infoGroups = + certificateSection.shadowRoot.querySelectorAll("info-group"); + Assert.ok(infoGroups, "infoGroups found"); + + for (let infoGroup of infoGroups) { + let infoItems = infoGroup.shadowRoot.querySelectorAll("info-item"); + Assert.ok(infoItems, "infoItems found"); + + for (let infoItem of infoItems) { + let item = infoItem.shadowRoot.querySelector(".info"); + if (item.textContent.length === 0) { + await ContentTaskUtils.waitForCondition( + () => parseInt(item.textContent.length) > 0, + "info-item has not been localized." + ); + } + } + } + } + }); + }); +} + +add_task(async function test() { + const url1 = + "about:certificate?cert=MIIIIDCCBwigAwIBAgIQdFFdOvtZKGMnFerJav62lzANBgkqhkiG9w0BAQsFADBUMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVR29vZ2xlIFRydXN0IFNlcnZpY2VzMSUwIwYDVQQDExxHb29nbGUgSW50ZXJuZXQgQXV0aG9yaXR5IEczMB4XDTE5MDcyOTE4NDQyN1oXDTE5MTAyMTE4MjMwMFowZjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxEzARBgNVBAoMCkdvb2dsZSBMTEMxFTATBgNVBAMMDCouZ29vZ2xlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABOOufVj7d5UF%2FN49KyXmA0Z0rlQPEicHK5CbO122uECXYbWwepNlWlqM7V1GF0vRutC8YyAlxrCsUmOTrpem7NWjggWlMIIFoTATBgNVHSUEDDAKBggrBgEFBQcDATAOBgNVHQ8BAf8EBAMCB4AwggRqBgNVHREEggRhMIIEXYIMKi5nb29nbGUuY29tgg0qLmFuZHJvaWQuY29tghYqLmFwcGVuZ2luZS5nb29nbGUuY29tghIqLmNsb3VkLmdvb2dsZS5jb22CGCouY3Jvd2Rzb3VyY2UuZ29vZ2xlLmNvbYIGKi5nLmNvgg4qLmdjcC5ndnQyLmNvbYIRKi5nY3BjZG4uZ3Z0MS5jb22CCiouZ2dwaHQuY26CFiouZ29vZ2xlLWFuYWx5dGljcy5jb22CCyouZ29vZ2xlLmNhggsqLmdvb2dsZS5jbIIOKi5nb29nbGUuY28uaW6CDiouZ29vZ2xlLmNvLmpwgg4qLmdvb2dsZS5jby51a4IPKi5nb29nbGUuY29tLmFygg8qLmdvb2dsZS5jb20uYXWCDyouZ29vZ2xlLmNvbS5icoIPKi5nb29nbGUuY29tLmNvgg8qLmdvb2dsZS5jb20ubXiCDyouZ29vZ2xlLmNvbS50coIPKi5nb29nbGUuY29tLnZuggs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EBBCYwJDAiBggrBgEFBQcwAYYWaHR0cDovL29jc3AuY2FjZXJ0Lm9yZzAfBgNVHSMEGDAWgBQWtTIb1Mfz4OaO873SsDrusjkY0TANBgkqhkiG9w0BAQsFAAOCAgEAR5zXs6IX01JTt7Rq3b%2BbNRUhbO9vGBMggczo7R0qIh1kdhS6WzcrDoO6PkpuRg0L3qM7YQB6pw2V%2BubzF7xl4C0HWltfzPTbzAHdJtjaJQw7QaBlmAYpN2CLB6Jeg8q%2F1Xpgdw%2F%2BIP1GRwdg7xUpReUA482l4MH1kf0W0ad94SuIfNWQHcdLApmno%2FSUh1bpZyeWrMnlhkGNDKMxCCQXQ360TwFHc8dfEAaq5ry6cZzm1oetrkSviE2qofxvv1VFiQ%2B9TX3%2FzkECCsUB%2FEjPM0lxFBmu9T5Ih%2BEqns9ivmrEIQDv9tNyJHuLsDNqbUBal7OoiPZnXk9LH%2Bqb%2BpLf1ofv5noy5vX2a5OKebHe%2B0Ex%2FA7e%2BG%2FHuOjVNqhZ9j5Nispfq9zNyOHGWD8ofj8DHwB50L1Xh5H%2BEbIoga%2FhJCQnRtxWkHP699T1JpLFYwapgplivF4TFv4fqp0nHTKC1x9gGrIgvuYJl1txIKmxXdfJzgscMzqpabhtHOMXOiwQBpWzyJkofF%2Fw55e0LttZDBkEsilV%2FvW0CJsPs3eNaQF%2BiMWscGOkgLFlWsAS3HwyiYLNJo26aqyWPaIdc8E4ck7Sk08WrFrHIK3EHr4n1FZwmLpFAvucKqgl0hr%2B2jypyh5puA3KksHF3CsUzjMUvzxMhykh9zrMxQAHLBVrGwc%3D"; + + let urls = [url1, url2, url3]; + + await Promise.all(urls.map(checkNonEmptyFields)); +}); diff --git a/toolkit/components/certviewer/tests/browser/browser_checkNonRepeatedCertTabs.js b/toolkit/components/certviewer/tests/browser/browser_checkNonRepeatedCertTabs.js new file mode 100644 index 0000000000..a66f808f22 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_checkNonRepeatedCertTabs.js @@ -0,0 +1,131 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +function checkCertTabs() { + let certificatePages = 0; + for (let tab of gBrowser.tabs) { + let spec = tab.linkedBrowser.documentURI.spec; + if (spec.includes("about:certificate")) { + certificatePages++; + } + } + Assert.equal(certificatePages, 1, "Do not open repeated certificate pages!"); +} + +add_task(async function testBadCert() { + info("Testing bad cert"); + + let tab = await openErrorPage(); + + let loaded = BrowserTestUtils.waitForNewTab(gBrowser, null, true); + for (let i = 0; i < 2; i++) { + // try opening two certificates that are the same + await SpecialPowers.spawn(tab.linkedBrowser, [], async function () { + let advancedButton = content.document.getElementById("advancedButton"); + Assert.ok(advancedButton, "advancedButton found"); + Assert.equal( + advancedButton.hasAttribute("disabled"), + false, + "advancedButton should be clickable" + ); + advancedButton.click(); + let viewCertificate = content.document.getElementById("viewCertificate"); + Assert.ok(viewCertificate, "viewCertificate found"); + Assert.equal( + viewCertificate.hasAttribute("disabled"), + false, + "viewCertificate should be clickable" + ); + + viewCertificate.click(); + }); + await loaded; + } + checkCertTabs(); + + gBrowser.removeCurrentTab(); // closes about:certificate + gBrowser.removeCurrentTab(); // closes https://expired.example.com/ +}); + +add_task(async function testGoodCert() { + info("Testing page info"); + let url = "https://example.com/"; + + info(`Loading ${url}`); + await BrowserTestUtils.withNewTab({ gBrowser, url }, async function () { + info("Opening pageinfo"); + let pageInfo = BrowserPageInfo(url, "securityTab", {}); + await BrowserTestUtils.waitForEvent(pageInfo, "load"); + + let securityTab = pageInfo.document.getElementById("securityTab"); + await TestUtils.waitForCondition( + () => BrowserTestUtils.is_visible(securityTab), + "Security tab should be visible." + ); + Assert.ok(securityTab, "Security tab is available"); + let viewCertButton = pageInfo.document.getElementById("security-view-cert"); + await TestUtils.waitForCondition( + () => BrowserTestUtils.is_visible(viewCertButton), + "view cert button should be visible." + ); + + let loaded = BrowserTestUtils.waitForNewTab(gBrowser, null, true); + for (let i = 0; i < 2; i++) { + checkAndClickButton(pageInfo.document, "security-view-cert"); + await loaded; + } + + pageInfo.close(); + checkCertTabs(); + }); + + gBrowser.removeCurrentTab(); +}); + +add_task(async function testPreferencesCert() { + info("Testing preferences cert"); + let url = "about:preferences#privacy"; + + info(`Loading ${url}`); + await BrowserTestUtils.withNewTab( + { gBrowser, url }, + async function (browser) { + checkAndClickButton(browser.contentDocument, "viewCertificatesButton"); + + let certDialogLoaded = promiseLoadSubDialog( + "chrome://pippki/content/certManager.xhtml" + ); + let dialogWin = await certDialogLoaded; + let doc = dialogWin.document; + Assert.ok(doc, "doc loaded"); + + doc.getElementById("certmanagertabs").selectedTab = + doc.getElementById("ca_tab"); + let treeView = doc.getElementById("ca-tree").view; + let selectedCert; + + for (let i = 0; i < treeView.rowCount; i++) { + treeView.selection.select(i); + dialogWin.getSelectedCerts(); + let certs = dialogWin.selected_certs; + if (certs && certs.length == 1 && certs[0]) { + selectedCert = certs[0]; + break; + } + } + Assert.ok(selectedCert, "A cert should be selected"); + let viewButton = doc.getElementById("ca_viewButton"); + Assert.equal(viewButton.disabled, false, "Should enable view button"); + + let loaded = BrowserTestUtils.waitForNewTab(gBrowser, null, true); + for (let i = 0; i < 2; i++) { + viewButton.click(); + await loaded; + } + checkCertTabs(); + } + ); + gBrowser.removeCurrentTab(); // closes about:certificate +}); diff --git a/toolkit/components/certviewer/tests/browser/browser_checkNonUndefinedStrings.js b/toolkit/components/certviewer/tests/browser/browser_checkNonUndefinedStrings.js new file mode 100644 index 0000000000..5e76990592 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_checkNonUndefinedStrings.js @@ -0,0 +1,49 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const url = + "about:certificate?cert=MIIGRjCCBS6gAwIBAgIQDJduPkI49CDWPd%2BG7%2Bu6kDANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgS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LWZscFs3YnFo97nh6Vfe63SKMI2tavegw5BmV%2FSl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C%2FdxC%2F%2FAH2hdmoRBBYMql1GNXRor5H4idq9Joz%2BEkIYIvUX7Q6hL%2BhqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv%2BzbMUZBfHWymeMr%2Fy7vrTC0LUq7dBMtoM1O%2F4gdW7jVg%2FtRvoSSiicNoxBN33shbyTApOB6jtSj1etX%2BjkMOvJwIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH%2FBAUwAwEB%2FzAdBgNVHQ4EFgQUA95QNVbRTLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK%2Bt1EnE9SsPTfrgT1eXkIoyQY%2FEsrhMAtudXH%2FvTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp%2F2PV5Adg06O%2FnVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp%2BdWOIrWcBAI%2B0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU%2BKrk2U886UAb3LujEV0lsYSEY1QSteDwsOoBrp%2BuvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQkCAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4%3D"; + +add_task(async function test() { + await BrowserTestUtils.withNewTab(url, async function (browser) { + await SpecialPowers.spawn(browser, [], async function () { + let certificateSection = await ContentTaskUtils.waitForCondition(() => { + return content.document.querySelector("certificate-section"); + }, "Certificate section found"); + + let tabs = + certificateSection.shadowRoot.querySelector( + ".certificate-tabs" + ).children; + + Assert.ok(tabs, "Tabs were found"); + + for (let i = 0; i < tabs.length; i++) { + let tabButton = certificateSection.shadowRoot.querySelector( + `.certificate-tabs .tab[idnumber="${i}"]` + ); + tabButton.click(); + + let infoGroups = + certificateSection.shadowRoot.querySelectorAll("info-group"); + Assert.ok(infoGroups, "infoGroups found"); + + for (let infoGroup of infoGroups) { + let infoItems = infoGroup.shadowRoot.querySelectorAll("info-item"); + Assert.ok(infoItems, "infoItems found"); + + for (let infoItem of infoItems) { + let info = infoItem.shadowRoot.children[2].textContent; + Assert.equal( + info.includes("undefined"), + false, + "Empty strings shouldn't be rendered" + ); + } + } + } + }); + }); +}); diff --git a/toolkit/components/certviewer/tests/browser/browser_checkOCSP.js b/toolkit/components/certviewer/tests/browser/browser_checkOCSP.js new file mode 100644 index 0000000000..b7d51842eb --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_checkOCSP.js @@ -0,0 +1,46 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +async function checkOCSP(url, shouldBeRendered) { + await BrowserTestUtils.withNewTab(url, async function (browser) { + await SpecialPowers.spawn( + browser, + [shouldBeRendered], + async function (shouldBeRendered) { + let certificateSection = await ContentTaskUtils.waitForCondition(() => { + return content.document.querySelector("certificate-section"); + }, "Certificate section found"); + let OCSPSection = + certificateSection.shadowRoot.querySelector(".ocsp-stapling"); + if (!shouldBeRendered) { + Assert.equal(OCSPSection, null, "OCSPSection found"); + return; + } + Assert.ok(OCSPSection, "OCSPSection found"); + let item = OCSPSection.shadowRoot.querySelector("info-item"); + Assert.ok(item, "item found"); + let info = item.shadowRoot.querySelector(".info").textContent; + Assert.equal(info, "Yes", "OCSP is required"); + } + ); + }); +} + +add_task(async function test() { + let tests = [ + { + url: "about:certificate?cert=MIIE1jCCA76gAwIBAgISA8ud4ZkTgHyRgFEI060JNN%2FFMA0GCSqGSIb3DQEBCwUAMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQDExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xOTEwMjAwODUzMTF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I1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN%2BhXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsBUnuId9Mcj8e6uYi1agnnc%2BgRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9%2FlSEy%2FCG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD%2BtqYF%2FLTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f%2FxXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v%2Fyejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1BE3wMBIGA1UdEwEB%2FwQIMAYBAf8CAQMwDgYDVR0PAQH%2FBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF%2BvaKSm2eT929hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE%2FszKN%2BOMY3EU%2Ft3WgxjkzSswF07r51XgdIGn9w%2FxZchMB5hbgF%2FX%2B%2BZRGjD8ACtPhSNzkE1akxehi%2FoCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h%2B3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5%2BNauQrz4wlHrQMz2nZQ%2F1%2FI6eYs9HRCwBXbsdtTLSR9I4LtD%2Bgdwyah617jzV%2FOeBHRnDJELqYzmp", + shouldBeRendered: false, + }, + ]; + + for (let test of tests) { + await checkOCSP(test.url, test.shouldBeRendered); + } +}); diff --git a/toolkit/components/certviewer/tests/browser/browser_checkStandAlonePage.js b/toolkit/components/certviewer/tests/browser/browser_checkStandAlonePage.js new file mode 100644 index 0000000000..02d8fdc250 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_checkStandAlonePage.js @@ -0,0 +1,86 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const TYPE_CA = 1; +const TYPE_USER = 2; +const TYPE_EMAIL = 4; +const TYPE_SERVER = 8; + +add_task(async function test_dbItemDisplayed() { + await BrowserTestUtils.openNewForegroundTab(gBrowser, () => { + gBrowser.selectedTab = BrowserTestUtils.addTab( + gBrowser, + "about:certificate" + ); + }); + + let categories = [ + { + type: TYPE_CA, + tabName: "Authorities", + id: "ca", + }, + { + type: TYPE_USER, + tabName: "Your Certificates", + id: "mine", + }, + { + type: TYPE_EMAIL, + tabName: "People", + id: "people", + }, + { + type: TYPE_SERVER, + tabName: "Servers", + id: "servers", + }, + ]; + + let certdb = Cc["@mozilla.org/security/x509certdb;1"].getService( + Ci.nsIX509CertDB + ); + Assert.ok(certdb, "certdb not null"); + let certcache = certdb.getCerts(); + Assert.ok(certcache, "certcache not null"); + + for (let cert of certcache) { + let category = categories.find(({ type }) => type & cert.certType); + + await SpecialPowers.spawn( + gBrowser.selectedBrowser, + [cert.displayName, category], + async function (displayName, category) { + let aboutCertificateSection = await ContentTaskUtils.waitForCondition( + () => { + return content.document.querySelector("about-certificate-section"); + }, + "Found aboutCertificateSection." + ); + + let tab = aboutCertificateSection.shadowRoot.querySelector( + `.certificate-tabs #certificate-viewer-tab-${category.id}` + ); + Assert.ok(tab, `${category.tabName} tab should exist.`); + tab.click(); + + let certificateItems = aboutCertificateSection.shadowRoot.querySelector( + `.info-groups #certificate-viewer-tab-${category.id}` + ); + + let listItems = + certificateItems.shadowRoot.querySelectorAll("list-item"); + + let item = Array.from(listItems).find( + i => + i.shadowRoot.querySelector(".item-name").textContent == displayName + ); + Assert.ok(item, `${displayName} should be listed`); + } + ); + } + + gBrowser.removeCurrentTab(); // closes about:certificate +}); diff --git a/toolkit/components/certviewer/tests/browser/browser_checkValiditySection.js b/toolkit/components/certviewer/tests/browser/browser_checkValiditySection.js new file mode 100644 index 0000000000..10e82be94a --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_checkValiditySection.js @@ -0,0 +1,57 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const github_url = + "about:certificate?cert=MIIHQjCCBiqgAwIBAgIQCgYwQn9bvO1pVzllk7ZFHzANBgkqhkiG9w0BAQsFADB1MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTQwMgYDVQQDEytEaWdpQ2VydCBTSEEyIEV4dGVuZGVkIFZhbGlkYXRpb24gU2VydmVyIENBMB4XDTE4MDUwODAwMDAwMFoXDTIwMDYwMzEyMDAwMFowgccxHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5pemF0aW9uMRMwEQYLKwYBBAGCNzwCAQMTAlVTMRkwFwYLKwYBBAGCNzwCAQITCERlbGF3YXJlMRAwDgYDVQQFEwc1MTU3NTUwMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEVMBMGA1UEChMMR2l0SHViLCBJbmMuMRMwEQYDVQQDEwpnaXRodWIuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxjyq8jyXDDrBTyitcnB90865tWBzpHSbindG%2FXqYQkzFMBlXmqkzC%2BFdTRBYyneZw5Pz%2BXWQvL%2B74JW6LsWNc2EF0xCEqLOJuC9zjPAqbr7uroNLghGxYf13YdqbG5oj%2F4x%2BogEG3dF%2FU5YIwVr658DKyESMV6eoYV9mDVf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L2NybC5wa2kuZ29vZy9HVFNHSUFHMy5jcmwwDQYJKoZIhvcNAQELBQADggEBAGrWCimTdP8%2B6qCqNh1Xza9Wlm%2FGDVb%2BKp0PHUZaNDMThFQQqGn2XVi7ZkhqsxTtMw88Nrl97Bi1OsnNPlabhDwxtRyWkNkLdpFxebRz73CsjyoB3cboH%2FZ8sU9LLwXe%2FIJgMkvT7fznKtKSweWV%2BmAYG%2F3KzaIyLrowYpyOsWaYytPJK7ypuk6yOPxuQcQnelotWpuHUBR3mo3FIW56BPCy20KwqwvWoZe27BNxO%2F11Ym%2FPnric2fWXwgmHdkvVqqssUMFs%2BmG2tS%2FpqnR5yZdQL60xOgDq70mVWYgQT4yUTm7i8qvugvNnuSIjjsbelHgbC8f5%2Fx%2Bo2pEyw%2FDYyKw%3D"; + +async function checValiditySection(url) { + await BrowserTestUtils.withNewTab(url, async function (browser) { + await SpecialPowers.spawn(browser, [], async function () { + let certificateSection = await ContentTaskUtils.waitForCondition(() => { + return content.document.querySelector("certificate-section"); + }, "Certificate section found"); + + let validitySection = certificateSection.shadowRoot.querySelector( + "info-group.validity" + ); + Assert.ok(validitySection, "validitySection found"); + + let infoItems = validitySection.shadowRoot.querySelectorAll("info-item"); + Assert.ok(infoItems, "infoItems found"); + Assert.equal( + infoItems.length, + 2, + "There must be render just one date for Not Before and one for Not After" + ); + + for (let infoItem of infoItems) { + let label = infoItem.shadowRoot + .querySelector("label") + .getAttribute("data-l10n-id"); + + Assert.notEqual(label, "", "Label shouldn't be empty"); + + let infoElem = infoItem.shadowRoot.querySelector(".info"); + let title = infoElem.textContent; + Assert.equal( + title.includes("GMT"), + true, + "UTC timezone should be displayed in the label" + ); + } + }); + }); +} + +add_task(async function test() { + let input = [github_url, mozilla_url, youtube_url]; + for (let url of input) { + await checValiditySection(url); + } +}); diff --git a/toolkit/components/certviewer/tests/browser/browser_downloadLink.js b/toolkit/components/certviewer/tests/browser/browser_downloadLink.js new file mode 100644 index 0000000000..5b7b587733 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_downloadLink.js @@ -0,0 +1,126 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const validCert = + "about:certificate?cert=MIIGMDCCBRigAwIBAgIQCa2oS7Nau6nwv1WyRNIJnzANBgkqhkiG9w0BAQsFADBwMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMS8wLQYDVQQDEyZEaWdpQ2VydCBTSEEyIEhpZ2ggQXNzdXJhbmNlIFNlcnZlciBDQTAeFw0xOTA2MDYwMDAwMDBaFw0xOTA5MDQxMjAwMDBaMGExCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTETMBEGA1UEBxMKTWVubG8gUGFyazEXMBUGA1UEChMORmFjZWJvb2ssIEluYy4xFzAVBgNVBAMMDiouZmFjZWJvb2suY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEALPlfjd8gHkIMDeBOFhRt0e%2B%2F3fdm%2BZdzdM4s1WIHVbYztgmdEy20PUwDCviYKJX4GG%2BT9ivT8kJ%2FvWl1P%2FYqOCA54wggOaMB8GA1UdIwQYMBaAFFFo%2F5CvAgd1PMzZZWRiohK4WXI7MB0GA1UdDgQWBBTsQZVRTuib7KY9w3FfOYsZHvOC9zCBxwYDVR0RBIG%2FMIG8gg4qLmZhY2Vib29rLmNvbYINbWVzc2VuZ2VyLmNvbYILKi5mYmNkbi5uZXSCCCouZmIuY29tghAqLm0uZmFjZWJvb2suY29tggZmYi5jb22CDiouZmFjZWJvb2submV0gg4qLnh4LmZiY2RuLm5ldIIOKi54ei5mYmNkbi5uZXSCDyoubWVzc2VuZ2VyLmNvbYILKi5mYnNieC5jb22CDioueHkuZmJjZG4ubmV0ggxmYWNlYm9vay5jb20wDgYDVR0PAQH%2FBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBgg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ForErrorSection() { + await BrowserTestUtils.openNewForegroundTab(gBrowser, () => { + gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, validCert); + }); + + await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () { + let infoGroups; + let downloadLinkContainers = []; + + await ContentTaskUtils.waitForCondition(() => { + infoGroups = content.document + .querySelector("certificate-section") + .shadowRoot.querySelectorAll(".miscellaneous"); + for (let i = 0; i < infoGroups.length; i++) { + downloadLinkContainers.push( + infoGroups[i].shadowRoot + .querySelector(".download") + .shadowRoot.querySelector(".info") + ); + } + return downloadLinkContainers.length; + }, "Found download info items."); + + ok(downloadLinkContainers.length, "Download info items should exist."); + + let certTabs = content.document + .querySelector("certificate-section") + .shadowRoot.querySelectorAll(".certificate-tab"); + + await ContentTaskUtils.waitForCondition( + () => certTabs.length, + "Certificate tabs should exist." + ); + + let url = new URL(content.document.documentURI); + let certs = url.searchParams.getAll("cert"); + let certChain = []; + for (let i = 0; i < certs.length; i++) { + certChain.push( + `-----BEGIN CERTIFICATE-----\r\n${certs[i]}\r\n-----END CERTIFICATE-----\r\n` + ); + } + certChain = certChain.join("").replace(/(\r\n|\n|\r)/gm, ""); + + for (let i = 0; i < certTabs.length; i++) { + let downloadLink = + downloadLinkContainers[i].querySelector(".download-link"); + + let downloadChainLink = downloadLinkContainers[i].querySelector( + ".download-link-chain" + ); + + let cert = certs[i]; + cert = `-----BEGIN CERTIFICATE-----\r\n${cert}\r\n-----END CERTIFICATE-----\r\n`; + cert = cert.replace(/(\r\n|\n|\r)/gm, ""); + + let linkCert = downloadLink.getAttribute("href"); + linkCert = linkCert.replace("data:,", ""); + linkCert = decodeURI(linkCert); + let certLineLength = Math.max( + ...linkCert.split(/\r\n|\n|\r/m).map(x => x.length) + ); + linkCert = linkCert.replace(/(\r\n|\n|\r)/gm, ""); + + let downloadChainCert = downloadChainLink.getAttribute("href"); + downloadChainCert = downloadChainCert.replace("data:,", ""); + downloadChainCert = decodeURI(downloadChainCert); + let chainLineLength = Math.max( + ...downloadChainCert.split(/\r\n|\n|\r/m).map(x => x.length) + ); + downloadChainCert = downloadChainCert.replace(/(\r\n|\n|\r)/gm, ""); + + Assert.lessOrEqual( + certLineLength, + 64, + "PEM cert line length should be capped to 64" + ); + Assert.lessOrEqual( + chainLineLength, + 64, + "PEM chain line length should be capped to 64" + ); + + Assert.equal( + cert, + linkCert, + "Download link href should be equal to URL cert." + ); + + Assert.equal( + certChain, + downloadChainCert, + "Download chain link href should be equal to URL cert." + ); + + await content.document.l10n.translateElements([ + downloadChainLink, + downloadLink, + ]); + + Assert.equal( + downloadLinkContainers[i].textContent, + "PEM (cert)PEM (chain)", + "Download should contain links to PEM cert and PEM chain." + ); + + if (certTabs[i + 1]) { + certTabs[i + 1].click(); + + await ContentTaskUtils.waitForCondition( + () => certTabs[i + 1].classList.contains("selected"), + "Cert tab should be selected" + ); + } + } + }); + gBrowser.removeCurrentTab(); // closes about:certificate +}); diff --git a/toolkit/components/certviewer/tests/browser/browser_handleMultipleCertsURL.js b/toolkit/components/certviewer/tests/browser/browser_handleMultipleCertsURL.js new file mode 100644 index 0000000000..b0199cce83 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_handleMultipleCertsURL.js @@ -0,0 +1,251 @@ +// valids +const multipleCerts1 = + "about:certificate?cert=MIIGRjCCBS6gAwIBAgIQDJduPkI49CDWPd%2BG7%2Bu6kDANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5EaWdpQ2VydCBTSEEyIFNlY3VyZSBTZXJ2ZXIgQ0EwHhcNMTgxMTA1MDAwMDAwWhcNMTkxMTEzMTIwMDAwWjCBgzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxHDAaBgNVBAoTE01vemlsbGEgQ29ycG9yYXRpb24xDzANBgNVBAsTBldlYk9wczEYMBYGA1UEA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AQEEdzB1MCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5kaWdpY2VydC5jb20wTQYIKwYBBQUHMAKGQWh0dHA6Ly9jYWNlcnRzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydFNIQTJIaWdoQXNzdXJhbmNlU2VydmVyQ0EuY3J0MAwGA1UdEwEB%2FwQCMAAwggEFBgorBgEEAdZ5AgQCBIH2BIHzAPEAdgDuS723dc5guuFCaR%2Br4Z5mow9%2BX7By2IMAxHuJeqj9ywAAAWrrCDXmAAAEAwBHMEUCIQCSwzRMoifj1DjYLJuMOH%2BZ6coX83bWIgWgWynLUED87wIgFKdipP9ycAE8S9apXJxKQyp0RoA%2Ftca5%2BWHQE5VlF68AdwCHdb%2FnWXz4jEOZX73zbv9WjUdWNv9KtWDBtOr%2FXqCDDwAAAWrrCDakAAAEAwBIMEYCIQCcmFOfp58BDMFZZS%2FRVl2uiY94RcTozBrcmtkpoWhgkgIhAN%2BX3ODViV4HnN2ZpZ383mFaEHIjKACRdWTRL%2BcYA43lMA0GCSqGSIb3DQEBCwUAA4IBAQB8LQLmUzevGtdw%2FXVL8aFrotloF3zsUPb2Q7CONLzlMGrmfv%2BNKDXN9xqPLLzmX4MddOjfpbVcDX1mJkuvuYNhh5AQrsaxcfEgfMcqPOdELA1mHPfk8H5a8Tvno1nF9wQWqkCQjLedjKReivmDOGfs1%2Fl%2FDnrprc0v4f28cWvN7YkJsdqfEGLbJ6SKsAxNbtNn%2Ffi6LxnemjLbcTrZYps11Ex55PtDNc200ejqpbpzHolgAew4KUzsyElaYSvDwkLMdmfwYSI9wgcPmrPBfZ0N12TAfmJJbE%2FkZc0jIOi92A%2FVgZLKvQrxadnBqPzAR%2F2SrZMT5joWa5sHpwl9fg5Z"; + +// both invalids +const errorCerts1 = "about:certificate?cert=aa&cert=bb&cert=abc"; +// one invalid and other valid +const errorCerts2 = + "about:certificate?cert=aa&cert=MIIGRjCCBS6gAwIBAgIQDJduPkI49CDWPd%2BG7%2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WcUuyH6O7PZdl0YpwTpw1THIuqCGl%2FwpPgyQgcTM%3D"; + +async function checkSubjectName(inputPage, subjectsNameInfo) { + await BrowserTestUtils.withNewTab( + { + gBrowser, + url: inputPage, + }, + async function (browser) { + await SpecialPowers.spawn( + browser, + [subjectsNameInfo], + async function (subjectsNameInfoExpected) { + let certificateSection = await ContentTaskUtils.waitForCondition( + () => { + return content.document.querySelector("certificate-section"); + }, + "Certificate section found" + ); + + async function selectTab(tabName, index) { + let tabs = + certificateSection.shadowRoot.querySelector(".certificate-tabs"); + + let tab = tabs.querySelector(`.tab[idnumber="${index}"]`); + Assert.ok(tab, `Tab at index ${index} found`); + Assert.equal( + tab.innerText, + tabName, + `Tab name should be ${tabName}` + ); + + tab.click(); + } + + function checkSelectedTab(sectionItemsExpected, index) { + let infoGroup = certificateSection.shadowRoot.querySelector( + `#panel${index} info-group` + ); + Assert.ok(infoGroup, "infoGroup found"); + + let sectionTitle = + infoGroup.shadowRoot.querySelector(".info-group-title").innerText; + Assert.equal( + sectionTitle, + "Subject Name", + "Subject Name must be the selected item" + ); + + let infoItems = infoGroup.shadowRoot.querySelectorAll("info-item"); + Assert.equal( + infoItems.length, + sectionItemsExpected.length, + "sectionItems must be the same length" + ); + } + + for (let i = 0; i < subjectsNameInfoExpected.length; i++) { + await selectTab(subjectsNameInfoExpected[i].tabName, i); + checkSelectedTab(subjectsNameInfoExpected[i].sectionItems, i); + } + } + ); + } + ); +} + +async function checkTabsName(inputPage, tabsNames) { + await BrowserTestUtils.withNewTab( + { + gBrowser, + url: inputPage, + }, + async function (browser) { + await SpecialPowers.spawn( + browser, + [tabsNames], + async function (expectedTabsNames) { + let certificateSection = await ContentTaskUtils.waitForCondition( + () => { + return content.document.querySelector("certificate-section"); + }, + "Certificate section found" + ); + + let tabsSection = + certificateSection.shadowRoot.querySelector(".certificate-tabs"); + Assert.ok(tabsSection, "Tabs section found"); + + let tabs = tabsSection.children; + Assert.equal( + tabs.length, + expectedTabsNames.length, + `There must be ${expectedTabsNames.length} tabs` + ); + + for (let i = 0; i < expectedTabsNames.length; i++) { + Assert.equal( + tabs[i].innerText, + expectedTabsNames[i], + "Tab name must be equal to expected tab name" + ); + if (i === 0) { + Assert.ok( + tabs[i].className.includes("selected"), + "First tab must be selected" + ); + } else { + Assert.equal( + tabs[i].className.includes("selected"), + false, + "Just the first tab must be selected" + ); + } + } + } + ); + } + ); +} + +async function checkDOM(inputPage, errorExpected) { + await BrowserTestUtils.withNewTab( + { + gBrowser, + url: inputPage, + }, + async function (browser) { + await SpecialPowers.spawn( + browser, + [errorExpected], + async function (errorExpected) { + let certificateSection = await ContentTaskUtils.waitForCondition( + () => { + return content.document.querySelector("certificate-section"); + }, + "Certificate section found" + ); + + let errorSection = + certificateSection.shadowRoot.querySelector("error-section"); + + if (errorExpected) { + // should render error page + Assert.ok(errorSection, "Error section found"); + } else { + // should render page with certificate info + Assert.equal(errorSection, null, "Error section was not found"); + } + } + ); + } + ); +} + +add_task(async function runTests() { + let inputs = [ + { + url: multipleCerts1, + tabsNames: ["www.mozilla.org", "github.com"], + errorPageExpected: false, + subjectNameInfo: [ + { + tabName: "www.mozilla.org", + sectionTitle: "Subject Name", + sectionItems: [ + { label: "Country", info: "US" }, + { label: "State / Province", info: "California" }, + { label: "Locality", info: "Mountain View" }, + { label: "Organization", info: "Mozilla Corporation" }, + { label: "Organizational Unit", info: "WebOps" }, + { label: "Common Name", info: "www.mozilla.org" }, + ], + }, + { + tabName: "github.com", + sectionTitle: "Subject Name", + sectionItems: [ + { label: "Business Category", info: "Private Organization" }, + { label: "Inc. Country", info: "US" }, + { label: "Inc. State / Province", info: "Delaware" }, + { label: "Serial Number", info: "5157550" }, + { label: "Country", info: "US" }, + { label: "State / Province", info: "California" }, + { label: "Locality", info: "San Francisco" }, + { label: "Organization", info: "GitHub, Inc." }, + { label: "Common Name", info: "github.com" }, + ], + }, + ], + }, + { + url: multipleCerts2, + tabsNames: ["*.google.com", "*.twitter.com"], + errorPageExpected: false, + subjectNameInfo: [ + { + tabName: "*.google.com", + sectionTitle: "Subject Name", + sectionItems: [ + { label: "Country", info: "US" }, + { label: "State / Province", info: "California" }, + { label: "Locality", info: "Mountain View" }, + { label: "Organization", info: "Google LLC" }, + { label: "Common Name", info: "*.google.com" }, + ], + }, + { + tabName: "*.twitter.com", + sectionTitle: "Subject Name", + sectionItems: [ + { label: "Country", info: "US" }, + { label: "State / Province", info: "California" }, + { label: "Locality", info: "San Francisco" }, + { label: "Organization", info: "Twitter, Inc." }, + { label: "Organizational Unit", info: "atla" }, + { label: "Common Name", info: "*.twitter.com" }, + ], + }, + ], + }, + { + url: errorCerts1, + tabsNames: [], + errorPageExpected: true, + }, + { + url: errorCerts2, + tabsNames: [], + errorPageExpected: true, + }, + ]; + + for (let input of inputs) { + await checkDOM(input.url, input.errorPageExpected); + if (!input.errorPageExpected) { + await checkTabsName(input.url, input.tabsNames); + await checkSubjectName(input.url, input.subjectNameInfo); + } + } +}); diff --git a/toolkit/components/certviewer/tests/browser/browser_openTabAndSendCertInfo.js b/toolkit/components/certviewer/tests/browser/browser_openTabAndSendCertInfo.js new file mode 100644 index 0000000000..abc62d4ee3 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_openTabAndSendCertInfo.js @@ -0,0 +1,271 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const TEST_CERT_BASE64 = + "MIIGRjCCBS6gAwIBAgIQDJduPkI49CDWPd+G7+u6kDANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5EaWdpQ2VydCBTSEEyIFNlY3VyZSBTZXJ2ZXIgQ0EwHhcNMTgxMTA1MDAwMDAwWhcNMTkxMTEzMTIwMDAwWjCBgzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxHDAaBg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EaWdpQ2VydFNIQTJTZWN1cmVTZXJ2ZXJDQS5jcnQwDAYDVR0TAQH/BAIwADCCAQIGCisGAQQB1nkCBAIEgfMEgfAA7gB1AKS5CZC0GFgUh7sTosxncAo8NZgE+RvfuON3zQ7IDdwQAAABZuYWiHwAAAQDAEYwRAIgZnMSH1JdG6NASHWTwD0mlP/zbr0hzP263c02Ym0DU64CIEe4QHJDP47j0b6oTFu6RrZz1NQ9cq8Az1KnMKRuaFAlAHUAh3W/51l8+IxDmV+9827/Vo1HVjb/SrVgwbTq/16ggw8AAAFm5haJAgAABAMARjBEAiAxGLXkUaOAkZhXNeNR3pWyahZeKmSaMXadgu18SfK1ZAIgKtwu5eGxK76rgaszLCZ9edBIjuU0DKorzPUuxUXFY0QwDQYJKoZIhvcNAQELBQADggEBAKLJAFO3wuaP5MM/ed1lhk5Uc2aDokhcM7XyvdhEKSHbgPhcgMoT9YIVoPa70gNC6KHcwoXu0g8wt7X6Vm1ql/68G5q844kFuC6JPl4LVT9mciD+VW6bHUSXD9xifL9DqdJ0Ic0SllTlM+oq5aAeOxUQGXhXIqj6fSQv9fQN6mXxQIoc/gjxteskq/Vl8YmY1FIZP9Bh7g27kxZ9GAAGQtjTL03RzKAuSg6yeImYVdQWasc7UPnBXlRAzZ8+OJThUbzK16a2CI3Rg4agKSJk+uA47h1/ImmngpFLRb/MvRX6H1oWcUuyH6O7PZdl0YpwTpw1THIuqCGl/wpPgyQgcTM="; + +function checkSpec(spec) { + Assert.ok( + spec.startsWith("about:certificate"), + "about:certificate was opened" + ); + + let newUrl = new URL(spec); + let certEncoded = newUrl.searchParams.get("cert"); + let certDecoded = decodeURIComponent(certEncoded); + Assert.equal( + btoa(atob(certDecoded)), + certDecoded, + "We received an base64 string" + ); +} + +function checksCertTab(tabsCount) { + Assert.equal(gBrowser.tabs.length, tabsCount + 1, "New tab was opened"); + let spec = gBrowser.tabs[tabsCount].linkedBrowser.documentURI.spec; + checkSpec(spec); +} + +async function checkCertChain(browser) { + await SpecialPowers.spawn(browser, [], async function () { + let certificateTabs; + await ContentTaskUtils.waitForCondition(() => { + let certificateSection = content.document.querySelector( + "certificate-section" + ); + if (!certificateSection) { + return false; + } + certificateTabs = + certificateSection.shadowRoot.querySelectorAll(".certificate-tab"); + return certificateTabs.length; + }, "Found certificate tabs."); + + Assert.greaterOrEqual( + certificateTabs.length, + 1, + "Certificate chain tabs shown" + ); + }); +} + +// taken from https://searchfox.org/mozilla-central/rev/7ed8e2d3d1d7a1464ba42763a33fd2e60efcaedc/security/manager/ssl/tests/mochitest/browser/browser_downloadCert_ui.js#47 +function openCertDownloadDialog(cert) { + let returnVals = Cc["@mozilla.org/hash-property-bag;1"].createInstance( + Ci.nsIWritablePropertyBag2 + ); + let win = window.openDialog( + "chrome://pippki/content/downloadcert.xhtml", + "", + "", + cert, + returnVals + ); + return new Promise((resolve, reject) => { + win.addEventListener( + "load", + function () { + executeSoon(() => resolve([win])); + }, + { once: true } + ); + }); +} + +add_task(async function openFromPopUp() { + info("Testing openFromPopUp"); + + const certdb = Cc["@mozilla.org/security/x509certdb;1"].getService( + Ci.nsIX509CertDB + ); + let cert = certdb.constructX509FromBase64(TEST_CERT_BASE64); + + let [win] = await openCertDownloadDialog(cert); + let viewCertButton = win.document.getElementById("viewC-button"); + let newWinOpened = BrowserTestUtils.waitForNewWindow(); + viewCertButton.click(); + + let topWin = await newWinOpened; + let browser = topWin.gBrowser.selectedBrowser; + + // We're racing against messages sent up from the content process that + // loads about:certificate. It may or may not have had the opportunity + // to tell the parent that it had loaded the page yet. If not, we wait + // for the page to load. + // + // Note that we can't use the URL parameter for + // BrowserTestUtils.waitForNewWindow, since we need to use a function + // to choose the right URL. + if (!browser.currentURI.spec.startsWith("about:certificate")) { + await BrowserTestUtils.browserLoaded(browser, false, spec => + spec.startsWith("about:certificate") + ); + } + + let spec = browser.currentURI.spec; + checkSpec(spec); + + await checkCertChain(browser); + + await BrowserTestUtils.closeWindow(topWin); // closes about:certificate + win.document.getElementById("download_cert").cancelDialog(); + await BrowserTestUtils.windowClosed(win); +}); + +add_task(async function testBadCert() { + info("Testing bad cert"); + + let tab = await openErrorPage(); + + let tabsCount = gBrowser.tabs.length; + let loaded = BrowserTestUtils.waitForNewTab(gBrowser, null, true); + + await SpecialPowers.spawn(tab.linkedBrowser, [], async function () { + let advancedButton = content.document.getElementById("advancedButton"); + Assert.ok(advancedButton, "advancedButton found"); + Assert.equal( + advancedButton.hasAttribute("disabled"), + false, + "advancedButton should be clickable" + ); + advancedButton.click(); + let viewCertificate = content.document.getElementById("viewCertificate"); + Assert.ok(viewCertificate, "viewCertificate found"); + Assert.equal( + viewCertificate.hasAttribute("disabled"), + false, + "viewCertificate should be clickable" + ); + + viewCertificate.click(); + }); + await loaded; + checksCertTab(tabsCount); + await checkCertChain(gBrowser.selectedBrowser); + + gBrowser.removeCurrentTab(); // closes about:certificate + gBrowser.removeCurrentTab(); // closes https://expired.example.com/ +}); + +add_task(async function testBadCertIframe() { + info("Testing bad cert in an iframe"); + + let tab = await openErrorPage(true); + + let tabsCount = gBrowser.tabs.length; + let loaded = BrowserTestUtils.waitForNewTab(gBrowser, null, true); + + await SpecialPowers.spawn(tab.linkedBrowser, [], async function () { + let doc = content.document.querySelector("iframe").contentDocument; + let advancedButton = doc.getElementById("advancedButton"); + Assert.ok(advancedButton, "advancedButton found"); + Assert.equal( + advancedButton.hasAttribute("disabled"), + false, + "advancedButton should be clickable" + ); + advancedButton.click(); + let viewCertificate = doc.getElementById("viewCertificate"); + Assert.ok(viewCertificate, "viewCertificate found"); + Assert.equal( + viewCertificate.hasAttribute("disabled"), + false, + "viewCertificate should be clickable" + ); + + viewCertificate.click(); + }); + await loaded; + checksCertTab(tabsCount); + await checkCertChain(gBrowser.selectedBrowser); + + gBrowser.removeCurrentTab(); // closes about:certificate + gBrowser.removeCurrentTab(); // closes https://expired.example.com/ +}); + +add_task(async function testGoodCert() { + info("Testing page info"); + let url = "https://example.com/"; + + let tabsCount = gBrowser.tabs.length; + + info(`Loading ${url}`); + await BrowserTestUtils.withNewTab({ gBrowser, url }, async function () { + info("Opening pageinfo"); + let pageInfo = BrowserPageInfo(url, "securityTab", {}); + await BrowserTestUtils.waitForEvent(pageInfo, "load"); + + let securityTab = pageInfo.document.getElementById("securityTab"); + await TestUtils.waitForCondition( + () => BrowserTestUtils.is_visible(securityTab), + "Security tab should be visible." + ); + Assert.ok(securityTab, "Security tab is available"); + let viewCertButton = pageInfo.document.getElementById("security-view-cert"); + await TestUtils.waitForCondition( + () => BrowserTestUtils.is_visible(viewCertButton), + "view cert button should be visible." + ); + + let loaded = BrowserTestUtils.waitForNewTab(gBrowser, null, true); + checkAndClickButton(pageInfo.document, "security-view-cert"); + await loaded; + + await checkCertChain(gBrowser.selectedBrowser); + pageInfo.close(); + }); + checksCertTab(tabsCount); + + gBrowser.removeCurrentTab(); // closes about:certificate +}); + +add_task(async function testPreferencesCert() { + info("Testing preferences cert"); + let url = "about:preferences#privacy"; + + let tabsCount; + + info(`Loading ${url}`); + await BrowserTestUtils.withNewTab( + { gBrowser, url }, + async function (browser) { + tabsCount = gBrowser.tabs.length; + checkAndClickButton(browser.contentDocument, "viewCertificatesButton"); + + let certDialogLoaded = promiseLoadSubDialog( + "chrome://pippki/content/certManager.xhtml" + ); + let dialogWin = await certDialogLoaded; + let doc = dialogWin.document; + Assert.ok(doc, "doc loaded"); + + doc.getElementById("certmanagertabs").selectedTab = + doc.getElementById("mine_tab"); + let treeView = doc.getElementById("user-tree").view; + let selectedCert; + // See https://searchfox.org/mozilla-central/rev/40ef22080910c2e2c27d9e2120642376b1d8b8b2/browser/components/preferences/in-content/tests/browser_cert_export.js#41 + for (let i = 0; i < treeView.rowCount; i++) { + treeView.selection.select(i); + dialogWin.getSelectedCerts(); + let certs = dialogWin.selected_certs; + if (certs && certs[0]) { + selectedCert = certs[0]; + break; + } + } + Assert.ok(selectedCert, "A cert should be selected"); + let viewButton = doc.getElementById("mine_viewButton"); + Assert.equal(viewButton.disabled, false, "Should enable view button"); + + let loaded = BrowserTestUtils.waitForNewTab(gBrowser, null, true); + viewButton.click(); + await loaded; + + checksCertTab(tabsCount); + await checkCertChain(gBrowser.selectedBrowser); + } + ); + gBrowser.removeCurrentTab(); // closes about:certificate +}); diff --git a/toolkit/components/certviewer/tests/browser/browser_renderCertToUI.js b/toolkit/components/certviewer/tests/browser/browser_renderCertToUI.js new file mode 100644 index 0000000000..0ecb93f176 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/browser_renderCertToUI.js @@ -0,0 +1,192 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const url = + "about:certificate?cert=MIIHQjCCBiqgAwIBAgIQCgYwQn9bvO1pVzllk7ZFHzANBgkqhkiG9w0BAQsFADB1MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTQwMgYDVQQDEytEaWdpQ2VydCBTSEEyIEV4dGVuZGVkIFZhbGlkYXRpb24gU2VydmVyIENBMB4XDTE4MDUwODAwMDAwMFoXDTIwMDYwMzEyMDAwMFowgccxHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5pemF0aW9uMRMwEQYLKwYBBAGCNzwCAQMTAlVTMRkwFwYLKwYBBAGCNzwCAQITCERlbGF3YXJlMRAwDgYDVQQFEwc1MTU3NTUwMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEVMBMGA1UEChMMR2l0SHViLCBJbmMuMRMwEQYDVQQDEwpnaXRodWIuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxjyq8jyXDDrBTyitcnB90865tWBzpHSbindG%2FXqYQkzFMBlXmqkzC%2BFdTRBYyneZw5Pz%2BXWQvL%2B74JW6LsWNc2EF0xCEqLOJuC9zjPAqbr7uroNLghGxYf13YdqbG5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m4BEC2%2BdIcvSykZYgIgCP5gGv6yzaazxBK2NwGdmmyuEFNSg2pARbMJlUFgU5UAdgBWFAaaL9fC7NP14b1Esj7HRna5vJkRXMDvlJhV1onQ3QAAAWNBYm0tAAAEAwBHMEUCIQCi7omUvYLm0b2LobtEeRAYnlIo7n6JxbYdrtYdmPUWJQIgVgw1AZ51vK9ENinBg22FPxb82TvNDO05T17hxXRC2IYAdgC72d%2B8H4pxtZOUI5eqkntHOFeVCqtS6BqQlmQ2jh7RhQAAAWNBYm3fAAAEAwBHMEUCIQChzdTKUU2N%2BXcqcK0OJYrN8EYynloVxho4yPk6Dq3EPgIgdNH5u8rC3UcslQV4B9o0a0w204omDREGKTVuEpxGeOQwDQYJKoZIhvcNAQELBQADggEBAHAPWpanWOW%2Fip2oJ5grAH8mqQfaunuCVE%2Bvac%2B88lkDK%2FLVdFgl2B6kIHZiYClzKtfczG93hWvKbST4NRNHP9LiaQqdNC17e5vNHnXVUGw%2ByxyjMLGqkgepOnZ2Rb14kcTOGp4i5AuJuuaMwXmCo7jUwPwfLe1NUlVBKqg6LK0Hcq4K0sZnxE8HFxiZ92WpV2AVWjRMEc%2F2z2shNoDvxvFUYyY1Oe67xINkmyQKc%2BygSBZzyLnXSFVWmHr3u5dcaaQGGAR42v6Ydr4iL38Hd4dOiBma%2BFXsXBIqWUjbST4VXmdaol7uzFMojA4zkxQDZAvF5XgJlAFadfySna%2Fteik%3D"; + +Services.scriptloader.loadSubScript( + "chrome://mochitests/content/browser/toolkit/components/certviewer/tests/browser/adjustedCerts.js", + this +); + +add_task(async function test() { + Assert.ok(adjustedCerts, "adjustedCerts found"); + + let tabName = adjustedCerts[0].tabName; + let certItems = adjustedCerts[0].certItems; + + await BrowserTestUtils.withNewTab(url, async function (browser) { + await SpecialPowers.spawn( + browser, + [[certItems, tabName]], + async function ([adjustedCerts, expectedTabName]) { + let certificateSection = await ContentTaskUtils.waitForCondition(() => { + return content.document.querySelector("certificate-section"); + }, "Certificate section found"); + + let infoGroups = + certificateSection.shadowRoot.querySelectorAll("info-group"); + Assert.ok(infoGroups, "infoGroups found"); + Assert.equal( + infoGroups.length, + adjustedCerts.length, + "infoGroups must have the same length of adjustedCerts" + ); + + let tabName = + certificateSection.shadowRoot.querySelector( + ".tab[idnumber='0']" + ).textContent; + Assert.equal(tabName, expectedTabName, "Tab name should be the same"); + + function getElementByAttribute(source, property, target) { + for (let elem of source) { + if (elem.hasOwnProperty(property) && elem[property] === target) { + return elem; + } + } + return null; + } + + function checkBooleans(got, expected) { + info( + "If adjustedCertElments returned true, this value should be Yes, otherwise it should be No" + ); + let gotBool; + if (got === "Yes") { + gotBool = true; + } else if (got === "No") { + gotBool = false; + } else { + gotBool = null; + } + Assert.equal( + gotBool, + expected, + `Expected ${expected}, got ${gotBool}` + ); + } + + for (let infoGroup of infoGroups) { + let sectionId = infoGroup.shadowRoot + .querySelector(".info-group-title") + .getAttribute("data-l10n-id") + .replace("certificate-viewer-", ""); + + let adjustedCertsElem = getElementByAttribute( + adjustedCerts, + "sectionId", + sectionId + ); + Assert.ok(adjustedCertsElem, "The element exists in adjustedCerts"); + + let infoItems = infoGroup.shadowRoot.querySelectorAll("info-item"); + Assert.equal( + infoItems.length, + adjustedCertsElem.sectionItems.length, + "sectionItems must be the same length" + ); + + let i = 0; + // Message ID mappings + let stringMapping = { + signaturealgorithm: "signature-algorithm", + }; + for (let infoItem of infoItems) { + let infoItemLabel = infoItem.shadowRoot + .querySelector("label") + .getAttribute("data-l10n-id"); + let infoElem = infoItem.shadowRoot.querySelector(".info"); + let infoItemInfo = infoElem.textContent; + let adjustedCertsElemLabel = + adjustedCertsElem.sectionItems[i].labelId; + let adjustedCertsElemInfo = adjustedCertsElem.sectionItems[i].info; + + if (adjustedCertsElemLabel == null) { + adjustedCertsElemLabel = ""; + } + adjustedCertsElemLabel = adjustedCertsElemLabel + .replace(/\s+/g, "-") + .replace(/\./g, "") + .replace(/\//g, "") + .replace(/--/g, "-") + .toLowerCase(); + adjustedCertsElemLabel = + stringMapping[adjustedCertsElemLabel] || adjustedCertsElemLabel; + + if (adjustedCertsElemInfo == null) { + adjustedCertsElemInfo = ""; + } + if (typeof adjustedCertsElemInfo === "boolean") { + checkBooleans(infoItemInfo, adjustedCertsElemInfo); + continue; + } + + if ( + adjustedCertsElemLabel === "timestamp" || + adjustedCertsElemLabel === "not-after" || + adjustedCertsElemLabel === "not-before" + ) { + Assert.equal( + infoElem.textContent, + adjustedCertsElemInfo.utc, + "Timestamps must be equal" + ); + i++; + continue; + } + if (adjustedCertsElemLabel === "download") { + Assert.equal(infoElem.children.length, 2, "Should have 2 links."); + for (let kid of infoElem.children) { + Assert.equal( + kid.localName, + "a", + "Should get a cert/chain link." + ); + Assert.ok( + kid.download.endsWith("pem"), + "Link `download` attribute should point to pem file." + ); + Assert.ok( + kid.dataset.l10nId.includes("pem"), + "Link should be labeled" + ); + Assert.equal( + kid.dataset.l10nId.includes("chain"), + kid.download.includes("chain"), + "Download label and filename should match" + ); + } + // Remaining tests in browser_downloadLink.js + + i++; + continue; + } + + if (Array.isArray(adjustedCertsElemInfo)) { + // there is a case where we have a boolean + adjustedCertsElemInfo = adjustedCertsElemInfo + .toString() + .replace(/,/g, ", "); + } + + Assert.ok( + infoItemLabel.includes(adjustedCertsElemLabel), + "data-l10n-id must contain the original label" + ); + + Assert.equal( + infoItemInfo, + adjustedCertsElemInfo, + "Info must be equal" + ); + + i++; + } + } + } + ); + }); +}); diff --git a/toolkit/components/certviewer/tests/browser/dummy_page.html b/toolkit/components/certviewer/tests/browser/dummy_page.html new file mode 100644 index 0000000000..1a87e28408 --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/dummy_page.html @@ -0,0 +1,9 @@ +<html> +<head> +<title>Dummy test page</title> +<meta http-equiv="Content-Type" content="text/html;charset=utf-8"></meta> +</head> +<body> +<p>Dummy test page</p> +</body> +</html> diff --git a/toolkit/components/certviewer/tests/browser/head.js b/toolkit/components/certviewer/tests/browser/head.js new file mode 100644 index 0000000000..d02c99797b --- /dev/null +++ b/toolkit/components/certviewer/tests/browser/head.js @@ -0,0 +1,124 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +function checkAndClickButton(document, id) { + let button = document.getElementById(id); + Assert.ok(button, `${id} button found`); + Assert.equal( + button.hasAttribute("disabled"), + false, + "button should be clickable" + ); + button.click(); +} + +function is_element_visible(aElement, aMsg) { + isnot(aElement, null, "Element should not be null, when checking visibility"); + Assert.ok(!BrowserTestUtils.is_hidden(aElement), aMsg); +} + +// Extracted from https://searchfox.org/mozilla-central/rev/40ef22080910c2e2c27d9e2120642376b1d8b8b2/browser/components/preferences/in-content/tests/head.js#41 +function promiseLoadSubDialog(aURL) { + return new Promise((resolve, reject) => { + content.gSubDialog._dialogStack.addEventListener( + "dialogopen", + function dialogopen(aEvent) { + if ( + aEvent.detail.dialog._frame.contentWindow.location == "about:blank" + ) { + return; + } + content.gSubDialog._dialogStack.removeEventListener( + "dialogopen", + dialogopen + ); + + Assert.equal( + aEvent.detail.dialog._frame.contentWindow.location.toString(), + aURL, + "Check the proper URL is loaded" + ); + + // Check visibility + is_element_visible(aEvent.detail.dialog._overlay, "Overlay is visible"); + + // Check that stylesheets were injected + let expectedStyleSheetURLs = + aEvent.detail.dialog._injectedStyleSheets.slice(0); + for (let styleSheet of aEvent.detail.dialog._frame.contentDocument + .styleSheets) { + let i = expectedStyleSheetURLs.indexOf(styleSheet.href); + if (i >= 0) { + info("found " + styleSheet.href); + expectedStyleSheetURLs.splice(i, 1); + } + } + Assert.equal( + expectedStyleSheetURLs.length, + 0, + "All expectedStyleSheetURLs should have been found" + ); + + // Wait for the next event tick to make sure the remaining part of the + // testcase runs after the dialog gets ready for input. + executeSoon(() => resolve(aEvent.detail.dialog._frame.contentWindow)); + } + ); + }); +} + +function injectErrorPageFrame(tab, src) { + return SpecialPowers.spawn( + tab.linkedBrowser, + [{ frameSrc: src }], + async function ({ frameSrc }) { + let loaded = ContentTaskUtils.waitForEvent( + content.wrappedJSObject, + "DOMFrameContentLoaded" + ); + let iframe = content.document.createElement("iframe"); + iframe.src = frameSrc; + content.document.body.appendChild(iframe); + await loaded; + // We will have race conditions when accessing the frame content after setting a src, + // so we can't wait for AboutNetErrorLoad. Let's wait for the certerror class to + // appear instead (which should happen at the same time as AboutNetErrorLoad). + await ContentTaskUtils.waitForCondition(() => + iframe.contentDocument.body.classList.contains("certerror") + ); + } + ); +} + +async function openErrorPage(useFrame = false) { + let src = "https://expired.example.com/"; + let dummyPage = + getRootDirectory(gTestPath).replace( + "chrome://mochitests/content", + "https://example.com" + ) + "dummy_page.html"; + + let tab; + if (useFrame) { + info("Loading cert error page in an iframe"); + tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, dummyPage); + await injectErrorPageFrame(tab, src); + } else { + let certErrorLoaded; + tab = await BrowserTestUtils.openNewForegroundTab( + gBrowser, + () => { + gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, src); + let browser = gBrowser.selectedBrowser; + certErrorLoaded = BrowserTestUtils.waitForErrorPage(browser); + }, + false + ); + info("Loading and waiting for the cert error"); + await certErrorLoaded; + } + + return tab; +} diff --git a/toolkit/components/certviewer/tests/chrome/CSoutput.mjs b/toolkit/components/certviewer/tests/chrome/CSoutput.mjs new file mode 100644 index 0000000000..d90026353e --- /dev/null +++ b/toolkit/components/certviewer/tests/chrome/CSoutput.mjs @@ -0,0 +1,144 @@ +export const certOutputCS = [ + { + ext: { + aia: { + descriptions: [ + { + location: "http://ocsp.digicert.com", + method: "Online Certificate Status Protocol (OCSP)", + }, + { + location: + "http://cacerts.digicert.com/DigiCertSHA2SecureServerCA.crt", + method: "CA Issuers", + }, + ], + critical: false, + }, + aKID: { + critical: false, + id: "0F:80:61:1C:82:31:61:D5:2F:28:E7:8D:46:38:B4:2C:E1:C6:D9:E2", + }, + basicConstraints: { cA: false, critical: true }, + crlPoints: { + critical: false, + points: [ + "http://crl3.digicert.com/ssca-sha2-g6.crl", + "http://crl4.digicert.com/ssca-sha2-g6.crl", + ], + }, + cp: { + critical: false, + policies: [ + { + id: "2.16.840", + name: "ANSI Organizational Identifier", + qualifiers: [ + { + qualifierId: "1.3.6.1.5.5.7.2.1", + qualifierName: "Practices Statement", + qualifierValue: "https://www.digicert.com/CPS", + }, + ], + value: "2.16.840.1.114412.1.1", + }, + { + id: "2.23.140.1.2.2", + name: "Certificate Type", + value: "Organization Validation", + }, + ], + }, + eKeyUsages: { + critical: false, + purposes: ["Server Authentication", "Client Authentication"], + }, + keyUsages: { + critical: true, + purposes: ["Digital Signature", "Key Encipherment"], + }, + msCrypto: { exists: false }, + ocspStaple: { critical: false, required: false }, + scts: { + critical: false, + timestamps: [ + { + logId: + "A4:B9:09:90:B4:18:58:14:87:BB:13:A2:CC:67:70:0A:3C:35:98:04:F9:1B:DF:B8:E3:77:CD:0E:C8:0D:DC:10", + name: "Google “Pilot”", + signatureAlgorithm: "SHA-256 ECDSA", + timestamp: "11/5/2018, 8:55:28 PM (Brasilia Standard Time)", + timestampUTC: "Mon, 05 Nov 2018 22:55:28 GMT", + version: 1, + }, + { + logId: + "87:75:BF:E7:59:7C:F8:8C:43:99:5F:BD:F3:6E:FF:56:8D:47:56:36:FF:4A:B5:60:C1:B4:EA:FF:5E:A0:83:0F", + name: "DigiCert Server 2", + signatureAlgorithm: "SHA-256 ECDSA", + timestamp: "11/5/2018, 8:55:28 PM (Brasilia Standard Time)", + timestampUTC: "Mon, 05 Nov 2018 22:55:28 GMT", + version: 1, + }, + ], + }, + sKID: { + critical: false, + id: "DA:52:BD:21:9C:37:65:53:FC:1F:53:75:0F:1E:5F:07:9B:A3:AD:3F", + }, + san: { + altNames: [ + ["DNS Name", "www.mozilla.org"], + ["DNS Name", "mozilla.org"], + ], + critical: false, + }, + }, + files: { + pem: "-----BEGIN%20CERTIFICATE-----%0D%0AMIIGRjCCBS6gAwIBAgIQDJduPkI49CDWPd+G7+u6kDANBgkqhkiG9w0BAQsFADBN%0D%0AM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h7g27kxZ9GAAGQtjTL03RzKAuSg6yeImYVdQWasc7UPnB%0D%0AXlRAzZ8+OJThUbzK16a2CI3Rg4agKSJk+uA47h1/ImmngpFLRb/MvRX6H1oWcUuy%0D%0AH6O7PZdl0YpwTpw1THIuqCGl/wpPgyQgcTM=%0D%0A-----END%20CERTIFICATE-----%0D%0A", + }, + fingerprint: { + sha1: "0E:95:79:81:17:5C:51:D2:76:05:AC:8E:C4:61:71:61:97:29:ED:61", + sha256: + "30:23:CB:EC:1B:A8:C2:D9:E7:45:05:D5:4A:E2:0F:73:E1:51:C4:2D:46:59:CE:B4:EE:E6:51:7B:9E:CB:84:7B", + }, + issuer: { + cn: "DigiCert SHA2 Secure Server CA", + dn: "c=US, o=DigiCert Inc, cn=DigiCert SHA2 Secure Server CA", + entries: [ + ["Country", "US"], + ["Organization", "DigiCert Inc"], + ["Common Name", "DigiCert SHA2 Secure Server CA"], + ], + }, + notBefore: "11/4/2018, 10:00:00 PM (Brasilia Standard Time)", + notBeforeUTC: "Mon, 05 Nov 2018 00:00:00 GMT", + notAfter: "11/13/2019, 10:00:00 AM (Brasilia Standard Time)", + notAfterUTC: "Wed, 13 Nov 2019 12:00:00 GMT", + subject: { + cn: "www.mozilla.org", + dn: "c=US, s=California, l=Mountain View, o=Mozilla Corporation, ou=WebOps, cn=www.mozilla.org", + entries: [ + ["Country", "US"], + ["State / Province", "California"], + ["Locality", "Mountain View"], + ["Organization", "Mozilla Corporation"], + ["Organizational Unit", "WebOps"], + ["Common Name", "www.mozilla.org"], + ], + }, + serialNumber: "0C:97:6E:3E:42:38:F4:20:D6:3D:DF:86:EF:EB:BA:90", + signature: { + name: "SHA-256 with RSA Encryption", + type: "1.2.840.113549.1.1.11", + }, + subjectPublicKeyInfo: { + e: 65537, + kty: "RSA", + n: "B8:AA:EE:CA:69:24:9A:4A:82:26:1E:D0:8E:65:E5:50:E0:5C:2C:54:72:C3:92:C6:FE:F5:14:59:5A:EC:C4:2D:A0:B1:B4:7C:58:9A:BE:71:8A:18:06:9A:0D:55:2B:4A:AC:EE:14:DA:B0:61:D4:61:1B:71:CB:D3:EA:A2:8E:40:8F:A9:8E:30:F1:C7:D7:26:45:DB:9B:19:31:A9:F0:BD:0C:17:5A:21:56:F8:48:BD:82:EE:98:E1:28:44:30:CF:53:83:EF:18:98:C6:85:E9:3F:A2:3B:DE:74:F5:9E:F1:D8:5C:88:79:31:38:2D:AA:3C:56:6F:54:53:30:83:5F:E8:FD:BF:34:D7:8E:C1:C1:94:26:CC:1D:7C:9A:71:EC:99:CC:8A:96:9B:02:37:CA:71:C3:CE:AE:6A:8F:48:BA:7F:20:65:0A:EC:96:55:BA:E2:B4:D9:95:14:79:EA:91:DD:01:CB:86:02:86:63:61:9C:70:4B:D6:7E:96:FA:D2:8C:48:2B:75:D7:A6:5B:21:86:6A:5A:B2:16:9D:6B:5E:55:4C:D5:37:F8:FC:86:16:01:05:D3:81:35:0D:DF:4D:EE:DF:13:23:B2:CE:D0:2B:B7:94:0E:C0:02:47:18:96:3C:B5:BD:5D:00:DD:D5:CF:B2:BD:A6:09:2B:38:09:DB", + keysize: 2048, + }, + unsupportedExtensions: [], + version: "3", + }, +]; diff --git a/toolkit/components/certviewer/tests/chrome/chrome.ini b/toolkit/components/certviewer/tests/chrome/chrome.ini new file mode 100644 index 0000000000..6f07743875 --- /dev/null +++ b/toolkit/components/certviewer/tests/chrome/chrome.ini @@ -0,0 +1,12 @@ +[DEFAULT] +scheme=https +[test_adjustCertInformation.html] +support-files = + parseOutput.mjs +[test_certDecoder.html] +[test_certDecoderFields.html] +support-files = + CSoutput.mjs +[test_kebabCaseInAdjustCertInformation.html] +support-files = + parseOutput.mjs diff --git a/toolkit/components/certviewer/tests/chrome/parseOutput.mjs b/toolkit/components/certviewer/tests/chrome/parseOutput.mjs new file mode 100644 index 0000000000..947801145e --- /dev/null +++ b/toolkit/components/certviewer/tests/chrome/parseOutput.mjs @@ -0,0 +1,330 @@ +export const parseOutput = [ + { + ext: { + aia: { + descriptions: [ + { + location: "http://ocsp.digicert.com", + method: "Online Certificate Status Protocol (OCSP)", + }, + { + location: + "http://cacerts.digicert.com/DigiCertSHA2ExtendedValidationServerCA.crt", + method: "CA Issuers", + }, + ], + critical: false, + }, + aKID: { + critical: false, + id: "3D:D3:50:A5:D6:A0:AD:EE:F3:4A:60:0A:65:D3:21:D4:F8:F8:D6:0F", + }, + basicConstraints: { cA: false, critical: true }, + crlPoints: { + critical: false, + points: [ + "http://crl3.digicert.com/sha2-ev-server-g2.crl", + "http://crl4.digicert.com/sha2-ev-server-g2.crl", + ], + }, + cp: { + critical: false, + policies: [ + { + id: "2.16.840", + name: "ANSI Organizational Identifier", + qualifiers: [ + { + id: "1.3.6.1.5.5.7.2.1", + name: "Practices Statement", + value: "https://www.digicert.com/CPS", + }, + ], + value: "2.16.840.1.114412.2.1", + }, + { + id: "2.23.140.1.1", + name: "Certificate Type", + value: "Extended Validation", + }, + ], + }, + eKeyUsages: { + critical: false, + purposes: ["Server Authentication", "Client Authentication"], + }, + keyUsages: { + critical: true, + purposes: ["Digital Signature", "Key Encipherment"], + }, + msCrypto: { exists: false }, + ocspStaple: { critical: false, required: false }, + scts: { + critical: false, + timestamps: [ + { + logId: + "A4:B9:09:90:B4:18:58:14:87:BB:13:A2:CC:67:70:0A:3C:35:98:04:F9:1B:DF:B8:E3:77:CD:0E:C8:0D:DC:10", + name: "Google “Pilot”", + signatureAlgorithm: "SHA-256 ECDSA", + timestamp: "11/7/2018, 7:50:01 PM (Brasilia Standard Time)", + timestampUTC: "Wed, 07 Nov 2018 21:50:01 GMT", + version: 1, + }, + { + logId: + "87:75:BF:E7:59:7C:F8:8C:43:99:5F:BD:F3:6E:FF:56:8D:47:56:36:FF:4A:B5:60:C1:B4:EA:FF:5E:A0:83:0F", + name: "DigiCert Server 2", + signatureAlgorithm: "SHA-256 ECDSA", + timestamp: "11/7/2018, 7:50:01 PM (Brasilia Standard Time)", + timestampUTC: "Wed, 07 Nov 2018 21:50:01 GMT", + version: 1, + }, + { + logId: + "EE:4B:BD:B7:75:CE:60:BA:E1:42:69:1F:AB:E1:9E:66:A3:0F:7E:5F:B0:72:D8:83:00:C4:7B:89:7A:A8:FD:CB", + name: "Google “Rocketeer”", + signatureAlgorithm: "SHA-256 ECDSA", + timestamp: "11/7/2018, 7:50:01 PM (Brasilia Standard Time)", + timestampUTC: "Wed, 07 Nov 2018 21:50:01 GMT", + version: 1, + }, + ], + }, + sKID: { + critical: false, + id: "6C:B0:43:56:FE:3D:E8:12:EC:D9:12:F5:63:D5:C4:CA:07:AF:B0:76", + }, + san: { + altNames: [ + ["DNS Name", "www.digicert.com"], + ["DNS Name", "admin.digicert.com"], + ["DNS Name", "digicert.com"], + ["DNS Name", "content.digicert.com"], + ["DNS Name", "login.digicert.com"], + ["DNS Name", "api.digicert.com"], + ["DNS Name", "ws.digicert.com"], + ["DNS Name", "www.origin.digicert.com"], + ], + critical: false, + }, + }, + files: { + pem: "-----BEGIN%20CERTIFICATE-----%0D%0AMIIIzDCCB7SgAwIBAgIQDrbqtBjIc9jzwDHc3d8YsDANBgkqhkiG9w0BAQsFADB1%0D%0AMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3%0D%0Ad3cuZGlnaWNlcnQuY29tMTQwMgYDVQQDEytEaWdpQ2VydCBTSEEyIEV4dGVuZGVk%0D%0AIFZhbGlkYXRpb24gU2VydmVyIENBMB4XDTE4MTEwNzAwMDAwMFoXDTIwMTExMzEy%0D%0AMDAwMFowgc8xHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5pemF0aW9uMRMwEQYLKwYB%0D%0ABAGCNzwCAQMTAlVTMRUwEwYLKwYBBAGCNzwCAQITBFV0YWgxFTATBgNVBAUTDDUy%0D%0AOTk1MzctMDE0MjELMAkGA1UEBhMCVVMxDTALBgNVBAgTBFV0YWgxDTALBgNVBAcT%0D%0ABExlaGkxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJb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pphsIjT%0D%0AAiEAqgzFns9X9+SKwTSz0h1epijxrnWH+qZ815QgaJVd83UAdwDuS723dc5guuFC%0D%0AaR+r4Z5mow9+X7By2IMAxHuJeqj9ywAAAWbwJ1RAAAAEAwBIMEYCIQCsFv4KXmNK%0D%0A+POADrfs37hcjApxSuiK14+tN5wFGby6QQIhANa+RvbVx1nYk13IyLCBiCMENLEV%0D%0A9urcBZfprZN+ZsrlMA0GCSqGSIb3DQEBCwUAA4IBAQB+tQhW07rk6eb2L2Ir+Wwq%0D%0Al5ZJaoaZq3zwoG8vPMFTZbcWPYsSVI5KuXELdB1QnmPbHebTJuI/gjfD65vf7C3N%0D%0ABjgLoXui39mwN4UNTBCc2Ls8s8/aVfTZGPCNNwynCEsY9h0HRobI8kiVPvU0kyBJ%0D%0AO3p3msqR7W2lAIWciJWmoPQkEFh7u84/oc7Pz2SSE6tqMW9lZmyBqjSuBufRJn1g%0D%0ACTdp/5DZdQWTNL6L5GSsRoXQnarsVtFVriqOjWf5R4O4z6LQznlbBQCMUR3geUNq%0D%0A0vSblnmgav0+L9HK97wqtONu1CrJ9/Q2JwoxFAs/zps/nh9oJU2ToK9lzl/38gpo%0D%0A-----END%20CERTIFICATE-----%0D%0A", + }, + fingerprint: { + sha1: "8E:43:B7:D0:84:FD:B2:6C:08:9E:D3:F1:10:0C:D2:1D:D4:AD:C6:DF", + sha256: + "37:BF:44:A9:28:03:8A:22:AE:0C:E3:2D:96:3C:36:F5:D2:2D:37:99:D6:B2:63:CB:9C:1D:45:D1:CF:FE:B0:69", + }, + issuer: { + cn: "DigiCert SHA2 Extended Validation Server CA", + dn: "c=US, o=DigiCert Inc, ou=www.digicert.com, cn=DigiCert SHA2 Extended Validation Server CA", + entries: [ + ["Country", "US"], + ["Organization", "DigiCert Inc"], + ["Organizational Unit", "www.digicert.com"], + ["Common Name", "DigiCert SHA2 Extended Validation Server CA"], + ], + }, + notBefore: "11/6/2018, 10:00:00 PM (Brasilia Standard Time)", + notBeforeUTC: "Wed, 07 Nov 2018 00:00:00 GMT", + notAfter: "11/13/2020, 9:00:00 AM (Brasilia Standard Time)", + notAfterUTC: "Fri, 13 Nov 2020 12:00:00 GMT", + subject: { + cn: "www.digicert.com", + dn: "OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.3=US, OID.1.3.6.1.4.1.311.60.2.1.2=Utah, serialNumber=5299537-0142, c=US, s=Utah, l=Lehi, o=DigiCert, Inc., ou=SRE, cn=www.digicert.com", + entries: [ + ["Business Category", "Private Organization"], + ["Inc. Country", "US"], + ["Inc. State / Province", "Utah"], + ["Serial Number", "5299537-0142"], + ["Country", "US"], + ["State / Province", "Utah"], + ["Locality", "Lehi"], + ["Organization", "DigiCert, Inc."], + ["Organizational Unit", "SRE"], + ["Common Name", "www.digicert.com"], + ], + }, + serialNumber: "0E:B6:EA:B4:18:C8:73:D8:F3:C0:31:DC:DD:DF:18:B0", + signature: { + name: "SHA-256 with RSA Encryption", + type: "1.2.840.113549.1.1.11", + }, + subjectPublicKeyInfo: { + e: 65537, + kty: "RSA", + n: "CE:9F:85:CA:39:30:30:B7:F6:98:69:B4:9C:10:5D:50:3B:25:63:D0:E5:68:D4:D9:A5:CA:2C:D6:35:95:B2:3E:0D:29:8B:9D:E0:81:4A:04:F7:C0:9E:35:49:33:FB:AB:1C:11:8A:96:35:8E:A5:DE:A2:81:E7:AA:49:24:8A:8D:42:6A:3D:36:85:8E:F2:4D:86:FE:34:C8:8C:51:46:A8:D5:98:22:AD:B7:8B:8F:87:A9:A5:E2:D7:F1:FF:69:61:60:6B:39:35:AA:4C:B2:00:E4:10:03:FA:79:E9:B1:BD:9B:93:A4:FC:80:4C:FC:16:67:2E:A5:49:2C:62:4E:C7:D8:A1:80:6D:5D:23:D0:EB:EA:F6:A9:FB:C4:1A:3D:16:AE:DE:DF:6C:11:DD:9C:C5:EE:08:C7:B8:0B:75:A6:06:DE:FC:6C:61:FD:C1:C9:C2:93:48:AB:72:AD:B9:17:D5:0C:B4:76:C4:B1:CB:E1:82:33:61:13:C4:4D:60:31:AE:EF:46:89:90:FD:9A:19:A3:C2:1B:E7:99:05:A7:A9:48:4F:A5:0E:3A:49:1D:CA:22:5D:A5:63:D7:21:96:65:B1:94:79:C2:47:A0:58:3B:09:3F:B5:EF:EE:71:34:58:C9:18:D7:ED:39:88:D6:2D:AF:36:51:86:19:67:07:0D:80:A0:C1:8D:23:EB:6C:05:72:D0:29:E6:5F:58:59:94:DF:46:E1:93:35:FD:F6:99:AF:21:82:77:7F:57:D0:18:B6:A8:E3:89:D0:12:37:64:9C:8B:E9:9B:41:CC:82:F6:A0:60:29:D0:56:79:E1:25:2B:73:C9:8C:F7:DB:87:E5:58:B3:D2:A7:9E:CE:41:E3:4C:B6:BE:8E:E5:6D:07:75:6C:A1:51:95:3E:0F:84:7A:C0:E6:D8:40:C6:79:6E:26:23:46:1B:40:42:33:20:F0:45:50:11:F6:73:11:DA:F4:58:63:B9:25:11:CB:1F:2A:2D:F2:D1:2B:5C:CF:43:88:5E:5C:09:BC:DF:72:37:AE:A2:29:36:48:75:BE:BD:BB:8F:6A:03:22:1D:33:3D:FB:79:6B:D2:84:4E:F9:95:B0:70:CE:DF:26:F9:F5:25:F4:76:3C:32:C0:68:8D:D0:52:FE:CE:2E:14:87:DF:65:1F:42:C9:3E:D4:80:AA:D3:99:B6:1F:04:B1:88:0B:E2:0D:19:79:0D:EE:BA:30:46:43:76:FB:B4:DE:C5:00:41:31:EF:5A:7C:34:32:BE:C9:81:B8:ED:9F:40:DE:50:A2:D8:C2:C4:56:83:EB:29:AA:81:53:24:75:86:6D:BF:51:21:BF:B7:97:17:AF:EE:72:2A:39", + keysize: 4096, + }, + unsupportedExtensions: [], + version: "3", + }, + { + ext: { + aia: { + descriptions: [ + { + location: "http://ocsp.digicert.com", + method: "Online Certificate Status Protocol (OCSP)", + }, + ], + critical: false, + }, + aKID: { + critical: false, + id: "B1:3E:C3:69:03:F8:BF:47:01:D4:98:26:1A:08:02:EF:63:64:2B:C3", + }, + basicConstraints: { cA: true, critical: true }, + crlPoints: { + critical: false, + points: ["http://crl4.digicert.com/DigiCertHighAssuranceEVRootCA.crl"], + }, + cp: { + critical: false, + policies: [ + { + id: "2.5.29.32.0", + qualifiers: [ + { + id: "1.3.6.1.5.5.7.2.1", + name: "Practices Statement", + value: "https://www.digicert.com/CPS", + }, + ], + }, + ], + }, + eKeyUsages: { + critical: false, + purposes: ["Server Authentication", "Client Authentication"], + }, + keyUsages: { + critical: true, + purposes: ["Digital Signature", "Certificate Signing", "CRL Signing"], + }, + msCrypto: { exists: false }, + ocspStaple: { critical: false, required: false }, + scts: { critical: false, timestamps: [] }, + sKID: { + critical: false, + id: "3D:D3:50:A5:D6:A0:AD:EE:F3:4A:60:0A:65:D3:21:D4:F8:F8:D6:0F", + }, + san: { altNames: [], critical: false }, + }, + files: { + pem: "-----BEGIN%20CERTIFICATE-----%0D%0AMIIEtjCCA56gAwIBAgIQDHmpRLCMEZUgkmFf4msdgzANBgkqhkiG9w0BAQsFADBs%0D%0AMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3%0D%0Ad3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j%0D%0AZSBFViBSb290IENBMB4XDTEzMTAyMjEyMDAwMFoXDTI4MTAyMjEyMDAwMFowdTEL%0D%0AMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3%0D%0ALmRpZ2ljZXJ0LmNvbTE0MDIGA1UEAxMrRGlnaUNlcnQgU0hBMiBFeHRlbmRlZCBW%0D%0AYWxpZGF0aW9uIFNlcnZlciBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC%0D%0AggEBANdTpARR+JmmFkhLZyeqk0nQOe0MsLAAh/FnKIaFjI5j2ryxQDji0/XspQUY%0D%0AuD0+xZkXMuwYjPrxDKZ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+Z6Mo8wNXrM9zwR4jxQUezKcxwCmXMS1%0D%0AoVWNWlZopCJwqjyBcdmdqEU79OX2olHdx3ti6G8MdOu42vi/hw15UJGQmxg7kVkn%0D%0A8TUoE6smftX3eg==%0D%0A-----END%20CERTIFICATE-----%0D%0A", + }, + fingerprint: { + sha1: "7E:2F:3A:4F:8F:E8:FA:8A:57:30:AE:CA:02:96:96:63:7E:98:6F:3F", + sha256: + "40:3E:06:2A:26:53:05:91:13:28:5B:AF:80:A0:D4:AE:42:2C:84:8C:9F:78:FA:D0:1F:C9:4B:C5:B8:7F:EF:1A", + }, + issuer: { + cn: "DigiCert High Assurance EV Root CA", + dn: "c=US, o=DigiCert Inc, ou=www.digicert.com, cn=DigiCert High Assurance EV Root CA", + entries: [ + ["Country", "US"], + ["Organization", "DigiCert Inc"], + ["Organizational Unit", "www.digicert.com"], + ["Common Name", "DigiCert High Assurance EV Root CA"], + ], + }, + notBefore: "10/22/2013, 10:00:00 AM (Brasilia Standard Time)", + notBeforeUTC: "Tue, 22 Oct 2013 12:00:00 GMT", + notAfter: "10/22/2028, 9:00:00 AM (Brasilia Standard Time)", + notAfterUTC: "Sun, 22 Oct 2028 12:00:00 GMT", + subject: { + cn: "DigiCert SHA2 Extended Validation Server CA", + dn: "c=US, o=DigiCert Inc, ou=www.digicert.com, cn=DigiCert SHA2 Extended Validation Server CA", + entries: [ + ["Country", "US"], + ["Organization", "DigiCert Inc"], + ["Organizational Unit", "www.digicert.com"], + ["Common Name", "DigiCert SHA2 Extended Validation Server CA"], + ], + }, + serialNumber: "0C:79:A9:44:B0:8C:11:95:20:92:61:5F:E2:6B:1D:83", + signature: { + name: "SHA-256 with RSA Encryption", + type: "1.2.840.113549.1.1.11", + }, + subjectPublicKeyInfo: { + e: 65537, + kty: "RSA", + n: "D7:53:A4:04:51:F8:99:A6:16:48:4B:67:27:AA:93:49:D0:39:ED:0C:B0:B0:00:87:F1:67:28:86:85:8C:8E:63:DA:BC:B1:40:38:E2:D3:F5:EC:A5:05:18:B8:3D:3E:C5:99:17:32:EC:18:8C:FA:F1:0C:A6:64:21:85:CB:07:10:34:B0:52:88:2B:1F:68:9B:D2:B1:8F:12:B0:B3:D2:E7:88:1F:1F:EF:38:77:54:53:5F:80:79:3F:2E:1A:AA:A8:1E:4B:2B:0D:AB:B7:63:B9:35:B7:7D:14:BC:59:4B:DF:51:4A:D2:A1:E2:0C:E2:90:82:87:6A:AE:EA:D7:64:D6:98:55:E8:FD:AF:1A:50:6C:54:BC:11:F2:FD:4A:F2:9D:BB:7F:0E:F4:D5:BE:8E:16:89:12:55:D8:C0:71:34:EE:F6:DC:2D:EC:C4:87:25:86:8D:D8:21:E4:B0:4D:0C:89:DC:39:26:17:DD:F6:D7:94:85:D8:04:21:70:9D:6F:6F:FF:5C:BA:19:E1:45:CB:56:57:28:7E:1C:0D:41:57:AA:B7:B8:27:BB:B1:E4:FA:2A:EF:21:23:75:1A:AD:2D:9B:86:35:8C:9C:77:B5:73:AD:D8:94:2D:E4:F3:0C:9D:EE:C1:4E:62:7E:17:C0:71:9E:2C:DE:F1:F9:10:28:19:33", + keysize: 2048, + }, + unsupportedExtensions: [], + version: "3", + }, + { + ext: { + aia: { critical: false }, + aKID: { + critical: false, + id: "B1:3E:C3:69:03:F8:BF:47:01:D4:98:26:1A:08:02:EF:63:64:2B:C3", + }, + basicConstraints: { cA: true, critical: true }, + cp: { critical: false }, + keyUsages: { + critical: true, + purposes: ["Digital Signature", "Certificate Signing", "CRL Signing"], + }, + msCrypto: { exists: false }, + ocspStaple: { critical: false, required: false }, + scts: { critical: false, timestamps: [] }, + sKID: { + critical: false, + id: "B1:3E:C3:69:03:F8:BF:47:01:D4:98:26:1A:08:02:EF:63:64:2B:C3", + }, + san: { altNames: [], critical: false }, + }, + files: { + pem: "-----BEGIN%20CERTIFICATE-----%0D%0AMIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs%0D%0AMQswCQYDVQQGEw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9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF%0D%0AhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2%0D%0AYzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe%0D%0AvEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep%0D%0A+OkuE6N36B9K%0D%0A-----END%20CERTIFICATE-----%0D%0A", + }, + fingerprint: { + sha1: "5F:B7:EE:06:33:E2:59:DB:AD:0C:4C:9A:E6:D3:8F:1A:61:C7:DC:25", + sha256: + "74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF", + }, + issuer: { + cn: "DigiCert High Assurance EV Root CA", + dn: "c=US, o=DigiCert Inc, ou=www.digicert.com, cn=DigiCert High Assurance EV Root CA", + entries: [ + ["Country", "US"], + ["Organization", "DigiCert Inc"], + ["Organizational Unit", "www.digicert.com"], + ["Common Name", "DigiCert High Assurance EV Root CA"], + ], + }, + notBefore: "11/9/2006, 10:00:00 PM (Brasilia Standard Time)", + notBeforeUTC: "Fri, 10 Nov 2006 00:00:00 GMT", + notAfter: "11/9/2031, 9:00:00 PM (Brasilia Standard Time)", + notAfterUTC: "Mon, 10 Nov 2031 00:00:00 GMT", + subject: { + cn: "DigiCert High Assurance EV Root CA", + dn: "c=US, o=DigiCert Inc, ou=www.digicert.com, cn=DigiCert High Assurance EV Root CA", + entries: [ + ["Country", "US"], + ["Organization", "DigiCert Inc"], + ["Organizational Unit", "www.digicert.com"], + ["Common Name", "DigiCert High Assurance EV Root CA"], + ], + }, + serialNumber: "02:AC:5C:26:6A:0B:40:9B:8F:0B:79:F2:AE:46:25:77", + signature: { + name: "SHA-1 with RSA Encryption", + type: "1.2.840.113549.1.1.5", + }, + subjectPublicKeyInfo: { + e: 65537, + kty: "RSA", + n: "C6:CC:E5:73:E6:FB:D4:BB:E5:2D:2D:32:A6:DF:E5:81:3F:C9:CD:25:49:B6:71:2A:C3:D5:94:34:67:A2:0A:1C:B0:5F:69:A6:40:B1:C4:B7:B2:8F:D0:98:A4:A9:41:59:3A:D3:DC:94:D6:3C:DB:74:38:A4:4A:CC:4D:25:82:F7:4A:A5:53:12:38:EE:F3:49:6D:71:91:7E:63:B6:AB:A6:5F:C3:A4:84:F8:4F:62:51:BE:F8:C5:EC:DB:38:92:E3:06:E5:08:91:0C:C4:28:41:55:FB:CB:5A:89:15:7E:71:E8:35:BF:4D:72:09:3D:BE:3A:38:50:5B:77:31:1B:8D:B3:C7:24:45:9A:A7:AC:6D:00:14:5A:04:B7:BA:13:EB:51:0A:98:41:41:22:4E:65:61:87:81:41:50:A6:79:5C:89:DE:19:4A:57:D5:2E:E6:5D:1C:53:2C:7E:98:CD:1A:06:16:A4:68:73:D0:34:04:13:5C:A1:71:D3:5A:7C:55:DB:5E:64:E1:37:87:30:56:04:E5:11:B4:29:80:12:F1:79:39:88:A2:02:11:7C:27:66:B7:88:B7:78:F2:CA:0A:A8:38:AB:0A:64:C2:BF:66:5D:95:84:C1:A1:25:1E:87:5D:1A:50:0B:20:12:CC:41:BB:6E:0B:51:38:B8:4B:CB", + keysize: 2048, + }, + unsupportedExtensions: [], + version: "3", + }, +]; diff --git a/toolkit/components/certviewer/tests/chrome/test_adjustCertInformation.html b/toolkit/components/certviewer/tests/chrome/test_adjustCertInformation.html new file mode 100644 index 0000000000..ddd4c8a0b3 --- /dev/null +++ b/toolkit/components/certviewer/tests/chrome/test_adjustCertInformation.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html> + <head> + <title>certviewer adjustCertInformation test</title> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> + </head> +<body> + <script type="module"> + function hasNullElements(obj) { + for (let key of Object.keys(obj)) { + if (obj[key] == null) return false; + if (typeof(obj[key]) === 'object') { + if (hasNullElements(obj[key]) === false) { + return false; + } + } + } + return true; + } + + async function doTest() { + const { adjustCertInformation } = await import("chrome://global/content/certviewer/certviewer.mjs"); + const { parseOutput } = await import("./parseOutput.mjs"); + + ok(adjustCertInformation, "adjustCertInformation should be available in this context"); + ok(parseOutput, "parseOutput should be available in this context"); + is(typeof(parseOutput), 'object', "parseOutput must be an object"); + + for (let cert of parseOutput) { + let adjustedCerts = adjustCertInformation(cert); + let result = hasNullElements(adjustedCerts.certItems); + ok(result, "adjustCertInformation function shouldn't return null elements"); + } + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + doTest(); + + </script> +</body> +</html> diff --git a/toolkit/components/certviewer/tests/chrome/test_certDecoder.html b/toolkit/components/certviewer/tests/chrome/test_certDecoder.html new file mode 100644 index 0000000000..67ad083242 --- /dev/null +++ b/toolkit/components/certviewer/tests/chrome/test_certDecoder.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<html> + <head> + <title>certviewer parse test</title> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> + </head> +<body> + <script type="module"> + // inputPEM is the same input to CS extension (https://github.com/april/certainly-something) + const inputPEM = "MIIGRjCCBS6gAwIBAgIQDJduPkI49CDWPd+G7+u6kDANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5EaWdpQ2VydCBTSEEyIFNlY3VyZSBTZXJ2ZXIgQ0EwHhcNMTgxMTA1MDAwMDAwWhcNMTkxMTEzMTIwMDAwWjCBgzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1vdW50YWluIF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IFICATE-----%0D%0A"; + + + async function doTest() { + const { parse, pemToDER } = await import("chrome://global/content/certviewer/certDecoder.mjs"); + + ok(parse, "parse should be available in this context"); + ok(pemToDER, "pemToDER should be available in this context"); + + let input = inputPEM.trim() + .replace(/\r|\n|\0/g, "") + .split() + .filter(v => v.startsWith("MII"))[0]; + + let certDER = pemToDER(input); + let cert = await parse(certDER); + ok(cert, "There should be a result"); + is(cert.files.pem, certOutputCS, "certificates output must be the same"); + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + doTest(); + + </script> +</body> +</html> diff --git a/toolkit/components/certviewer/tests/chrome/test_certDecoderFields.html b/toolkit/components/certviewer/tests/chrome/test_certDecoderFields.html new file mode 100644 index 0000000000..1f54cced4b --- /dev/null +++ b/toolkit/components/certviewer/tests/chrome/test_certDecoderFields.html @@ -0,0 +1,84 @@ +<!DOCTYPE html> +<html> + <head> + <title>certviewer parse test</title> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> + </head> +<body> + <script type="module"> + // inputPEM is the same input to CS extension (https://github.com/april/certainly-something) + const inputPEM = "MIIGRjCCBS6gAwIBAgIQDJduPkI49CDWPd+G7+u6kDANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5EaWdpQ2VydCBTSEEyIFNlY3VyZSBTZXJ2ZXIgQ0EwHhcNMTgxMTA1MDAwMDAwWhcNMTkxMTEzMTIwMDAwWjCBgzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxHDAaBgNVBAoTE01vemlsbGEgQ29ycG9yYXRpb24xDzANBgNVBAsTBldlYk9wczEYMBYGA1UEAxMPd3d3Lm1vemlsbGEub3JnMIIBIjANBgkqhkiG9w0BA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gu18SfK1ZAIgKtwu5eGxK76rgaszLCZ9edBIjuU0DKorzPUuxUXFY0QwDQYJKoZIhvcNAQELBQADggEBAKLJAFO3wuaP5MM/ed1lhk5Uc2aDokhcM7XyvdhEKSHbgPhcgMoT9YIVoPa70gNC6KHcwoXu0g8wt7X6Vm1ql/68G5q844kFuC6JPl4LVT9mciD+VW6bHUSXD9xifL9DqdJ0Ic0SllTlM+oq5aAeOxUQGXhXIqj6fSQv9fQN6mXxQIoc/gjxteskq/Vl8YmY1FIZP9Bh7g27kxZ9GAAGQtjTL03RzKAuSg6yeImYVdQWasc7UPnBXlRAzZ8+OJThUbzK16a2CI3Rg4agKSJk+uA47h1/ImmngpFLRb/MvRX6H1oWcUuyH6O7PZdl0YpwTpw1THIuqCGl/wpPgyQgcTM="; + + async function run(input, expected) { + const { parse, pemToDER } = await import("chrome://global/content/certviewer/certDecoder.mjs"); + + ok(parse, "parse should be available in this context"); + ok(pemToDER, "pemToDER should be available in this context"); + + let certDER; + try { + certDER = pemToDER(input); + } catch (err) { + is("error", expected, "OK, error found when executing pemToDER function"); + return; + } + ok(certDER, "pemToDER returned a non null value"); + + let cert; + try { + cert = await parse(certDER); + } catch (err) { + is("error", expected, "OK, error found when executing parse function"); + return; + } + ok(cert, "Parse function returned an Object"); + + // "Because the representation of JS Date objects will vary depending on the timezone, + // we don't consider them in the test. Instead we test their corresponding UTC values (e.g notAfterUTC)." + cert.notAfter = ""; + expected.notAfter = ""; + + cert.notBefore = ""; + expected.notBefore = ""; + + cert.ext.scts.timestamps = cert.ext.scts.timestamps.map(elem => elem.timestamp = ""); + expected.ext.scts.timestamps = expected.ext.scts.timestamps.map(elem => elem.timestamp = ""); + + is(JSON.stringify(cert), JSON.stringify(expected), "All the fields in CS must be equal to our output"); + } + + async function doTest() { + const { certOutputCS } = await import("./CSoutput.mjs"); + + ok(certOutputCS, "certOutputCS should be available in this context"); + is(typeof(certOutputCS), 'object', "certOutputCS must be an object"); + + let inputs = [ + inputPEM, + inputPEMerror1, + inputPEMerror2 + ]; + + let expected = [ + certOutputCS[0], + "error", + "error" + ]; + + for (let i = 0; i < inputs.length; i++) { + await run(inputs[i], expected[i]); + } + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + doTest(); + + </script> +</body> +</html> diff --git a/toolkit/components/certviewer/tests/chrome/test_kebabCaseInAdjustCertInformation.html b/toolkit/components/certviewer/tests/chrome/test_kebabCaseInAdjustCertInformation.html new file mode 100644 index 0000000000..b9f7b98d89 --- /dev/null +++ b/toolkit/components/certviewer/tests/chrome/test_kebabCaseInAdjustCertInformation.html @@ -0,0 +1,106 @@ +<!DOCTYPE html> +<html> + <head> + <title>certviewer adjustCertInformation test</title> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> + </head> +<body> + <script type="module"> + function isKebabCase(str) { + if (str === "") return true; + return /^([a-z][a-z0-9]*)(-[a-z0-9]+)*$/.test(str); + } + + function validateIsKebabCase() { + let tests = [ + { + input: "", + expected: true + }, + { + input: "A", + expected: false + }, + { + input: "Ab", + expected: false + }, + { + input: "Ab-ad", + expected: false + }, + { + input: "ad-Az", + expected: false + }, + { + input: "ad- z", + expected: false + }, + { + input: "ad-z ", + expected: false + }, + { + input: "ad z", + expected: false + }, + { + input: "ad--fz", + expected: false + }, + { + input: "-a-b-c", + expected: false + }, + { + input: "ad-fz", + expected: true + }, + { + input: "ad", + expected: true + }, + { + input: "a-b-c", + expected: true + }, + ]; + + for (let test of tests) { + let result = isKebabCase(test.input); + is(result, test.expected, `${test.input} should${test.expected === false ? "n't" : ""} be a kebab-case string`); + } + } + + async function doTest() { + const { adjustCertInformation } = await import("chrome://global/content/certviewer/certviewer.mjs"); + const { parseOutput } = await import("./parseOutput.mjs"); + + ok(adjustCertInformation, "adjustCertInformation should be available in this context"); + ok(parseOutput, "parseOutput should be available in this context"); + is(typeof(parseOutput), 'object', "parseOutput must be an object"); + + validateIsKebabCase(); + + for (let cert of parseOutput) { + let adjustedCerts = adjustCertInformation(cert); + adjustedCerts.certItems.forEach(item => { + ok(isKebabCase(item.sectionId), `${item.sectionId} should be a valid kebab-case string`); + item.sectionItems.forEach(element => { + ok(isKebabCase(element.label), `${element.label} should be a valid kebab-case string`); + }); + }); + } + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + doTest(); + + </script> +</body> +</html> |