Bug 1550945 - Part 6: Fix LDAP tests. rs=bustage-fix
authorJorg K <jorgk@jorgk.com>
Thu, 30 May 2019 00:22:54 +0200
changeset 35718 25cf997ee8125588f9314e16310bf75c1544868a
parent 35717 dc1bb61bd604986f473371224723e0ab041093dd
child 35719 f3f918aef481478ead0a6ee94467b43f0e90cb5e
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersbustage-fix
bugs1550945
Bug 1550945 - Part 6: Fix LDAP tests. rs=bustage-fix
mailnews/base/util/nsNewMailnewsURI.cpp
--- a/mailnews/base/util/nsNewMailnewsURI.cpp
+++ b/mailnews/base/util/nsNewMailnewsURI.cpp
@@ -47,23 +47,24 @@ nsresult NS_NewMailnewsURI(nsIURI** aURI
   }
   if (scheme.EqualsLiteral("cid")) {
     return nsCidProtocolHandler::NewURI(aSpec, aCharset, aBaseURI, aURI);
   }
   if (scheme.EqualsLiteral("addbook")) {
     return nsAddbookProtocolHandler::NewURI(aSpec, aCharset, aBaseURI, aURI);
   }
   if (scheme.EqualsLiteral("ldap") || scheme.EqualsLiteral("ldaps")) {
-    rv = NS_MutateURI(new nsLDAPURL::Mutator()).SetSpec(aSpec).Finalize(aURI);
+    nsCOMPtr<nsILDAPURL> url = do_CreateInstance(NS_LDAPURL_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
-    nsCOMPtr<nsILDAPURL> url(do_QueryInterface(*aURI));
-    NS_ENSURE_TRUE(url, NS_ERROR_UNEXPECTED);
-    return url->Init(nsIStandardURL::URLTYPE_STANDARD,
-                     scheme.EqualsLiteral("ldap") ? 389 : 636, aSpec, aCharset,
-                     aBaseURI);
+    rv = url->Init(nsIStandardURL::URLTYPE_STANDARD,
+                   scheme.EqualsLiteral("ldap") ? 389 : 636, aSpec, aCharset,
+                   aBaseURI);
+    NS_ENSURE_SUCCESS(rv, rv);
+    url.forget(aURI);
+    return NS_OK;
   }
   if (scheme.EqualsLiteral("smile")) {
     ;  // Fall through.
   }
   if (scheme.EqualsLiteral("moz-cal-handle-itip")) {
     return NS_MutateURI(new mozilla::net::nsStandardURL::Mutator())
         .SetSpec(aSpec)
         .Finalize(aURI);