summaryrefslogtreecommitdiff
path: root/Source/WebCore/loader/ImageLoader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/loader/ImageLoader.cpp')
-rw-r--r--Source/WebCore/loader/ImageLoader.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/WebCore/loader/ImageLoader.cpp b/Source/WebCore/loader/ImageLoader.cpp
index e2247d254..c717f915c 100644
--- a/Source/WebCore/loader/ImageLoader.cpp
+++ b/Source/WebCore/loader/ImageLoader.cpp
@@ -407,10 +407,9 @@ void ImageLoader::dispatchPendingLoadEvent()
return;
if (!m_image)
return;
- if (!document()->attached())
- return;
m_hasPendingLoadEvent = false;
- dispatchLoadEvent();
+ if (document()->attached())
+ dispatchLoadEvent();
// 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.
@@ -421,10 +420,13 @@ void ImageLoader::dispatchPendingErrorEvent()
{
if (!m_hasPendingErrorEvent)
return;
- if (!document()->attached())
- return;
m_hasPendingErrorEvent = false;
- client()->imageElement()->dispatchEvent(Event::create(eventNames().errorEvent, false, false));
+ if (document()->attached())
+ client()->imageElement()->dispatchEvent(Event::create(eventNames().errorEvent, false, false));
+
+ // 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.
+ updatedHasPendingEvent();
}
void ImageLoader::dispatchPendingBeforeLoadEvents()