From 1a423d62ea26e057ad933f39f3e70e200bdeab92 Mon Sep 17 00:00:00 2001 From: Joe Drew Date: Tue, 12 Mar 2013 18:13:40 -0400 Subject: [PATCH] Bug 850441 - Allow BlockOnload/UnblockOnload from both the current and pending request. r=khuey --HG-- extra : rebase_source : cd7bdc9f91b478be60fed5572dc8ee5e3faae380 --- content/base/src/nsImageLoadingContent.cpp | 28 ++++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/content/base/src/nsImageLoadingContent.cpp b/content/base/src/nsImageLoadingContent.cpp index 1d93317880f2..41deb7406d08 100644 --- a/content/base/src/nsImageLoadingContent.cpp +++ b/content/base/src/nsImageLoadingContent.cpp @@ -626,14 +626,18 @@ NS_IMETHODIMP nsImageLoadingContent::ForceReload() NS_IMETHODIMP nsImageLoadingContent::BlockOnload(imgIRequest* aRequest) { - if (aRequest != mCurrentRequest) { + if (aRequest == mCurrentRequest) { + NS_ASSERTION(!(mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD), + "Double BlockOnload!?"); + mCurrentRequestFlags |= REQUEST_BLOCKS_ONLOAD; + } else if (aRequest == mPendingRequest) { + NS_ASSERTION(!(mPendingRequestFlags & REQUEST_BLOCKS_ONLOAD), + "Double BlockOnload!?"); + mPendingRequestFlags |= REQUEST_BLOCKS_ONLOAD; + } else { return NS_OK; } - NS_ASSERTION(!(mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD), - "Double BlockOnload!?"); - mCurrentRequestFlags |= REQUEST_BLOCKS_ONLOAD; - nsIDocument* doc = GetOurCurrentDoc(); if (doc) { doc->BlockOnload(); @@ -645,14 +649,18 @@ nsImageLoadingContent::BlockOnload(imgIRequest* aRequest) NS_IMETHODIMP nsImageLoadingContent::UnblockOnload(imgIRequest* aRequest) { - if (aRequest != mCurrentRequest) { + if (aRequest == mCurrentRequest) { + NS_ASSERTION(mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD, + "Double UnblockOnload!?"); + mCurrentRequestFlags &= ~REQUEST_BLOCKS_ONLOAD; + } else if (aRequest == mPendingRequest) { + NS_ASSERTION(mPendingRequestFlags & REQUEST_BLOCKS_ONLOAD, + "Double UnblockOnload!?"); + mPendingRequestFlags &= ~REQUEST_BLOCKS_ONLOAD; + } else { return NS_OK; } - NS_ASSERTION(mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD, - "Double UnblockOnload!?"); - mCurrentRequestFlags &= ~REQUEST_BLOCKS_ONLOAD; - nsIDocument* doc = GetOurCurrentDoc(); if (doc) { doc->UnblockOnload(false);