Bug 1522847 - Port bug 1522596: Remove reference to nsIIPCSerializableURI and implement Serialize() for AB, mailto and LDAP URLs. r=mkmelin
authorJorg K <jorgk@jorgk.com>
Fri, 25 Jan 2019 22:54:30 +0100
changeset 33451 bfa78ee4ab64
parent 33450 3c26a13818d0
child 33452 0396f1f1c7a7
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)
reviewersmkmelin
bugs1522847, 1522596
Bug 1522847 - Port bug 1522596: Remove reference to nsIIPCSerializableURI and implement Serialize() for AB, mailto and LDAP URLs. r=mkmelin
ldap/xpcom/src/nsLDAPURL.cpp
mailnews/addrbook/src/nsAddbookUrl.cpp
mailnews/base/util/nsMsgMailNewsUrl.cpp
mailnews/base/util/nsMsgMailNewsUrl.h
mailnews/compose/src/nsSmtpUrl.cpp
--- a/ldap/xpcom/src/nsLDAPURL.cpp
+++ b/ldap/xpcom/src/nsLDAPURL.cpp
@@ -718,16 +718,22 @@ nsresult nsLDAPURL::SetQuery(const nsACS
   return NS_MutateURI(mBaseURL).SetQuery(aQuery).Finalize(mBaseURL);
 }
 
 nsresult nsLDAPURL::SetQueryWithEncoding(const nsACString &aQuery, const mozilla::Encoding* aEncoding)
 {
   return NS_MutateURI(mBaseURL).SetQueryWithEncoding(aQuery, aEncoding).Finalize(mBaseURL);
 }
 
+NS_IMETHODIMP_(void)
+nsLDAPURL::Serialize(mozilla::ipc::URIParams &aParams)
+{
+  mBaseURL->Serialize(aParams);
+}
+
 NS_IMPL_ISUPPORTS(nsLDAPURL::Mutator, nsIURISetters, nsIURIMutator)
 
 NS_IMETHODIMP
 nsLDAPURL::Mutate(nsIURIMutator** aMutator)
 {
   RefPtr<nsLDAPURL::Mutator> mutator = new nsLDAPURL::Mutator();
   nsresult rv = mutator->InitFromURI(this);
   if (NS_FAILED(rv)) {
--- a/mailnews/addrbook/src/nsAddbookUrl.cpp
+++ b/mailnews/addrbook/src/nsAddbookUrl.cpp
@@ -235,16 +235,22 @@ nsresult nsAddbookUrl::SetQuery(const ns
   return NS_MutateURI(m_baseURL).SetQuery(aQuery).Finalize(m_baseURL);
 }
 
 nsresult nsAddbookUrl::SetQueryWithEncoding(const nsACString &aQuery, const mozilla::Encoding* aEncoding)
 {
   return NS_MutateURI(m_baseURL).SetQueryWithEncoding(aQuery, aEncoding).Finalize(m_baseURL);
 }
 
+NS_IMETHODIMP_(void)
+nsAddbookUrl::Serialize(mozilla::ipc::URIParams &aParams)
+{
+  m_baseURL->Serialize(aParams);
+}
+
 NS_IMETHODIMP nsAddbookUrl::EqualsExceptRef(nsIURI *other, bool *_retval)
 {
   // The passed-in URI might be an nsMailtoUrl. Pass our inner URL to its
   // Equals method. The other nsMailtoUrl will then pass its inner URL to
   // to the Equals method of our inner URL. Other URIs will return false.
   if (other)
     return other->EqualsExceptRef(m_baseURL, _retval);
 
--- a/mailnews/base/util/nsMsgMailNewsUrl.cpp
+++ b/mailnews/base/util/nsMsgMailNewsUrl.cpp
@@ -80,34 +80,29 @@ NS_IMPL_RELEASE(nsMsgMailNewsUrl)
 // origin should not QI to nsIURIWithSpecialOrigin.
 NS_INTERFACE_MAP_BEGIN(nsMsgMailNewsUrl)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMsgMailNewsUrl)
   NS_INTERFACE_MAP_ENTRY(nsIMsgMailNewsUrl)
   NS_INTERFACE_MAP_ENTRY(nsIURL)
   NS_INTERFACE_MAP_ENTRY(nsIURI)
   NS_INTERFACE_MAP_ENTRY(nsISerializable)
   NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
-  NS_INTERFACE_MAP_ENTRY(nsIIPCSerializableURI)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIURIWithSpecialOrigin, m_hasNormalizedOrigin)
 NS_INTERFACE_MAP_END
 
 //--------------------------
 // Support for serialization
 //--------------------------
 // nsMsgMailNewsUrl is only partly serialized by serializing the "base URL"
 // which is an nsStandardURL, or by only serializing the Spec. This may
 // cause problems in the future. See bug 1512356 and bug 1515337 for details,
 // follow-up in bug 1512698.
 
-//----------------------------------
-// Support for nsIIPCSerializableURI
-//----------------------------------
-void nsMsgMailNewsUrl::Serialize(mozilla::ipc::URIParams &aParams) {
-  nsCOMPtr<nsIIPCSerializableURI> serializable = do_QueryInterface(m_baseURL);
-  return serializable->Serialize(aParams);
+NS_IMETHODIMP_(void) nsMsgMailNewsUrl::Serialize(mozilla::ipc::URIParams &aParams) {
+  m_baseURL->Serialize(aParams);
 }
 
 //----------------------------
 // Support for nsISerializable
 //----------------------------
 NS_IMETHODIMP nsMsgMailNewsUrl::Read(nsIObjectInputStream *stream) {
   nsAutoCString urlstr;
   nsresult rv = NS_ReadOptionalCString(stream, urlstr);
--- a/mailnews/base/util/nsMsgMailNewsUrl.h
+++ b/mailnews/base/util/nsMsgMailNewsUrl.h
@@ -23,46 +23,43 @@
 #include "nsICacheEntry.h"
 #include "nsICacheSession.h"
 #include "nsIMimeMiscStatus.h"
 #include "nsIWeakReferenceUtils.h"
 #include "nsString.h"
 #include "nsIURIMutator.h"
 #include "nsISerializable.h"
 #include "nsIClassInfo.h"
-#include "nsIIPCSerializableURI.h"
 
 ///////////////////////////////////////////////////////////////////////////////////
 // Okay, I found that all of the mail and news url interfaces needed to support
 // several common interfaces (in addition to those provided through nsIURI).
 // So I decided to group them all in this implementation so we don't have to
 // duplicate the code.
 //
 //////////////////////////////////////////////////////////////////////////////////
 
 #undef  IMETHOD_VISIBILITY
 #define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT
 
 class NS_MSG_BASE nsMsgMailNewsUrl : public nsIMsgMailNewsUrl,
                                      public nsIURIWithSpecialOrigin,
                                      public nsISerializable,
-                                     public nsIClassInfo,
-                                     public nsIIPCSerializableURI
+                                     public nsIClassInfo
 {
 public:
     nsMsgMailNewsUrl();
 
     NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIMSGMAILNEWSURL
     NS_DECL_NSIURI
     NS_DECL_NSIURL
     NS_DECL_NSIURIWITHSPECIALORIGIN
     NS_DECL_NSISERIALIZABLE
     NS_DECL_NSICLASSINFO
-    NS_DECL_NSIIPCSERIALIZABLEURI
 
 protected:
   virtual nsresult Clone(nsIURI **_retval);
   virtual nsresult SetScheme(const nsACString &aScheme);
   virtual nsresult SetUserPass(const nsACString &aUserPass);
   virtual nsresult SetUsername(const nsACString &aUsername);
   virtual nsresult SetPassword(const nsACString &aPassword);
   virtual nsresult SetHostPort(const nsACString &aHostPort);
--- a/mailnews/compose/src/nsSmtpUrl.cpp
+++ b/mailnews/compose/src/nsSmtpUrl.cpp
@@ -624,16 +624,22 @@ nsresult nsMailtoUrl::SetQuery(const nsA
   return NS_MutateURI(m_baseURL).SetQuery(aQuery).Finalize(m_baseURL);
 }
 
 nsresult nsMailtoUrl::SetQueryWithEncoding(const nsACString &aQuery, const mozilla::Encoding* aEncoding)
 {
   return NS_MutateURI(m_baseURL).SetQueryWithEncoding(aQuery, aEncoding).Finalize(m_baseURL);
 }
 
+NS_IMETHODIMP_(void)
+nsMailtoUrl::Serialize(mozilla::ipc::URIParams &aParams)
+{
+  m_baseURL->Serialize(aParams);
+}
+
 NS_IMPL_ISUPPORTS(nsMailtoUrl::Mutator, nsIURISetters, nsIURIMutator)
 
 NS_IMETHODIMP
 nsMailtoUrl::Mutate(nsIURIMutator** aMutator)
 {
   RefPtr<nsMailtoUrl::Mutator> mutator = new nsMailtoUrl::Mutator();
   nsresult rv = mutator->InitFromURI(this);
   if (NS_FAILED(rv)) {