Bug 1368464 - Don't attempt to copy multipart image as file promise. r=tnikkel
authorHector Zhao <bzhao@mozilla.com>
Mon, 05 Jun 2017 16:06:15 +0800
changeset 410504 5176b60155271526be427f6e3ef90e3f2ea8bf2f
parent 410503 337dfcb8c30a2088899608c4437d9e065ce910b5
child 410505 978581ff6bf41d89d911efab7c2a6798c4eae7b8
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1368464
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1368464 - Don't attempt to copy multipart image as file promise. r=tnikkel MozReview-Commit-ID: 1pwwZwBNb23
dom/base/nsCopySupport.cpp
--- a/dom/base/nsCopySupport.cpp
+++ b/dom/base/nsCopySupport.cpp
@@ -597,16 +597,23 @@ static nsresult AppendImagePromise(nsITr
   uint32_t imageStatus;
   rv = aImgRequest->GetImageStatus(&imageStatus);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!(imageStatus & imgIRequest::STATUS_FRAME_COMPLETE) ||
       (imageStatus & imgIRequest::STATUS_ERROR)) {
     return NS_OK;
   }
 
+  bool isMultipart;
+  rv = aImgRequest->GetMultipart(&isMultipart);
+  NS_ENSURE_SUCCESS(rv, rv);
+  if (isMultipart) {
+    return NS_OK;
+  }
+
   nsCOMPtr<nsINode> node = do_QueryInterface(aImageElement, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Fix the file extension in the URL if necessary
   nsCOMPtr<nsIMIMEService> mimeService =
     do_GetService(NS_MIMESERVICE_CONTRACTID);
   NS_ENSURE_TRUE(mimeService, NS_OK);