fix for bug 671675, a=standard8
authorDavid Bienvenu <bienvenu@nventure.com>
Wed, 27 Jul 2011 15:10:09 -0700
changeset 8154 58ab4ae9a089ce5a0767474c0d53932734c14d6f
parent 8153 12b3fc9c38d05f0cc9d6a7ac9d31771c6fde0222
child 8155 aaa0212de46822f8152aff2d641c6ef40d4f032a
push id79
push userbienvenu@nventure.com
push dateWed, 27 Jul 2011 22:09:59 +0000
treeherdercomm-aurora@58ab4ae9a089 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8
bugs671675
fix for bug 671675, a=standard8
mailnews/base/src/nsMsgDBView.cpp
mailnews/imap/src/nsImapMailFolder.cpp
--- a/mailnews/base/src/nsMsgDBView.cpp
+++ b/mailnews/base/src/nsMsgDBView.cpp
@@ -1660,17 +1660,18 @@ NS_IMETHODIMP nsMsgDBView::IsSeparator(P
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgDBView::GetParentIndex(PRInt32 rowIndex, PRInt32 *_retval)
 {
   *_retval = -1;
 
   PRInt32 rowIndexLevel;
-  GetLevel(rowIndex, &rowIndexLevel);
+  nsresult rv = GetLevel(rowIndex, &rowIndexLevel);
+  NS_ENSURE_SUCCESS(rv, rv);
 
   PRInt32 i;
   for(i = rowIndex; i >= 0; i--)
   {
     PRInt32 l;
     GetLevel(i, &l);
     if (l < rowIndexLevel)
     {
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -7332,24 +7332,27 @@ nsresult nsImapMailFolder::CopyMessagesO
   msgHdrsCopied->GetLength(&numHdrs);
   if (numHdrs)
   {
     nsCOMPtr<nsIMsgFolderNotificationService> notifier(do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID));
     if (notifier)
       notifier->NotifyMsgsMoveCopyCompleted(isMove, msgHdrsCopied, this, destMsgHdrs);
   }
 
-  if (isMove && (deleteToTrash || deleteImmediately))
-    sourceMailDB->DeleteMessages(keysToDelete.Length(), keysToDelete.Elements(), nsnull);
+  if (isMove && NS_SUCCEEDED(rv) && (deleteToTrash || deleteImmediately))
+    sourceMailDB->DeleteMessages(keysToDelete.Length(), keysToDelete.Elements(),
+                                 nsnull);
 
   nsCOMPtr<nsISupports> srcSupport = do_QueryInterface(srcFolder);
   OnCopyCompleted(srcSupport, rv);
 
-  if (NS_SUCCEEDED(rv) && isMove)
-    srcFolder->NotifyFolderEvent(mDeleteOrMoveMsgCompletedAtom);
+  if (isMove)
+    srcFolder->NotifyFolderEvent(NS_SUCCEEDED(rv) ?
+                                 mDeleteOrMoveMsgCompletedAtom :
+                                 mDeleteOrMoveMsgFailedAtom);
   return rv;
 }
 
 void nsImapMailFolder::SetPendingAttributes(nsIArray* messages, PRBool aIsMove)
 {
 
   GetDatabase();
   if (!mDatabase)
@@ -7491,20 +7494,22 @@ nsImapMailFolder::CopyMessages(nsIMsgFol
   // in theory, if allowUndo is true, then this is a user initiated
   // action, and we should do it pseudo-offline. If it's not
   // user initiated (e.g., mail filters firing), then allowUndo is
   // false, and we should just do the action.
   if (!WeAreOffline() && sameServer && allowUndo) 
   {
     // complete the copy operation as in offline mode
     rv = CopyMessagesOffline(srcFolder, messages, isMove, msgWindow, listener);
-    
-    NS_ENSURE_SUCCESS(rv,rv);
-  
-    // XXX ebirol
+
+    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "error offline copy");
+    // We'll warn if this fails, but we should still try to play back
+    // offline ops, because it's possible the copy got far enough to
+    // create the offline ops.
+
     // We make sure that the source folder is an imap folder by limiting pseudo-offline 
     // operations to the same imap server. If we extend the code to cover non imap folders 
     // in the future (i.e. imap folder->local folder), then the following downcast
     // will cause either a crash or compiler error. Do not forget to change it accordingly.
     nsImapMailFolder *srcImapFolder = static_cast<nsImapMailFolder*>(srcFolder);
     
     // lazily create playback timer if it is not already
     // created