Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1321)

Unified Diff: Source/core/loader/ImageLoader.cpp

Issue 113633005: Cancel load event on a failed image resource fetch. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test for broken images Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/http/tests/misc/image-onerror-no-load-event-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/ImageLoader.cpp
diff --git a/Source/core/loader/ImageLoader.cpp b/Source/core/loader/ImageLoader.cpp
index a8177ba48d59bf7fe79cc7d41c22cdbe68588f9c..8659c5ad118de1f2e5344eb2615a7ea8b9740f65 100644
--- a/Source/core/loader/ImageLoader.cpp
+++ b/Source/core/loader/ImageLoader.cpp
@@ -291,7 +291,18 @@ void ImageLoader::notifyFinished(Resource* resource)
updatedHasPendingEvent();
return;
}
+ if (resource->errorOccurred()) {
+ loadEventSender().cancelEvent(this);
+ m_hasPendingLoadEvent = false;
+
+ m_hasPendingErrorEvent = true;
+ errorEventSender().dispatchEventSoon(this);
+ // 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();
+ return;
+ }
loadEventSender().dispatchEventSoon(this);
}
« no previous file with comments | « LayoutTests/http/tests/misc/image-onerror-no-load-event-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698