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 36498 f6f166242dfdee794a4aa5b15f0767145c56984e
parent 36497 74bd1f64906accd6d0056cc29fb77fec292ffba7
child 36499 94c1bd9522d2d73891670081db6669a689e6ebbb
push id2534
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:52:51 +0000
treeherdercomm-beta@055c50840778 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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.