Bug 1328814 - Don't insist on folder validity when creating an nsIURI object. r=rkent,jorgk a=jorgk
authorJorg K and R Kent James
Mon, 09 Jan 2017 15:59:00 +0100
changeset 27763 0582ed45b68a28fc582175f39ee99d61b03a6401
parent 27762 4508615d66d8ebb573e3121f0b1d31fb315a91b3
child 27764 860c7c33482aae8fa5deaab92795330d33dfebfb
child 27766 fb67eca27dc6b235cada9c0d1d5b826365421a78
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrkent, jorgk, jorgk
bugs1328814
Bug 1328814 - Don't insist on folder validity when creating an nsIURI object. r=rkent,jorgk a=jorgk
mailnews/imap/src/nsImapService.cpp
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -2574,30 +2574,35 @@ NS_IMETHODIMP nsImapService::NewURI(cons
   NS_ENSURE_TRUE(server, NS_ERROR_FAILURE);
 
   // now try to get the folder in question...
   nsCOMPtr<nsIMsgFolder> rootFolder;
   server->GetRootFolder(getter_AddRefs(rootFolder));
   if (rootFolder && !folderName.IsEmpty())
   {
     nsCOMPtr<nsIMsgFolder> folder;
-    nsCOMPtr<nsIMsgImapMailFolder> imapRoot = do_QueryInterface(rootFolder, &rv);
+    nsCOMPtr<nsIMsgImapMailFolder> imapRoot = do_QueryInterface(rootFolder);
     nsCOMPtr<nsIMsgImapMailFolder> subFolder;
     if (imapRoot)
     {
       imapRoot->FindOnlineSubFolder(folderName, getter_AddRefs(subFolder));
-      folder = do_QueryInterface(subFolder, &rv);
+      folder = do_QueryInterface(subFolder);
     }
-    if (NS_SUCCEEDED(rv))
+
+    // If we can't find the folder, we can still create the URI
+    // in this low-level service. Cloning URIs where the folder
+    // isn't found is common when folders are renamed or moved.
+    // We also ignore return statuses here.
+    if (folder)
     {
       nsCOMPtr<nsIImapMessageSink> msgSink = do_QueryInterface(folder);
-      rv = aImapUrl->SetImapMessageSink(msgSink);
+      (void) aImapUrl->SetImapMessageSink(msgSink);
 
       nsCOMPtr<nsIMsgFolder> msgFolder = do_QueryInterface(folder);
-      rv = SetImapUrlSink(msgFolder, aImapUrl);
+      (void) SetImapUrlSink(msgFolder, aImapUrl);
 
       nsCString messageIdString;
       aImapUrl->GetListOfMessageIds(messageIdString);
       if (!messageIdString.IsEmpty())
       {
         bool useLocalCache = false;
         msgFolder->HasMsgOffline(atoi(messageIdString.get()), &useLocalCache);
         mailnewsUrl->SetMsgIsInLocalCache(useLocalCache);