fix 736782, no download now link with partially downloaded pop3 messages, r+a=Standard8
authorDavid Bienvenu <bienvenu@nventure.com>
Thu, 19 Apr 2012 07:21:49 -0700
changeset 11253 bd2c19647e4d0812a38437f3d530f6b4881fbf14
parent 11252 3ac782de680a8ebeb2ff9178b7fab9206ba0adfc
child 11254 bbd6494a2ec44b9e78979f2d94e10e8b676a70b7
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs736782
fix 736782, no download now link with partially downloaded pop3 messages, r+a=Standard8
mailnews/local/src/nsMailboxService.cpp
--- a/mailnews/local/src/nsMailboxService.cpp
+++ b/mailnews/local/src/nsMailboxService.cpp
@@ -575,35 +575,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);