diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 8b67b8ea980..206a82a52b6 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -320,8 +320,8 @@ nsImageFrame::Init(nsIPresContext* aPresContext, PRBool loadBlocked = PR_FALSE; imageLoader->GetImageBlocked(&loadBlocked); - rv = loadBlocked ? NS_ERROR_IMAGE_BLOCKED : NS_ERROR_FAILURE; - HandleLoadError(rv, presShell); + HandleLoadError(loadBlocked ? NS_ERROR_IMAGE_BLOCKED : NS_ERROR_FAILURE, + presShell); } return rv; @@ -1902,7 +1902,7 @@ nsresult nsImageFrame::LoadIcons(nsIPresContext *aPresContext) #ifdef NOISY_ICON_LOADING printf( "Allocating IconLoad (%p)\n", this); #endif - mIconLoad = new IconLoad(aPresContext); + mIconLoad = new IconLoad(aPresContext, mListener); if (!mIconLoad) return NS_ERROR_OUT_OF_MEMORY; doLoad = PR_TRUE; diff --git a/layout/generic/nsImageFrame.h b/layout/generic/nsImageFrame.h index 28f15382b86..4011326a428 100644 --- a/layout/generic/nsImageFrame.h +++ b/layout/generic/nsImageFrame.h @@ -277,8 +277,9 @@ private: // private class that wraps the data and logic needed for // broken image and loading image icons public: - IconLoad(nsIPresContext *aPresContext) + IconLoad(nsIPresContext *aPresContext, imgIDecoderObserver* aObserver) : mRefCount(0), + mLoadObserver(aObserver), mIconsLoaded(PR_FALSE) { GetPrefs(aPresContext); @@ -306,6 +307,7 @@ private: #define NS_ICON_BROKEN_IMAGE (1) public: struct SingleIconLoad mIconLoads[2]; + nsCOMPtr mLoadObserver; // keeps the observer alive PRPackedBool mIconsLoaded; PRPackedBool mPrefForceInlineAltText; PRPackedBool mPrefAllImagesBlocked; diff --git a/layout/html/base/src/nsImageFrame.cpp b/layout/html/base/src/nsImageFrame.cpp index 8b67b8ea980..206a82a52b6 100644 --- a/layout/html/base/src/nsImageFrame.cpp +++ b/layout/html/base/src/nsImageFrame.cpp @@ -320,8 +320,8 @@ nsImageFrame::Init(nsIPresContext* aPresContext, PRBool loadBlocked = PR_FALSE; imageLoader->GetImageBlocked(&loadBlocked); - rv = loadBlocked ? NS_ERROR_IMAGE_BLOCKED : NS_ERROR_FAILURE; - HandleLoadError(rv, presShell); + HandleLoadError(loadBlocked ? NS_ERROR_IMAGE_BLOCKED : NS_ERROR_FAILURE, + presShell); } return rv; @@ -1902,7 +1902,7 @@ nsresult nsImageFrame::LoadIcons(nsIPresContext *aPresContext) #ifdef NOISY_ICON_LOADING printf( "Allocating IconLoad (%p)\n", this); #endif - mIconLoad = new IconLoad(aPresContext); + mIconLoad = new IconLoad(aPresContext, mListener); if (!mIconLoad) return NS_ERROR_OUT_OF_MEMORY; doLoad = PR_TRUE; diff --git a/layout/html/base/src/nsImageFrame.h b/layout/html/base/src/nsImageFrame.h index 28f15382b86..4011326a428 100644 --- a/layout/html/base/src/nsImageFrame.h +++ b/layout/html/base/src/nsImageFrame.h @@ -277,8 +277,9 @@ private: // private class that wraps the data and logic needed for // broken image and loading image icons public: - IconLoad(nsIPresContext *aPresContext) + IconLoad(nsIPresContext *aPresContext, imgIDecoderObserver* aObserver) : mRefCount(0), + mLoadObserver(aObserver), mIconsLoaded(PR_FALSE) { GetPrefs(aPresContext); @@ -306,6 +307,7 @@ private: #define NS_ICON_BROKEN_IMAGE (1) public: struct SingleIconLoad mIconLoads[2]; + nsCOMPtr mLoadObserver; // keeps the observer alive PRPackedBool mIconsLoaded; PRPackedBool mPrefForceInlineAltText; PRPackedBool mPrefAllImagesBlocked;