Bug 1387320 - Port bug 1322874 to mailnews: Remove nsIURI.originCharset, implement SetQueryWithEncoding(). rs=bustage-fix
authorJorg K <jorgk@jorgk.com>
Fri, 04 Aug 2017 10:56:16 +0200
changeset 29462 6ee221481c59105262318b315a1c44f158ac8b17
parent 29461 22ff109c3fd2af384115364051290159bf25b840
child 29463 13e8fa67e60a3180c22702527f6f1079f290ce90
push id378
push userclokep@gmail.com
push dateMon, 13 Nov 2017 18:45:35 +0000
reviewersbustage-fix
bugs1387320, 1322874
Bug 1387320 - Port bug 1322874 to mailnews: Remove nsIURI.originCharset, implement SetQueryWithEncoding(). rs=bustage-fix
ldap/xpcom/src/nsLDAPURL.cpp
mailnews/addrbook/src/nsAddbookUrl.cpp
mailnews/base/util/nsMsgMailNewsUrl.cpp
mailnews/compose/src/nsSmtpUrl.cpp
--- a/ldap/xpcom/src/nsLDAPURL.cpp
+++ b/ldap/xpcom/src/nsLDAPURL.cpp
@@ -7,16 +7,17 @@
 #include "nsLDAPURL.h"
 #include "netCore.h"
 #include "plstr.h"
 #include "nsCOMPtr.h"
 #include "nsNetCID.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIStandardURL.h"
 #include "nsMsgUtils.h"
+#include "mozilla/Encoding.h"
 
 // The two schemes we support, LDAP and LDAPS
 //
 NS_NAMED_LITERAL_CSTRING(LDAP_SCHEME, "ldap");
 NS_NAMED_LITERAL_CSTRING(LDAP_SSL_SCHEME, "ldaps");
 
 NS_IMPL_ISUPPORTS(nsLDAPURL, nsILDAPURL, nsIURI)
 
@@ -344,24 +345,16 @@ NS_IMETHODIMP
 nsLDAPURL::GetAsciiHostPort(nsACString &_retval)
 {
   if (!mBaseURL)
     return NS_ERROR_NOT_INITIALIZED;
 
   return mBaseURL->GetAsciiHostPort(_retval);
 }
 
-NS_IMETHODIMP nsLDAPURL::GetOriginCharset(nsACString &result)
-{
-  if (!mBaseURL)
-    return NS_ERROR_NOT_INITIALIZED;
-
-  return mBaseURL->GetOriginCharset(result);
-}
-
 // boolean equals (in nsIURI other)
 // (based on nsSimpleURI::Equals)
 NS_IMETHODIMP nsLDAPURL::Equals(nsIURI *other, bool *_retval)
 {
   *_retval = false;
   if (other)
   {
     nsresult rv;
@@ -760,8 +753,14 @@ nsLDAPURL::GetQuery(nsACString &aQuery)
   return mBaseURL->GetQuery(aQuery);
 }
 
 NS_IMETHODIMP
 nsLDAPURL::SetQuery(const nsACString &aQuery)
 {
   return mBaseURL->SetQuery(aQuery);
 }
+
+NS_IMETHODIMP
+nsLDAPURL::SetQueryWithEncoding(const nsACString &aQuery, const mozilla::Encoding* aEncoding)
+{
+  return mBaseURL->SetQueryWithEncoding(aQuery, aEncoding);
+}
--- a/mailnews/addrbook/src/nsAddbookUrl.cpp
+++ b/mailnews/addrbook/src/nsAddbookUrl.cpp
@@ -5,16 +5,17 @@
 
 #include "nsIURI.h"
 #include "nsNetCID.h"
 #include "nsAddbookUrl.h"
 #include "nsString.h"
 #include "nsAbBaseCID.h"
 #include "nsComponentManagerUtils.h"
 #include "nsAutoPtr.h"
+#include "mozilla/Encoding.h"
 
 /////////////////////////////////////////////////////////////////////////////////////
 // addbook url definition
 /////////////////////////////////////////////////////////////////////////////////////
 nsAddbookUrl::nsAddbookUrl()
 {
   m_baseURL = do_CreateInstance(NS_SIMPLEURI_CONTRACTID);
 
@@ -162,21 +163,16 @@ NS_IMETHODIMP nsAddbookUrl::GetAsciiHost
   return m_baseURL->GetAsciiHostPort(aHostPortA);
 }
 
 NS_IMETHODIMP nsAddbookUrl::GetAsciiSpec(nsACString &aSpecA)
 {
   return m_baseURL->GetAsciiSpec(aSpecA);
 }
 
-NS_IMETHODIMP nsAddbookUrl::GetOriginCharset(nsACString &aOriginCharset)
-{
-    return m_baseURL->GetOriginCharset(aOriginCharset);
-}
-
 NS_IMETHODIMP nsAddbookUrl::SchemeIs(const char *aScheme, bool *_retval)
 {
   return m_baseURL->SchemeIs(aScheme, _retval);
 }
 
 NS_IMETHODIMP nsAddbookUrl::Equals(nsIURI *other, bool *_retval)
 {
   // The passed-in URI might be an nsMailtoUrl. Pass our inner URL to its
@@ -267,16 +263,22 @@ nsAddbookUrl::GetQuery(nsACString &aQuer
 }
 
 NS_IMETHODIMP
 nsAddbookUrl::SetQuery(const nsACString &aQuery)
 {
   return m_baseURL->SetQuery(aQuery);
 }
 
+NS_IMETHODIMP
+nsAddbookUrl::SetQueryWithEncoding(const nsACString &aQuery, const mozilla::Encoding* aEncoding)
+{
+  return m_baseURL->SetQueryWithEncoding(aQuery, aEncoding);
+}
+
 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
@@ -23,16 +23,17 @@
 #include "nsIFile.h"
 #include "prmem.h"
 #include <time.h>
 #include "nsMsgUtils.h"
 #include "mozilla/Services.h"
 #include <algorithm>
 #include "nsProxyRelease.h"
 #include "mozilla/BasePrincipal.h"
+#include "mozilla/Encoding.h"
 
 nsMsgMailNewsUrl::nsMsgMailNewsUrl()
 {
   // nsIURI specific state
   m_errorMessage = nullptr;
   m_runningUrl = false;
   m_updatingFolder = false;
   m_msgIsInLocalCache = false;
@@ -540,21 +541,16 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetAscii
   return m_baseURL->GetAsciiHostPort(aHostPortA);
 }
 
 NS_IMETHODIMP nsMsgMailNewsUrl::GetAsciiSpec(nsACString &aSpecA)
 {
     return m_baseURL->GetAsciiSpec(aSpecA);
 }
 
-NS_IMETHODIMP nsMsgMailNewsUrl::GetOriginCharset(nsACString &aOriginCharset)
-{
-    return m_baseURL->GetOriginCharset(aOriginCharset);
-}
-
 NS_IMETHODIMP nsMsgMailNewsUrl::GetBaseURI(nsIURI **aBaseURI)
 {
   NS_ENSURE_ARG_POINTER(aBaseURI);
   return m_baseURL->QueryInterface(NS_GET_IID(nsIURI), (void**) aBaseURI);
 }
 
 NS_IMETHODIMP nsMsgMailNewsUrl::Equals(nsIURI *other, bool *_retval)
 {
@@ -756,16 +752,22 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetQuery
   return m_baseURL->GetQuery(aQuery);
 }
 
 NS_IMETHODIMP nsMsgMailNewsUrl::SetQuery(const nsACString &aQuery)
 {
   return m_baseURL->SetQuery(aQuery);
 }
 
+NS_IMETHODIMP
+nsMsgMailNewsUrl::SetQueryWithEncoding(const nsACString &aQuery, const mozilla::Encoding* aEncoding)
+{
+  return m_baseURL->SetQueryWithEncoding(aQuery, aEncoding);
+}
+
 NS_IMETHODIMP nsMsgMailNewsUrl::GetRef(nsACString &aRef)
 {
   return m_baseURL->GetRef(aRef);
 }
 
 NS_IMETHODIMP nsMsgMailNewsUrl::SetRef(const nsACString &aRef)
 {
   return m_baseURL->SetRef(aRef);
--- a/mailnews/compose/src/nsSmtpUrl.cpp
+++ b/mailnews/compose/src/nsSmtpUrl.cpp
@@ -11,16 +11,17 @@
 #include "nsString.h"
 #include "nsMsgUtils.h"
 #include "nsIMimeConverter.h"
 #include "nsMsgMimeCID.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsCRT.h"
 #include "nsAutoPtr.h"
+#include "mozilla/Encoding.h"
 
 /////////////////////////////////////////////////////////////////////////////////////
 // mailto url definition
 /////////////////////////////////////////////////////////////////////////////////////
 nsMailtoUrl::nsMailtoUrl()
 {
   mFormat = nsIMsgCompFormat::Default;
   m_baseURL = do_CreateInstance(NS_SIMPLEURI_CONTRACTID);
@@ -498,21 +499,16 @@ NS_IMETHODIMP nsMailtoUrl::GetAsciiHostP
 	return m_baseURL->GetAsciiHostPort(aHostPortA);
 }
 
 NS_IMETHODIMP nsMailtoUrl::GetAsciiSpec(nsACString &aSpecA)
 {
 	return m_baseURL->GetAsciiSpec(aSpecA);
 }
 
-NS_IMETHODIMP nsMailtoUrl::GetOriginCharset(nsACString &aOriginCharset)
-{
-    return m_baseURL->GetOriginCharset(aOriginCharset);
-}
-
 NS_IMETHODIMP nsMailtoUrl::SchemeIs(const char *aScheme, bool *_retval)
 {
 	return m_baseURL->SchemeIs(aScheme, _retval);
 }
 
 NS_IMETHODIMP nsMailtoUrl::Equals(nsIURI *other, bool *_retval)
 {
   // The passed-in URI might be an nsMailtoUrl. Pass our inner URL to its
@@ -642,16 +638,22 @@ nsMailtoUrl::GetQuery(nsACString &aQuery
 }
 
 NS_IMETHODIMP
 nsMailtoUrl::SetQuery(const nsACString &aQuery)
 {
   return m_baseURL->SetQuery(aQuery);
 }
 
+NS_IMETHODIMP
+nsMailtoUrl::SetQueryWithEncoding(const nsACString &aQuery, const mozilla::Encoding* aEncoding)
+{
+  return m_baseURL->SetQueryWithEncoding(aQuery, aEncoding);
+}
+
 /////////////////////////////////////////////////////////////////////////////////////
 // smtp url definition
 /////////////////////////////////////////////////////////////////////////////////////
 
 nsSmtpUrl::nsSmtpUrl() : nsMsgMailNewsUrl()
 {
   // nsISmtpUrl specific state...