Bug 609406 - don't block image inserted into reply. r=mkmelin
authorJorg K <jorgk@jorgk.com>
Thu, 26 Jan 2017 07:53:39 +0100
changeset 21061 06666873a81d1b12cd0f82cf8406015499db1609
parent 21060 c59a7076fb4f9427516ad8b55469f9e8f0d51f79
child 21062 d289a51e1fcd544c7f38646030167fca8d17c731
push id12788
push usermozilla@jorgk.com
push dateThu, 26 Jan 2017 06:58:55 +0000
treeherdercomm-central@ccb3cee77ef2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs609406
Bug 609406 - don't block image inserted into reply. r=mkmelin
mailnews/base/src/nsMsgContentPolicy.cpp
--- a/mailnews/base/src/nsMsgContentPolicy.cpp
+++ b/mailnews/base/src/nsMsgContentPolicy.cpp
@@ -618,40 +618,30 @@ void nsMsgContentPolicy::ComposeShouldLo
     nsCOMPtr<nsIMsgDBHdr> msgHdr;
     rv = GetMsgDBHdrFromURI(originalMsgURI.get(), getter_AddRefs(msgHdr));
     NS_ENSURE_SUCCESS_VOID(rv);
     *aDecision = ShouldAcceptRemoteContentForMsgHdr(msgHdr, nullptr,
                                                     aContentLocation);
 
     // Special case image elements. When replying to a message, we want to allow
     // the user to add remote images to the message. But we don't want remote
-    // images that are a part of the quoted content to load. Fortunately, after
-    // the quoted message has been inserted into the document, mail compose
-    // flags remote content elements that came from the original message with a
-    // moz-do-not-send attribute.
+    // images that are a part of the quoted content to load. Hence we block them
+    // while the reply is created (insertingQuotedContent==true), but allow them
+    // later when the user inserts them.
     if (*aDecision == nsIContentPolicy::REJECT_REQUEST)
     {
       bool insertingQuotedContent = true;
       aMsgCompose->GetInsertingQuotedContent(&insertingQuotedContent);
       nsCOMPtr<nsIDOMHTMLImageElement> imageElement(do_QueryInterface(aRequestingContext));
       if (imageElement)
       {
         if (!insertingQuotedContent)
         {
-          nsCOMPtr<nsIDOMElement> element(do_QueryInterface(imageElement));
-          if (element)
-          {
-            bool doNotSendAttrib;
-            if (NS_SUCCEEDED(element->HasAttribute(NS_LITERAL_STRING("moz-do-not-send"), &doNotSendAttrib)) &&
-                !doNotSendAttrib)
-            {
-              *aDecision = nsIContentPolicy::ACCEPT;
-              return;
-            }
-          }
+          *aDecision = nsIContentPolicy::ACCEPT;
+          return;
         }
 
         // Test whitelist.
         uint32_t permission;
         mPermissionManager->TestPermission(aContentLocation, "image", &permission);
         if (permission == nsIPermissionManager::ALLOW_ACTION)
           *aDecision = nsIContentPolicy::ACCEPT;
       }