Bug 1591148 - only use 'checked' on <checkbox> and <input type="checkbox"> to fix password storage on IM account creation. r=jorgk
authoraceman <acelists@atlas.sk>
Mon, 28 Oct 2019 00:02:18 +0100
changeset 37371 f6f166242dfdee794a4aa5b15f0767145c56984e
parent 37370 74bd1f64906accd6d0056cc29fb77fec292ffba7
child 37372 94c1bd9522d2d73891670081db6669a689e6ebbb
push id396
push userclokep@gmail.com
push dateMon, 06 Jan 2020 23:11:57 +0000
reviewersjorgk
bugs1591148
Bug 1591148 - only use 'checked' on <checkbox> and <input type="checkbox"> to fix password storage on IM account creation. r=jorgk
mail/components/im/content/imAccountWizard.js
--- a/mail/components/im/content/imAccountWizard.js
+++ b/mail/components/im/content/imAccountWizard.js
@@ -409,18 +409,23 @@ var accountWizard = {
     return true;
   },
 
   getValue(aId) {
     var elt = document.getElementById(aId);
     if ("selectedItem" in elt) {
       return elt.selectedItem.value;
     }
-    // Strangely for <input type="number"> "checked" is also set.
-    if (elt.getAttribute("type") != "number" && "checked" in elt) {
+    // Strangely various input types also have a "checked" property defined,
+    // so we check for the expected elements explicitly.
+    if (
+      ((elt.localName == "input" && elt.getAttribute("type") == "checkbox") ||
+        elt.localName == "checkbox") &&
+      "checked" in elt
+    ) {
       return elt.checked;
     }
     if ("value" in elt) {
       return elt.value;
     }
     // If the groupbox has never been opened, the binding isn't attached
     // so the attributes don't exist. The calling code in showSummary
     // has a special handling of the undefined value for this case.