Bug 1516134 - run onChangedManualEdit() in emailWizard even if menulist hasn't changed from non-editable to editable, so that settings are read properly. r+a=jorgk
authoraceman <acelists@atlas.sk>
Sat, 05 Jan 2019 18:00:00 +0100
changeset 33925 1fbabef66920197989ddf3d0114578d222d8ced1
parent 33924 f16d6de1d4024a7b7a07eeddea307eb6aaf9e9e3
child 33926 ec30d1b23b43a57e1a18eaded23c7a043a44136f
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
bugs1516134
Bug 1516134 - run onChangedManualEdit() in emailWizard even if menulist hasn't changed from non-editable to editable, so that settings are read properly. r+a=jorgk
mail/components/accountcreation/content/emailWizard.js
--- a/mail/components/accountcreation/content/emailWizard.js
+++ b/mail/components/accountcreation/content/emailWizard.js
@@ -1413,17 +1413,17 @@ EmailConfigWizard.prototype =
   /**
    * Sets the label of the first entry of the dropdown which represents
    * the new outgoing server.
    */
   onOpenOutgoingDropdown() {
     var menulist = e("outgoing_hostname");
     // If the menulist is not editable, there is nothing to update
     // and menulist.inputField does not even exist.
-    if (!menulist.editable)
+    if (menulist.getAttribute("editable") != "true")
       return;
 
     var menuitem = menulist.getItemAtIndex(0);
     assert(!menuitem.serverKey, "I wanted the special item for the new host");
     menuitem.label = menulist.inputField.value;
   },
 
   /**
@@ -1437,26 +1437,30 @@ EmailConfigWizard.prototype =
       // an existing server has been selected from the dropdown
       menulist.removeAttribute("editable");
       _hide("outgoing_port");
       _hide("outgoing_ssl");
       _hide("outgoing_authMethod");
       this.onChangedManualEdit();
     } else {
       // new server, with hostname, port etc.
-      menulist.setAttribute("editable", "true");
       _show("outgoing_port");
       _show("outgoing_ssl");
       _show("outgoing_authMethod");
 
       // We cannot rely on the editable menulist binding being
       // attached immediately.
-      menulist.addEventListener("bindingattached", () => {
+      if (menulist.getAttribute("editable") != "true") {
+        menulist.setAttribute("editable", "true");
+        menulist.addEventListener("bindingattached", () => {
+          this.onChangedManualEdit();
+        }, { once: true });
+      } else {
         this.onChangedManualEdit();
-      }, { once: true });
+      }
     }
   },
 
   onChangedManualEdit() {
     if (this._abortable) {
       this.onStop();
     }
     this.validateManualEditComplete();