Bug 1057175. If ReadSegments returns a failure code it might not send any data to RasterImage, so check for return value. r=seth
authorTimothy Nikkel <tnikkel@gmail.com>
Sat, 23 Aug 2014 23:47:55 -0500
changeset 222939 5cc6986dffdeee2481a13643c1c9d72b4e669ee3
parent 222938 fbd0bffddd86ceda2987d83927311443f0101d12
child 222940 bdc4a4fe462ffa522f7773e0ec53699c3a47a94d
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth
bugs1057175
milestone34.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 1057175. If ReadSegments returns a failure code it might not send any data to RasterImage, so check for return value. r=seth We can hit this if the input stream gets closed before we can read from it. In the case I debugged the image was removed from the DOM (by having it's containing document removed from the DOM) so it's request was cancelled. ReadSegments on a closed stream (at least a cache file input stream) just returns and does nothing.
image/src/RasterImage.cpp
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -1817,18 +1817,19 @@ RasterImage::OnImageDataAvailable(nsIReq
 {
   nsresult rv;
 
   // WriteToRasterImage always consumes everything it gets
   // if it doesn't run out of memory
   uint32_t bytesRead;
   rv = aInStr->ReadSegments(WriteToRasterImage, this, aCount, &bytesRead);
 
-  NS_ABORT_IF_FALSE(bytesRead == aCount || HasError(),
-    "WriteToRasterImage should consume everything or the image must be in error!");
+  NS_ABORT_IF_FALSE(bytesRead == aCount || HasError() || NS_FAILED(rv),
+    "WriteToRasterImage should consume everything if ReadSegments succeeds or "
+    "the image must be in error!");
 
   return rv;
 }
 
 nsresult
 RasterImage::OnNewSourceData()
 {
   MOZ_ASSERT(NS_IsMainThread());