summaryrefslogtreecommitdiffstats
path: root/toolkit/components/certviewer/tests/browser/browser_handleMultipleCertsURL.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/certviewer/tests/browser/browser_handleMultipleCertsURL.js')
-rw-r--r--toolkit/components/certviewer/tests/browser/browser_handleMultipleCertsURL.js251
1 files changed, 251 insertions, 0 deletions
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%2Bu6kDANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5EaWdpQ2VydCBTSEEyIFNlY3VyZSBTZXJ2ZXIgQ0EwHhcNMTgxMTA1MDAwMDAwWhcNMTkxMTEzMTIwMDAwWjCBgzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxHDAaBgNVBAoTE01vemlsbGEgQ29ycG9yYXRpb24xDzANBgNVBAsTBldlYk9wczEYMBYGA1UEAxMPd3d3Lm1vemlsbGEub3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuKruymkkmkqCJh7QjmXlUOBcLFRyw5LG%2FvUUWVrsxC2gsbR8WJq%2BcYoYBpoNVStKrO4U2rBh1GEbccvT6qKOQI%2BpjjDxx9cmRdubGTGp8L0MF1ohVvhIvYLumOEoRDDPU4PvGJjGhek%2FojvedPWe8dhciHkxOC2qPFZvVFMwg1%2Fo%2Fb80147BwZQmzB18mnHsmcyKlpsCN8pxw86uao9Iun8gZQrsllW64rTZlRR56p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ifj1DjYLJuMOH%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%2Bu6kDANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5EaWdpQ2VydCBTSEEyIFNlY3VyZSBTZXJ2ZXIgQ0EwHhcNMTgxMTA1MDAwMDAwWhcNMTkxMTEzMTIwMDAwWjCBgzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxHDAaBgNVBAoTE01vemlsbGEgQ29ycG9yYXRpb24xDz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2VydFNIQTJTZWN1cmVTZXJ2ZXJDQS5jcnQwDAYDVR0TAQH%2FBAIwADCCAQIGCisGAQQB1nkCBAIEgfMEgfAA7gB1AKS5CZC0GFgUh7sTosxncAo8NZgE%2BRvfuON3zQ7IDdwQAAABZuYWiHwAAAQDAEYwRAIgZnMSH1JdG6NASHWTwD0mlP%2Fzbr0hzP263c02Ym0DU64CIEe4QHJDP47j0b6oTFu6RrZz1NQ9cq8Az1KnMKRuaFAlAHUAh3W%2F51l8%2BIxDmV%2B9827%2FVo1HVjb%2FSrVgwbTq%2F16ggw8AAAFm5haJAgAABAMARjBEAiAxGLXkUaOAkZhXNeNR3pWyahZeKmSaMXadgu18SfK1ZAIgKtwu5eGxK76rgaszLCZ9edBIjuU0DKorzPUuxUXFY0QwDQYJKoZIhvcNAQELBQADggEBAKLJAFO3wuaP5MM%2Fed1lhk5Uc2aDokhcM7XyvdhEKSHbgPhcgMoT9YIVoPa70gNC6KHcwoXu0g8wt7X6Vm1ql%2F68G5q844kFuC6JPl4LVT9mciD%2BVW6bHUSXD9xifL9DqdJ0Ic0SllTlM%2Boq5aAeOxUQGXhXIqj6fSQv9fQN6mXxQIoc%2Fgjxteskq%2FVl8YmY1FIZP9Bh7g27kxZ9GAAGQtjTL03RzKAuSg6yeImYVdQWasc7UPnBXlRAzZ8%2BOJThUbzK16a2CI3Rg4agKSJk%2BuA47h1%2FImmngpFLRb%2FMvRX6H1oWcUuyH6O7PZdl0YpwTpw1THIuqCGl%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);
+ }
+ }
+});