Bug 1516134 - run onChangedManualEdit() in emailWizard even if menulist hasn't changed from non-editable to editable, so that settings are read properly. r=jorgk DONTBUILD
authoraceman <acelists@atlas.sk>
Sat, 05 Jan 2019 18:00:00 +0100
changeset 33269 1968c2aef7ae
parent 33268 e63b335d0e43
child 33270 4530e74cd168
push id2368
push userclokep@gmail.com
push dateMon, 28 Jan 2019 21:12:50 +0000
treeherdercomm-beta@56d23c07d815 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
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=jorgk DONTBUILD
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();