Bug 1355350 - doom incomplete cache entry when transfer is interrupted. r=rkent a=jorgk
authorJorg K <jorgk@jorgk.com>
Mon, 24 Apr 2017 08:37:33 +0200
changeset 27816 59ec25d91f5641ab8340c34305d7ed4ae64d00b2
parent 27815 01b588e5e9de4499a2484651caf8f688e4b5122e
child 27817 75634f13d8d726eeab24822f9cf48b50122fb698
push id1924
push usermozilla@jorgk.com
push dateTue, 25 Apr 2017 09:02:43 +0000
treeherdercomm-beta@75634f13d8d7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrkent, jorgk
bugs1355350
Bug 1355350 - doom incomplete cache entry when transfer is interrupted. r=rkent a=jorgk
mailnews/imap/src/nsImapProtocol.cpp
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -1310,16 +1310,17 @@ nsImapProtocol::TellThreadToDie()
 NS_IMETHODIMP
 nsImapProtocol::GetLastActiveTimeStamp(PRTime* aTimeStamp)
 {
   if (aTimeStamp)
     *aTimeStamp = m_lastActiveTime;
   return NS_OK;
 }
 
+static void DoomCacheEntry(nsIMsgMailNewsUrl *url);
 NS_IMETHODIMP
 nsImapProtocol::PseudoInterruptMsgLoad(nsIMsgFolder *aImapFolder, nsIMsgWindow *aMsgWindow, bool *interrupted)
 {
   NS_ENSURE_ARG (interrupted);
 
   *interrupted = false;
 
   PR_CEnterMonitor(this);
@@ -1342,16 +1343,18 @@ nsImapProtocol::PseudoInterruptMsgLoad(n
         nsCOMPtr <nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(runningImapURL);
         mailnewsUrl->GetMsgWindow(getter_AddRefs(msgWindow));
         mailnewsUrl->GetFolder(getter_AddRefs(runningImapFolder));
         if (aImapFolder == runningImapFolder && msgWindow == aMsgWindow)
         {
           PseudoInterrupt(true);
           *interrupted = true;
         }
+        // If we're interrupted, doom any incomplete cache entry.
+        DoomCacheEntry(mailnewsUrl);
       }
     }
   }
   PR_CExitMonitor(this);
 #ifdef DEBUG_bienvenu
   printf("interrupt msg load : %s\n", (*interrupted) ? "TRUE" : "FALSE");
 #endif
   return NS_OK;