Bug 1550945 - Part 1: nsIProtocolHandler::NewURI() no longer exists. rs=bustage-fix
authorJorg K <jorgk@jorgk.com>
Wed, 29 May 2019 09:46:07 +0200
changeset 35701 0326ae4cf85da366cc057042780275c03f4aa1f7
parent 35700 c999415db730294e7cc75c8e509ad1818695978c
child 35702 ac121e4bba12a4b47de324c7d0653124ff8d3cb8
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersbustage-fix
bugs1550945
Bug 1550945 - Part 1: nsIProtocolHandler::NewURI() no longer exists. rs=bustage-fix
mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
mailnews/addrbook/src/nsAddbookProtocolHandler.h
mailnews/base/src/nsCidProtocolHandler.cpp
mailnews/base/src/nsCidProtocolHandler.h
mailnews/compose/src/nsSmtpService.cpp
mailnews/compose/src/nsSmtpService.h
mailnews/imap/src/nsImapService.cpp
mailnews/imap/src/nsImapService.h
mailnews/local/src/nsMailboxService.cpp
mailnews/local/src/nsMailboxService.h
mailnews/local/src/nsPop3Service.cpp
mailnews/local/src/nsPop3Service.h
mailnews/news/src/nsNntpService.cpp
mailnews/news/src/nsNntpService.h
--- a/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
+++ b/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
@@ -43,17 +43,17 @@ NS_IMETHODIMP nsAddbookProtocolHandler::
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAddbookProtocolHandler::GetProtocolFlags(uint32_t *aUritype) {
   *aUritype = URI_STD | URI_LOADABLE_BY_ANYONE | URI_FORBIDS_COOKIE_ACCESS;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsAddbookProtocolHandler::NewURI(
+nsresult nsAddbookProtocolHandler::NewURI(
     const nsACString &aSpec,
     const char *aOriginCharset,  // ignored
     nsIURI *aBaseURI, nsIURI **_retval) {
   nsresult rv;
   nsCOMPtr<nsIURI> uri;
   rv = NS_MutateURI(new nsAddbookUrl::Mutator()).SetSpec(aSpec).Finalize(uri);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/mailnews/addrbook/src/nsAddbookProtocolHandler.h
+++ b/mailnews/addrbook/src/nsAddbookProtocolHandler.h
@@ -11,16 +11,19 @@
 #include "nsAddbookProtocolHandler.h"
 #include "nsIProtocolHandler.h"
 #include "nsIAddbookUrl.h"
 #include "nsIAbDirectory.h"
 
 class nsAddbookProtocolHandler : public nsIProtocolHandler {
  public:
   nsAddbookProtocolHandler();
+  nsresult NewURI(const nsACString &aSpec,
+                  const char *aOriginCharset,  // ignored
+                  nsIURI *aBaseURI, nsIURI **_retval);
 
   NS_DECL_ISUPPORTS
 
   //////////////////////////////////////////////////////////////////////////
   // We support the nsIProtocolHandler interface.
   //////////////////////////////////////////////////////////////////////////
   NS_DECL_NSIPROTOCOLHANDLER
 
--- a/mailnews/base/src/nsCidProtocolHandler.cpp
+++ b/mailnews/base/src/nsCidProtocolHandler.cpp
@@ -24,19 +24,19 @@ NS_IMETHODIMP nsCidProtocolHandler::GetD
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsCidProtocolHandler::GetProtocolFlags(uint32_t *aProtocolFlags) {
   // XXXbz so why does this protocol handler exist, exactly?
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-NS_IMETHODIMP nsCidProtocolHandler::NewURI(const nsACString &aSpec,
-                                           const char *aOriginCharset,
-                                           nsIURI *aBaseURI, nsIURI **_retval) {
+nsresult nsCidProtocolHandler::NewURI(const nsACString &aSpec,
+                                      const char *aOriginCharset,
+                                      nsIURI *aBaseURI, nsIURI **_retval) {
   // the right fix is to use the baseSpec (or aBaseUri)
   // and specify the cid, and then fix mime
   // to handle that, like it does with "...&part=1.2"
   // for now, do about blank to prevent spam
   // from popping up annoying alerts about not implementing the cid
   // protocol
   nsCOMPtr<nsIURI> url;
   nsresult rv = NS_NewURI(getter_AddRefs(url), "about:blank");
--- a/mailnews/base/src/nsCidProtocolHandler.h
+++ b/mailnews/base/src/nsCidProtocolHandler.h
@@ -8,16 +8,18 @@
 
 #include "nsCOMPtr.h"
 #include "nsIProtocolHandler.h"
 
 class nsCidProtocolHandler : public nsIProtocolHandler {
  public:
   nsCidProtocolHandler();
 
+  nsresult NewURI(const nsACString &aSpec, const char *aOriginCharset,
+                  nsIURI *aBaseURI, nsIURI **_retval);
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPROTOCOLHANDLER
 
  private:
   virtual ~nsCidProtocolHandler();
 };
 
 #endif /* nsCidProtocolHandler_h__ */
--- a/mailnews/compose/src/nsSmtpService.cpp
+++ b/mailnews/compose/src/nsSmtpService.cpp
@@ -255,17 +255,17 @@ NS_IMETHODIMP nsSmtpService::GetProtocol
   *result = URI_NORELATIVE | ALLOWS_PROXY | URI_LOADABLE_BY_ANYONE |
             URI_NON_PERSISTABLE | URI_DOES_NOT_RETURN_DATA |
             URI_FORBIDS_COOKIE_ACCESS;
   return NS_OK;
 }
 
 // the smtp service is also the protocol handler for mailto urls....
 
-NS_IMETHODIMP nsSmtpService::NewURI(
+nsresult nsSmtpService::NewURI(
     const nsACString &aSpec,
     const char *aOriginCharset,  // ignored, always UTF-8.
     nsIURI *aBaseURI, nsIURI **_retval) {
   // get a new smtp url
   nsresult rv;
 
   nsCOMPtr<nsIURI> mailtoUrl;
   rv = NS_MutateURI(new nsMailtoUrl::Mutator())
--- a/mailnews/compose/src/nsSmtpService.h
+++ b/mailnews/compose/src/nsSmtpService.h
@@ -18,17 +18,19 @@
 // to urls easier. I'm not sure if this service will go away when the new
 // networking model comes on line (as part of the N2 project). So I reserve the
 // right to change my mind and take this service away =).
 ////////////////////////////////////////////////////////////////////////////////////////
 
 class nsSmtpService : public nsISmtpService, public nsIProtocolHandler {
  public:
   nsSmtpService();
-
+  nsresult NewURI(const nsACString &aSpec,
+                  const char *aOriginCharset,  // ignored, always UTF-8.
+                  nsIURI *aBaseURI, nsIURI **_retval);
   NS_DECL_ISUPPORTS
 
   ////////////////////////////////////////////////////////////////////////
   // we support the nsISmtpService interface
   ////////////////////////////////////////////////////////////////////////
   NS_DECL_NSISMTPSERVICE
 
   //////////////////////////////////////////////////////////////////////////
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -2366,19 +2366,19 @@ nsresult nsImapService::GetServerFromUrl
     if (*aServer) aImapUrl->SetExternalLinkUrl(true);
   }
 
   // if we can't extract the imap server from this url then give up!!!
   NS_ENSURE_TRUE(*aServer, NS_ERROR_FAILURE);
   return rv;
 }
 
-NS_IMETHODIMP nsImapService::NewURI(const nsACString &aSpec,
-                                    const char *aOriginCharset,  // ignored
-                                    nsIURI *aBaseURI, nsIURI **aRetVal) {
+nsresult nsImapService::NewURI(const nsACString &aSpec,
+                               const char *aOriginCharset,  // ignored
+                               nsIURI *aBaseURI, nsIURI **aRetVal) {
   NS_ENSURE_ARG_POINTER(aRetVal);
 
   nsresult rv;
   nsCOMPtr<nsIImapUrl> aImapUrl = do_CreateInstance(kImapUrlCID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // now extract lots of fun information...
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(aImapUrl);
--- a/mailnews/imap/src/nsImapService.h
+++ b/mailnews/imap/src/nsImapService.h
@@ -23,16 +23,19 @@ class nsIMsgIncomingServer;
 class nsImapService : public nsIImapService,
                       public nsIMsgMessageService,
                       public nsIMsgMessageFetchPartService,
                       public nsIProtocolHandler,
                       public nsIMsgProtocolInfo,
                       public nsIContentHandler {
  public:
   nsImapService();
+  nsresult NewURI(const nsACString &aSpec,
+                  const char *aOriginCharset,  // ignored
+                  nsIURI *aBaseURI, nsIURI **aRetVal);
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIMSGPROTOCOLINFO
   NS_DECL_NSIIMAPSERVICE
   NS_DECL_NSIMSGMESSAGESERVICE
   NS_DECL_NSIPROTOCOLHANDLER
   NS_DECL_NSIMSGMESSAGEFETCHPARTSERVICE
   NS_DECL_NSICONTENTHANDLER
--- a/mailnews/local/src/nsMailboxService.cpp
+++ b/mailnews/local/src/nsMailboxService.cpp
@@ -497,19 +497,19 @@ NS_IMETHODIMP nsMailboxService::GetProto
             URI_DANGEROUS_TO_LOAD | URI_FORBIDS_COOKIE_ACCESS
 #ifdef IS_ORIGIN_IS_FULL_SPEC_DEFINED
             | ORIGIN_IS_FULL_SPEC
 #endif
       ;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsMailboxService::NewURI(const nsACString &aSpec,
-                                       const char *aOriginCharset,
-                                       nsIURI *aBaseURI, nsIURI **_retval) {
+nsresult nsMailboxService::NewURI(const nsACString &aSpec,
+                                  const char *aOriginCharset, nsIURI *aBaseURI,
+                                  nsIURI **_retval) {
   NS_ENSURE_ARG_POINTER(_retval);
   *_retval = 0;
   nsresult rv;
   nsCOMPtr<nsIMsgMailNewsUrl> aMsgUri =
       do_CreateInstance(NS_MAILBOXURL_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   // SetSpecInternal must not fail, or else the URL won't have a base URL and
   // we'll crash later.
@@ -538,18 +538,17 @@ NS_IMETHODIMP nsMailboxService::NewChann
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (spec.Find("?uidl=") >= 0 || spec.Find("&uidl=") >= 0) {
     nsCOMPtr<nsIProtocolHandler> handler =
         do_GetService(NS_POP3SERVICE_CONTRACTID1, &rv);
     if (NS_SUCCEEDED(rv)) {
       nsCOMPtr<nsIURI> pop3Uri;
 
-      rv = handler->NewURI(spec, "" /* ignored */, aURI,
-                           getter_AddRefs(pop3Uri));
+      rv = NewURI(spec, "" /* ignored */, aURI, getter_AddRefs(pop3Uri));
       NS_ENSURE_SUCCESS(rv, rv);
       return handler->NewChannel(pop3Uri, aLoadInfo, _retval);
     }
   }
 
   RefPtr<nsMailboxProtocol> protocol = new nsMailboxProtocol(aURI);
   if (!protocol) {
     return NS_ERROR_OUT_OF_MEMORY;
--- a/mailnews/local/src/nsMailboxService.h
+++ b/mailnews/local/src/nsMailboxService.h
@@ -19,16 +19,18 @@
 #include "nsIProtocolHandler.h"
 
 class nsMailboxService : public nsIMailboxService,
                          public nsIMsgMessageService,
                          public nsIMsgMessageFetchPartService,
                          public nsIProtocolHandler {
  public:
   nsMailboxService();
+  nsresult NewURI(const nsACString &aSpec, const char *aOriginCharset,
+                  nsIURI *aBaseURI, nsIURI **_retval);
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIMAILBOXSERVICE
   NS_DECL_NSIMSGMESSAGESERVICE
   NS_DECL_NSIMSGMESSAGEFETCHPARTSERVICE
   NS_DECL_NSIPROTOCOLHANDLER
 
  protected:
--- a/mailnews/local/src/nsPop3Service.cpp
+++ b/mailnews/local/src/nsPop3Service.cpp
@@ -270,19 +270,19 @@ NS_IMETHODIMP nsPop3Service::GetDefaultD
 
 NS_IMETHODIMP nsPop3Service::GetProtocolFlags(uint32_t *result) {
   NS_ENSURE_ARG_POINTER(result);
   *result = URI_NORELATIVE | URI_DANGEROUS_TO_LOAD | ALLOWS_PROXY |
             URI_FORBIDS_COOKIE_ACCESS;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsPop3Service::NewURI(const nsACString &aSpec,
-                                    const char *aOriginCharset,  // ignored
-                                    nsIURI *aBaseURI, nsIURI **_retval) {
+nsresult nsPop3Service::NewURI(const nsACString &aSpec,
+                               const char *aOriginCharset,  // ignored
+                               nsIURI *aBaseURI, nsIURI **_retval) {
   NS_ENSURE_ARG_POINTER(_retval);
 
   nsAutoCString folderUri(aSpec);
   int32_t offset = folderUri.FindChar('?');
   if (offset != kNotFound) folderUri.SetLength(offset);
 
   const char *uidl = PL_strstr(nsCString(aSpec).get(), "uidl=");
   NS_ENSURE_TRUE(uidl, NS_ERROR_FAILURE);
--- a/mailnews/local/src/nsPop3Service.h
+++ b/mailnews/local/src/nsPop3Service.h
@@ -16,16 +16,19 @@
 
 class nsIMsgMailNewsUrl;
 
 class nsPop3Service : public nsIPop3Service,
                       public nsIProtocolHandler,
                       public nsIMsgProtocolInfo {
  public:
   nsPop3Service();
+  nsresult NewURI(const nsACString &aSpec,
+                  const char *aOriginCharset,  // ignored
+                  nsIURI *aBaseURI, nsIURI **_retval);
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPOP3SERVICE
   NS_DECL_NSIPROTOCOLHANDLER
   NS_DECL_NSIMSGPROTOCOLINFO
 
  protected:
   virtual ~nsPop3Service();
--- a/mailnews/news/src/nsNntpService.cpp
+++ b/mailnews/news/src/nsNntpService.cpp
@@ -1146,19 +1146,19 @@ NS_IMETHODIMP nsNntpService::GetProtocol
 #ifdef IS_ORIGIN_IS_FULL_SPEC_DEFINED
               | ORIGIN_IS_FULL_SPEC
 #endif
       ;
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsNntpService::NewURI(const nsACString &aSpec,
-                                    const char *aCharset,  // ignored
-                                    nsIURI *aBaseURI, nsIURI **_retval) {
+nsresult nsNntpService::NewURI(const nsACString &aSpec,
+                               const char *aCharset,  // ignored
+                               nsIURI *aBaseURI, nsIURI **_retval) {
   nsresult rv;
 
   nsCOMPtr<nsIMsgMailNewsUrl> nntpUri =
       do_CreateInstance(NS_NNTPURL_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (aBaseURI) {
     nsAutoCString newSpec;
--- a/mailnews/news/src/nsNntpService.h
+++ b/mailnews/news/src/nsNntpService.h
@@ -37,16 +37,19 @@ class nsNntpService : public nsINntpServ
   NS_DECL_NSIPROTOCOLHANDLER
   NS_DECL_NSIMSGPROTOCOLINFO
   NS_DECL_NSICONTENTHANDLER
   NS_DECL_NSIMSGMESSAGEFETCHPARTSERVICE
   NS_DECL_NSICOMMANDLINEHANDLER
 
   // nsNntpService
   nsNntpService();
+  nsresult NewURI(const nsACString &aSpec,
+                  const char *aCharset,  // ignored
+                  nsIURI *aBaseURI, nsIURI **_retval);
 
  protected:
   virtual ~nsNntpService();
 
   nsresult GetNntpServerByAccount(const char *aAccountKey,
                                   nsIMsgIncomingServer **aNntpServer);
   nsresult SetUpNntpUrlForPosting(const char *aAccountKey, char **newsUrlSpec);
   nsresult FindHostFromGroup(nsCString &host, nsCString &groupName);