fix 736782, no download now link with partially downloaded pop3 messages, r=mscott
authorDavid Bienvenu <bienvenu@nventure.com>
Thu, 19 Apr 2012 07:21:49 -0700
changeset 11669 2fe9dc371bfda34127f2e767b688c52a53345e7c
parent 11668 6e7dfba5f1afd5c304960ae8ed12b5be37497032
child 11670 26c2c8008156966302f82799f2d74ade4cafe3de
push idunknown
push userunknown
push dateunknown
reviewersmscott
bugs736782
fix 736782, no download now link with partially downloaded pop3 messages, r=mscott
mailnews/local/src/nsMailboxService.cpp
--- a/mailnews/local/src/nsMailboxService.cpp
+++ b/mailnews/local/src/nsMailboxService.cpp
@@ -571,35 +571,35 @@ NS_IMETHODIMP nsMailboxService::GetProto
 
 NS_IMETHODIMP nsMailboxService::NewURI(const nsACString &aSpec,
                                        const char *aOriginCharset,
                                        nsIURI *aBaseURI,
                                        nsIURI **_retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
   *_retval = 0;
-  nsresult rv = NS_OK;
+  nsresult rv;
   nsCOMPtr<nsIURI> aMsgUri = do_CreateInstance(NS_MAILBOXURL_CONTRACTID, &rv);
-
-  if (NS_SUCCEEDED(rv))
+  NS_ENSURE_SUCCESS(rv, rv);
+  // SetSpec calls below may fail if the mailbox url is of the form
+  // mailbox://<account>/<mailbox name>?... instead of
+  // mailbox://<path to folder>?.... This is the case for pop3 download urls.
+  // We know this, and the failure is harmless.
+  if (aBaseURI)
   {
-    if (aBaseURI)
-    {
-      nsCAutoString newSpec;
-      rv = aBaseURI->Resolve(aSpec, newSpec);
-      NS_ENSURE_SUCCESS(rv, rv);
-      rv = aMsgUri->SetSpec(newSpec);
-    }
-    else
-    {
-      rv = aMsgUri->SetSpec(aSpec);
-    }
+    nsCAutoString newSpec;
+    rv = aBaseURI->Resolve(aSpec, newSpec);
     NS_ENSURE_SUCCESS(rv, rv);
-    aMsgUri.swap(*_retval);
+    (void) aMsgUri->SetSpec(newSpec);
   }
+  else
+  {
+    (void) aMsgUri->SetSpec(aSpec);
+  }
+  aMsgUri.swap(*_retval);
 
   return rv;
 }
 
 NS_IMETHODIMP nsMailboxService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
 {
   NS_ENSURE_ARG_POINTER(aURI);
   NS_ENSURE_ARG_POINTER(_retval);