Bug 580764 Setting pop/imap port to the default value for the security setting not selected appears to get reset. r/sr=Standard8
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Fri, 30 Jul 2010 15:12:41 +0100
changeset 6041 b8f34cb7b0afb2819ead01e3b4676dfaa7aea7bd
parent 6040 6fe0b79da9927057d8066214b49e2fbd69965438
child 6042 41c0dab1b83a6cd984d0ef7dfb568942cfc4f827
push id4669
push userbugzilla@standard8.plus.com
push dateFri, 30 Jul 2010 14:13:02 +0000
treeherdercomm-central@b8f34cb7b0af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs580764
Bug 580764 Setting pop/imap port to the default value for the security setting not selected appears to get reset. r/sr=Standard8
mailnews/base/prefs/content/am-server.js
--- a/mailnews/base/prefs/content/am-server.js
+++ b/mailnews/base/prefs/content/am-server.js
@@ -85,17 +85,17 @@ function initServerType()
 {
   var serverType = document.getElementById("server.type").getAttribute("value");
   var propertyName = "serverType-" + serverType;
 
   var messengerBundle = document.getElementById("bundle_messenger");
   var verboseName = messengerBundle.getString(propertyName);
   setDivText("servertype.verbose", verboseName);
 
-  secureSelect();
+  secureSelect(true);
 
   setLabelFromStringBundle("authMethod-no", "authNo");
   setLabelFromStringBundle("authMethod-old", "authOld");
   setLabelFromStringBundle("authMethod-kerberos", "authKerberos");
   setLabelFromStringBundle("authMethod-ntlm", "authNTLM");
   setLabelFromStringBundle("authMethod-anysecure", "authAnySecure");
   setLabelFromStringBundle("authMethod-any", "authAny");
   setLabelFromStringBundle("authMethod-password-encrypted",
@@ -178,36 +178,36 @@ function onAdvanced()
     document.getElementById("pop3.deferGetNewMail").checked = serverSettings.deferGetNewMail;
     document.getElementById("pop3.deferredToAccount").setAttribute("value", serverSettings.deferredToAccount);
     var pop3Server = gServer.QueryInterface(Components.interfaces.nsIPop3IncomingServer);
     // we're explicitly setting this so we'll go through the SetDeferredToAccount method
     pop3Server.deferredToAccount = serverSettings.deferredToAccount;
   }
 }
 
-function secureSelect()
+function secureSelect(aLoading)
 {
     var socketType = document.getElementById("server.socketType").value;
     var serverType = document.getElementById("server.type").value;
     var protocolInfo = Components.classes["@mozilla.org/messenger/protocol/info;1?type=" + serverType]
                                  .getService(Components.interfaces.nsIMsgProtocolInfo);
 
     var defaultPort = protocolInfo.getDefaultServerPort(false);
     var defaultPortSecure = protocolInfo.getDefaultServerPort(true);
     var port = document.getElementById("server.port");
     var portDefault = document.getElementById("defaultPort");
     var prevDefaultPort = portDefault.value;
 
     if (socketType == Ci.nsMsgSocketType.SSL) {
       portDefault.value = defaultPortSecure;
-      if (port.value == "" || (port.value == defaultPort && prevDefaultPort != portDefault.value))
+      if (port.value == "" || (!aLoading && port.value == defaultPort && prevDefaultPort != portDefault.value))
         port.value = defaultPortSecure;
     } else {
         portDefault.value = defaultPort;
-        if (port.value == "" || (port.value == defaultPortSecure && prevDefaultPort != portDefault.value))
+        if (port.value == "" || (!aLoading && port.value == defaultPortSecure && prevDefaultPort != portDefault.value))
           port.value = defaultPort;
     }
 
     // switch "insecure password" label
     setLabelFromStringBundle("authMethod-password-cleartext",
         socketType == Ci.nsMsgSocketType.SSL ||
         socketType == Ci.nsMsgSocketType.alwaysSTARTTLS ?
         "authPasswordCleartextViaSSL" : "authPasswordCleartextInsecurely");