Bug 570914 - fetch message completely before forwarding. r=jorgk
authorfvroman <fvroman@linagora.com>
Wed, 19 Apr 2017 09:19:00 +0200
changeset 21473 819f6281ca932a8aa27efae50aa7546f692f5cf7
parent 21472 3757d3096b68317300bcd08290977a06ef9cdf91
child 21474 c2f926700d44bf7679afd85e9ba483f76de55259
push id13069
push usermozilla@jorgk.com
push dateTue, 25 Apr 2017 09:36:58 +0000
treeherdercomm-central@819f6281ca93 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
bugs570914
Bug 570914 - fetch message completely before forwarding. r=jorgk
mailnews/compose/src/nsMsgComposeService.cpp
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -994,16 +994,20 @@ nsMsgComposeService::ForwardMessage(cons
   nsCString msgUri;
 
   nsCOMPtr<nsIMsgFolder> folder;
   aMsgHdr->GetFolder(getter_AddRefs(folder));
   NS_ENSURE_TRUE(folder, NS_ERROR_NULL_POINTER);
 
   folder->GetUriForMsg(aMsgHdr, msgUri);
 
+  nsAutoCString uriToOpen(msgUri);
+  uriToOpen += (uriToOpen.FindChar('?') == kNotFound) ? '?' : '&';
+  uriToOpen.Append("fetchCompleteMessage=true");
+
   // get the MsgIdentity for the above key using AccountManager
   nsCOMPtr<nsIMsgAccountManager> accountManager =
     do_GetService (NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIMsgAccount> account;
   nsCOMPtr<nsIMsgIdentity> identity;
 
@@ -1013,20 +1017,20 @@ nsMsgComposeService::ForwardMessage(cons
   // Use default identity if no identity has been found on this account
   if (NS_FAILED(rv) || !identity)
   {
     rv = GetDefaultIdentity(getter_AddRefs(identity));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   if (aForwardType == nsIMsgComposeService::kForwardInline)
-    return RunMessageThroughMimeDraft(msgUri,
+    return RunMessageThroughMimeDraft(uriToOpen,
                                       nsMimeOutput::nsMimeMessageDraftOrTemplate,
                                       identity,
-                                      msgUri.get(), aMsgHdr,
+                                      uriToOpen.get(), aMsgHdr,
                                       true, forwardTo,
                                       false, aMsgWindow);
 
   nsCOMPtr<mozIDOMWindowProxy> parentWindow;
   if (aMsgWindow)
   {
     nsCOMPtr<nsIDocShell> docShell;
     rv = aMsgWindow->GetRootDocShell(getter_AddRefs(docShell));
@@ -1040,17 +1044,17 @@ nsMsgComposeService::ForwardMessage(cons
   nsCOMPtr<nsIMsgCompFields> compFields = do_CreateInstance(NS_MSGCOMPFIELDS_CONTRACTID, &rv);
 
   compFields->SetTo(forwardTo);
   // populate the compose params
   pMsgComposeParams->SetType(nsIMsgCompType::ForwardAsAttachment);
   pMsgComposeParams->SetFormat(nsIMsgCompFormat::Default);
   pMsgComposeParams->SetIdentity(identity);
   pMsgComposeParams->SetComposeFields(compFields);
-  pMsgComposeParams->SetOriginalMsgURI(msgUri.get());
+  pMsgComposeParams->SetOriginalMsgURI(uriToOpen.get());
   // create the nsIMsgCompose object to send the object
   nsCOMPtr<nsIMsgCompose> pMsgCompose (do_CreateInstance(NS_MSGCOMPOSE_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   /** initialize nsIMsgCompose, Send the message, wait for send completion response **/
   rv = pMsgCompose->Initialize(pMsgComposeParams, parentWindow, nullptr);
   NS_ENSURE_SUCCESS(rv, rv);