diff options
Diffstat (limited to 'Source/WebCore/loader/ImageLoader.cpp')
-rw-r--r-- | Source/WebCore/loader/ImageLoader.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Source/WebCore/loader/ImageLoader.cpp b/Source/WebCore/loader/ImageLoader.cpp index f4d1209f0..e897f8a4e 100644 --- a/Source/WebCore/loader/ImageLoader.cpp +++ b/Source/WebCore/loader/ImageLoader.cpp @@ -125,6 +125,15 @@ inline Document* ImageLoader::document() void ImageLoader::setImage(CachedImage* newImage) { + setImageWithoutConsideringPendingLoadEvent(newImage); + + // Only consider updating the protection ref-count of the Element immediately before returning + // from this function as doing so might result in the destruction of this ImageLoader. + updatedHasPendingLoadEvent(); +} + +void ImageLoader::setImageWithoutConsideringPendingLoadEvent(CachedImage* newImage) +{ ASSERT(m_failedLoadURL.isEmpty()); CachedImage* oldImage = m_image.get(); if (newImage != oldImage) { @@ -150,10 +159,6 @@ void ImageLoader::setImage(CachedImage* newImage) if (RenderImageResource* imageResource = renderImageResource()) imageResource->resetAnimation(); - - // Only consider updating the protection ref-count of the Element immediately before returning - // from this function as doing so might result in the destruction of this ImageLoader. - updatedHasPendingLoadEvent(); } void ImageLoader::updateFromElement() @@ -263,7 +268,7 @@ void ImageLoader::notifyFinished(CachedResource* resource) && !document()->securityOrigin()->canRequest(image()->response().url()) && !resource->passesAccessControlCheck(document()->securityOrigin())) { - setImage(0); + setImageWithoutConsideringPendingLoadEvent(0); m_hasPendingErrorEvent = true; errorEventSender().dispatchEventSoon(this); @@ -272,6 +277,10 @@ void ImageLoader::notifyFinished(CachedResource* resource) document()->addConsoleMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage); ASSERT(!m_hasPendingLoadEvent); + + // Only consider updating the protection ref-count of the Element immediately before returning + // from this function as doing so might result in the destruction of this ImageLoader. + updatedHasPendingLoadEvent(); return; } |