From 42d8ee76ab35b64d9c2e13722f6da71d41e75dbb Mon Sep 17 00:00:00 2001 From: Andrew Osmond Date: Fri, 10 Feb 2017 08:33:11 -0500 Subject: [PATCH] Bug 1290293 - Part 2f. Assert there is no frame on the finish decoding error path. r=tnikkel --- image/Decoder.cpp | 7 ++++++- image/decoders/nsICODecoder.cpp | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/image/Decoder.cpp b/image/Decoder.cpp index d6633e63f371..da24766c069f 100644 --- a/image/Decoder.cpp +++ b/image/Decoder.cpp @@ -380,7 +380,12 @@ Decoder::AllocateFrameInternal(uint32_t aFrameNum, nsresult Decoder::InitInternal() { return NS_OK; } nsresult Decoder::BeforeFinishInternal() { return NS_OK; } nsresult Decoder::FinishInternal() { return NS_OK; } -nsresult Decoder::FinishWithErrorInternal() { return NS_OK; } + +nsresult Decoder::FinishWithErrorInternal() +{ + MOZ_ASSERT(!mInFrame); + return NS_OK; +} /* * Progress Notifications diff --git a/image/decoders/nsICODecoder.cpp b/image/decoders/nsICODecoder.cpp index 8791d67396ec..f56f800a0f95 100644 --- a/image/decoders/nsICODecoder.cpp +++ b/image/decoders/nsICODecoder.cpp @@ -79,6 +79,8 @@ nsICODecoder::FinishInternal() nsresult nsICODecoder::FinishWithErrorInternal() { + // No need to assert !mInFrame here because this condition is enforced by + // mContainedDecoder. return GetFinalStateFromContainedDecoder(); }