diff --git a/toolkit/components/certviewer/content/components/certificate-section.js b/toolkit/components/certviewer/content/components/certificate-section.js index 7f3680dec882..234ba0d20d4c 100644 --- a/toolkit/components/certviewer/content/components/certificate-section.js +++ b/toolkit/components/certviewer/content/components/certificate-section.js @@ -5,7 +5,6 @@ import { updateSelectedItem } from "../certviewer.js"; import { InfoGroup } from "./info-group.js"; import { ErrorSection } from "./error-section.js"; -import { normalizeToKebabCase } from "../utils.js"; class CertificateSection extends HTMLElement { constructor(certs, error) { @@ -120,23 +119,15 @@ class CertificateSection extends HTMLElement { } this.infoGroupsContainers[i].classList.add("info-groups"); this.shadowRoot.appendChild(this.infoGroupsContainers[i]); - - let final = false; - if (i === this.certs.length - 1) { - final = true; - } - for (let j = 0; j < certArray.length; j++) { - this.infoGroupsContainers[i].appendChild( - new InfoGroup(certArray[j], final) - ); + this.infoGroupsContainers[i].appendChild(new InfoGroup(certArray[j])); } } createTabSection(tabName, i, certificateTabs) { let tab = document.createElement("button"); tab.textContent = tabName; - tab.setAttribute("id", normalizeToKebabCase(tabName)); + tab.setAttribute("id", "tab" + i); tab.setAttribute("aria-controls", "panel" + i); tab.setAttribute("idnumber", i); tab.setAttribute("role", "tab"); diff --git a/toolkit/components/certviewer/content/components/info-group.js b/toolkit/components/certviewer/content/components/info-group.js index d3dc01a1216c..448d063734c5 100644 --- a/toolkit/components/certviewer/content/components/info-group.js +++ b/toolkit/components/certviewer/content/components/info-group.js @@ -3,14 +3,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import { InfoItem } from "./info-item.js"; -import { updateSelectedItem } from "../certviewer.js"; -import { normalizeToKebabCase } from "../utils.js"; export class InfoGroup extends HTMLElement { - constructor(item, final) { + constructor(item) { super(); this.item = item; - this.final = final; } connectedCallback() { @@ -34,38 +31,6 @@ export class InfoGroup extends HTMLElement { for (let i = 0; i < this.item.sectionItems.length; i++) { this.shadowRoot.append(new InfoItem(this.item.sectionItems[i])); } - - if (this.item.sectionId === "issuer-name") { - this.setLinkToTab(); - } - } - - setLinkToTab() { - if (this.final) { - return; - } - - let issuerCommonName = this.shadowRoot - .querySelector(".common-name") - .shadowRoot.querySelector(".info"); - - let link = document.createElement("a"); - link.textContent = issuerCommonName.textContent; - link.setAttribute("href", "#"); - - issuerCommonName.textContent = ""; - issuerCommonName.appendChild(link); - - link.addEventListener("click", () => { - let id = normalizeToKebabCase(link.textContent); - let issuerTab = document - .querySelector("certificate-section") - .shadowRoot.getElementById(id); - - let index = issuerTab.getAttribute("idnumber"); - - updateSelectedItem(index); - }); } } diff --git a/toolkit/components/certviewer/tests/browser/browser.ini b/toolkit/components/certviewer/tests/browser/browser.ini index 08ab5ae41f39..0d221eed2e81 100644 --- a/toolkit/components/certviewer/tests/browser/browser.ini +++ b/toolkit/components/certviewer/tests/browser/browser.ini @@ -10,6 +10,5 @@ support-files = support-files = dummy_page.html [browser_renderCertToUI.js] -[browser_certificateTabLink.js] [browser_downloadLink.js] [browser_clickableLink.js] diff --git a/toolkit/components/certviewer/tests/browser/browser_certificateTabLink.js b/toolkit/components/certviewer/tests/browser/browser_certificateTabLink.js deleted file mode 100644 index 9e31450fd39d..000000000000 --- a/toolkit/components/certviewer/tests/browser/browser_certificateTabLink.js +++ /dev/null @@ -1,63 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -const validCert = - "about:certificate?cert=MIIGMDCCBRigAwIBAgIQCa2oS7Nau6nwv1WyRNIJnzANBgkqhkiG9w0BAQsFADBwMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMS8wLQYDVQQDEyZEaWdpQ2VydCBTSEEyIEhpZ2ggQXNzdXJhbmNlIFNlcnZlciBDQTAeFw0xOTA2MDYwMDAwMDBaFw0xOTA5MDQxMjAwMDBaMGExCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTETMBEGA1UEBxMK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AEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH%2FBAQDAgGGMA8GA1UdEwEB%2FwQFMAMBAf8wHQYDVR0OBBYEFLE%2Bw2kD%2BL9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE%2Bw2kD%2BL9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe%2FEW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9%2BMpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2Yzi9RKR%2F5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2%2FS6cCZdkGCevEsXCS%2B0yx5DaMkHJ8HSXPfqIbloEpw8nL%2Be%2FIBcm2PN7EeqJSdnoDfzAIJ9VNep%2BOkuE6N36B9K"; - -add_task(async function test_certificateTabLink() { - await BrowserTestUtils.openNewForegroundTab(gBrowser, () => { - gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, validCert); - }); - - await ContentTask.spawn(gBrowser.selectedBrowser, null, 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( - !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_checkNonEmptyFields.js b/toolkit/components/certviewer/tests/browser/browser_checkNonEmptyFields.js index a2ac721e0a4a..2b59ad9073dc 100644 --- a/toolkit/components/certviewer/tests/browser/browser_checkNonEmptyFields.js +++ b/toolkit/components/certviewer/tests/browser/browser_checkNonEmptyFields.js @@ -31,7 +31,7 @@ add_task(async function test() { } let tabButton = certificateSection.shadowRoot.querySelector( - `.certificate-tabs .tab[idnumber="${tabID}"]` + `.certificate-tabs #tab${tabID}` ); tabButton.click(); diff --git a/toolkit/components/certviewer/tests/browser/browser_checkNonUndefinedStrings.js b/toolkit/components/certviewer/tests/browser/browser_checkNonUndefinedStrings.js index 669890b570b5..f721b07f4767 100644 --- a/toolkit/components/certviewer/tests/browser/browser_checkNonUndefinedStrings.js +++ b/toolkit/components/certviewer/tests/browser/browser_checkNonUndefinedStrings.js @@ -21,7 +21,7 @@ add_task(async function test() { for (let i = 0; i < tabs.length; i++) { let tabButton = certificateSection.shadowRoot.querySelector( - `.certificate-tabs .tab[idnumber="${i}"]` + `.certificate-tabs #tab${i}` ); tabButton.click(); diff --git a/toolkit/components/certviewer/tests/browser/browser_handleMultipleCertsURL.js b/toolkit/components/certviewer/tests/browser/browser_handleMultipleCertsURL.js index c4cdbbc86df5..5ff361dc940a 100644 --- a/toolkit/components/certviewer/tests/browser/browser_handleMultipleCertsURL.js +++ b/toolkit/components/certviewer/tests/browser/browser_handleMultipleCertsURL.js @@ -29,7 +29,7 @@ async function checkSubjectName(inputPage, subjectsNameInfo) { ".certificate-tabs" ); - let tab = tabs.querySelector(`.tab[idnumber="${index}"]`); + let tab = tabs.querySelector(`#tab${index}`); Assert.ok(tab, `Tab at index ${index} found`); Assert.equal(tab.innerText, tabName, `Tab name should be ${tabName}`); diff --git a/toolkit/components/certviewer/tests/browser/browser_renderCertToUI.js b/toolkit/components/certviewer/tests/browser/browser_renderCertToUI.js index 9a8ffd76e1a0..f45e8fea6e39 100644 --- a/toolkit/components/certviewer/tests/browser/browser_renderCertToUI.js +++ b/toolkit/components/certviewer/tests/browser/browser_renderCertToUI.js @@ -37,9 +37,8 @@ add_task(async function test() { "infoGroups must have the same length of adjustedCerts" ); - let tabName = certificateSection.shadowRoot.querySelector( - ".tab[idnumber='0']" - ).textContent; + let tabName = certificateSection.shadowRoot.querySelector("#tab0") + .textContent; Assert.equal(tabName, expectedTabName, "Tab name should be the same"); function getElementByAttribute(source, property, target) {