Bug 1440693 - fix setting of host and port in mailnews/. r=aceman
authorJorg K <jorgk@jorgk.com>
Sun, 04 Mar 2018 18:06:20 +0100
changeset 31216 4e295d352da8adbb9c665f6f5af2ae2cfec25567
parent 31215 b090e8a0634f70dc762db3a081ffcdfc175b748b
child 31217 ca762e6c30ce9dc52cab3fa95c4ffdfd303f3ede
push id383
push userclokep@gmail.com
push dateMon, 07 May 2018 21:52:48 +0000
reviewersaceman
bugs1440693
Bug 1440693 - fix setting of host and port in mailnews/. r=aceman
mailnews/addrbook/prefs/content/pref-directory-add.js
mailnews/extensions/newsblog/content/Feed.js
--- a/mailnews/addrbook/prefs/content/pref-directory-add.js
+++ b/mailnews/addrbook/prefs/content/pref-directory-add.js
@@ -325,20 +325,25 @@ function onAccept()
 
     if (!errorValue) {
       // XXX Due to the LDAP c-sdk pass a dummy url to the IO service, then
       // update the parts (bug 473351).
       let ldapUrl = Services.io.newURI(
         (secure.checked ? "ldaps://" : "ldap://") + "localhost/dc=???")
         .QueryInterface(Ci.nsILDAPURL);
 
-      ldapUrl.host = hostname;
-      ldapUrl.port = port ? port :
-                            (secure.checked ? kDefaultSecureLDAPPort :
-                                              kDefaultLDAPPort);
+      let newPort = port ? port :
+                          (secure.checked ? kDefaultSecureLDAPPort :
+                                            kDefaultLDAPPort);
+      ldapUrl = ldapUrl.mutate()
+                       .setHost(hostname)
+                       .setPort(newPort)
+                       .finalize()
+                       .QueryInterface(Ci.nsILDAPURL);
+
       ldapUrl.dn = document.getElementById("basedn").value;
       ldapUrl.scope = document.getElementById("one").selected ?
                       Ci.nsILDAPURL.SCOPE_ONELEVEL :
                       Ci.nsILDAPURL.SCOPE_SUBTREE;
 
       ldapUrl.filter = document.getElementById("search").value;
       if (document.getElementById("GSSAPI").selected) {
         saslMechanism = "GSSAPI";
--- a/mailnews/extensions/newsblog/content/Feed.js
+++ b/mailnews/extensions/newsblog/content/Feed.js
@@ -31,17 +31,18 @@ var FeedCache =
       delete this.mFeeds[index];
   },
 
   normalizeHost: function (aUrl)
   {
     try
     {
       let normalizedUrl = Services.io.newURI(aUrl);
-      normalizedUrl.host = normalizedUrl.host.toLowerCase();
+      let newHost = host.toLowerCase();
+      normalizedUrl = normalizedUrl.mutate().setHost(newHost).finalize();
       return normalizedUrl.spec
     }
     catch (ex)
     {
       return aUrl;
     }
   }
 };