From aff61943d7c7c01bd998ca661703c5250959b96e Mon Sep 17 00:00:00 2001 From: Joe Drew Date: Fri, 22 Mar 2013 18:46:20 -0400 Subject: [PATCH] Bug 853390 - Notify our listeners after creating decoders to ensure onload is correctly blocked. r=seth --HG-- extra : rebase_source : f846da6a01b95e2ba389689bb97cb9242fa09a4f --- image/src/RasterImage.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index 254651197b87..4dd468a06da8 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -2808,8 +2808,12 @@ RasterImage::RequestDecodeCore(RequestDecodeType aDecodeType) // If we don't have a decoder, create one if (!mDecoder) { rv = InitDecoder(/* aDoSizeDecode = */ false); - CONTAINER_ENSURE_SUCCESS(rv); + + rv = FinishedSomeDecoding(); + CONTAINER_ENSURE_SUCCESS(rv); + + MOZ_ASSERT(mDecoder); } // If we've read all the data we have, we're done @@ -2907,16 +2911,10 @@ RasterImage::SyncDecode() mDecoder->FlushInvalidations(); mInDecoder = false; - // If we finished the decode, shutdown the decoder - if (mDecoder && IsDecodeFinished()) { - // We have to shut down the decoder *now*, so we explicitly shut down the - // decoder, and let FinishedSomeDecoding handle the rest for us. - nsRefPtr request = mDecodeRequest; - nsresult rv = ShutdownDecoder(eShutdownIntent_Done); - CONTAINER_ENSURE_SUCCESS(rv); - rv = FinishedSomeDecoding(eShutdownIntent_Done, request); - CONTAINER_ENSURE_SUCCESS(rv); - } else if (mDecoder) { + rv = FinishedSomeDecoding(); + CONTAINER_ENSURE_SUCCESS(rv); + + if (mDecoder) { mDecoder->SetSynchronous(false); }