More Tp regression-fixing for bug 11011. r=biesi, pending sr=roc

This commit is contained in:
bzbarsky%mit.edu 2005-09-18 21:06:19 +00:00
parent 6c0a21415d
commit e7a8cf11ab
2 changed files with 16 additions and 0 deletions

View File

@ -97,6 +97,7 @@ nsImageLoadingContent::nsImageLoadingContent()
: mObserverList(nsnull),
mImageBlockingStatus(nsIContentPolicy::ACCEPT),
mLoadingEnabled(PR_TRUE),
mStartingLoad(PR_FALSE),
// mBroken starts out true, since an image without a URI is broken....
mBroken(PR_TRUE),
mUserDisabled(PR_FALSE),
@ -518,6 +519,15 @@ nsImageLoadingContent::ImageState() const
void
nsImageLoadingContent::UpdateImageState(PRBool aNotify)
{
if (mStartingLoad) {
// Ignore this call; we'll update our state when the state changer is
// destroyed. Need this to work around the fact that some libpr0n stuff is
// actually sync and hence we can get OnStopDecode called while we're still
// under ImageURIChanged, and OnStopDecode doesn't know anything about
// aNotify
return;
}
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(this);
if (!thisContent) {
return;
@ -564,6 +574,7 @@ nsImageLoadingContent::CancelImageRequests(PRBool aNotify)
// Make sure to null out mCurrentURI here, so we no longer look like an image
mCurrentURI = nsnull;
CancelImageRequests(NS_BINDING_ABORTED, PR_TRUE, nsIContentPolicy::ACCEPT);
NS_ASSERTION(!mStartingLoad, "Whence a state changer here?");
UpdateImageState(aNotify);
}

View File

@ -140,9 +140,13 @@ private:
mImageContent(aImageContent),
mNotify(aNotify)
{
NS_ASSERTION(!mImageContent->mStartingLoad,
"Nested AutoStateChangers somehow?");
mImageContent->mStartingLoad = PR_TRUE;
}
~AutoStateChanger()
{
mImageContent->mStartingLoad = PR_FALSE;
mImageContent->UpdateImageState(mNotify);
}
@ -222,6 +226,7 @@ private:
PRInt16 mImageBlockingStatus;
PRPackedBool mLoadingEnabled : 1;
PRPackedBool mStartingLoad : 1;
/**
* The state we had the last time we checked whether we needed to notify the