Bug 1540123 - Append menuitems into the menupopup for the certificate nickname menulist in certificate selection dialog UI. r=keeler a=pascalc
authorBrian Grinstead <bgrinstead@mozilla.com>
Tue, 09 Apr 2019 11:52:43 +0300
changeset 526059 6a2328c57b79a2353103d23138181066f3835d02
parent 526058 6f217dc63838d8d79904f285959c126423ff387f
child 526060 c6091e97fad76956b6bc1576fd28e3083ce3ad3a
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskeeler, pascalc
bugs1540123
milestone67.0
Bug 1540123 - Append menuitems into the menupopup for the certificate nickname menulist in certificate selection dialog UI. r=keeler a=pascalc Reviewers: keeler Reviewed By: keeler Bug #: 1540123 Differential Revision: https://phabricator.services.mozilla.com/D25825
security/manager/pki/resources/content/choosetoken.js
security/manager/pki/resources/content/clientauthask.js
security/manager/ssl/tests/mochitest/browser/browser_clientAuth_ui.js
--- a/security/manager/pki/resources/content/choosetoken.js
+++ b/security/manager/pki/resources/content/choosetoken.js
@@ -14,17 +14,17 @@ function onLoad() {
   dialogParams = window.arguments[0].QueryInterface(nsIDialogParamBlock);
   let selectElement = document.getElementById("tokens");
   let count = dialogParams.GetInt(0);
   for (let i = 0; i < count; i++) {
     let menuItemNode = document.createElement("menuitem");
     let token = dialogParams.GetString(i);
     menuItemNode.setAttribute("value", token);
     menuItemNode.setAttribute("label", token);
-    selectElement.firstChild.appendChild(menuItemNode);
+    selectElement.menupopup.appendChild(menuItemNode);
     if (i == 0) {
       selectElement.selectedItem = menuItemNode;
     }
   }
 }
 
 function doOK() {
   let tokenList = document.getElementById("tokens");
--- a/security/manager/pki/resources/content/clientauthask.js
+++ b/security/manager/pki/resources/content/clientauthask.js
@@ -83,17 +83,17 @@ function onLoad() {
   for (let i = 0; i < certArray.length; i++) {
     let menuItemNode = document.createXULElement("menuitem");
     let cert = certArray.queryElementAt(i, Ci.nsIX509Cert);
     let nickAndSerial =
       bundle.getFormattedString("clientAuthNickAndSerial",
                                 [cert.displayName, cert.serialNumber]);
     menuItemNode.setAttribute("value", i);
     menuItemNode.setAttribute("label", nickAndSerial); // This is displayed.
-    selectElement.firstChild.appendChild(menuItemNode);
+    selectElement.menupopup.appendChild(menuItemNode);
     if (i == 0) {
       selectElement.selectedItem = menuItemNode;
     }
   }
 
   setDetails();
 
   Services.obs.notifyObservers(document.getElementById("certAuthAsk"),
--- a/security/manager/ssl/tests/mochitest/browser/browser_clientAuth_ui.js
+++ b/security/manager/ssl/tests/mochitest/browser/browser_clientAuth_ui.js
@@ -65,16 +65,17 @@ function checkDialogContents(win, notBef
   Assert.equal(win.document.getElementById("issuer").textContent,
                `Issued Under: “${TEST_ISSUER_ORG}”`,
                "Actual and expected issuer organization should be equal");
 
   Assert.equal(win.document.getElementById("nicknames").label,
                "Mochitest client [03]",
                "Actual and expected selected cert nickname and serial should " +
                "be equal");
+  Assert.equal(win.document.getElementById("nicknames").itemCount, 1, "correct number of items");
 
   let [subject, serialNum, validity, issuer, tokenName] =
     win.document.getElementById("details").value.split("\n");
   Assert.equal(subject, "Issued to: CN=Mochitest client",
                "Actual and expected subject should be equal");
   Assert.equal(serialNum, "Serial number: 03",
                "Actual and expected serial number should be equal");
   Assert.equal(validity, `Valid from ${notBefore} to ${notAfter}`,