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

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

Issue 2893993002: Make ImageLoader have at most one pending error event on EventSender (Closed)
Patch Set: Add comment Created 3 years, 7 months 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 | « third_party/WebKit/LayoutTests/images/multiple-inflight-error-event-crash.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/ImageLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/ImageLoader.cpp b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
index d1bf60bbf24ab085b06a6ac0df22fe195118f243..2a2d79f9fc6e0a756db1f2333174bac1643da6e7 100644
--- a/third_party/WebKit/Source/core/loader/ImageLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
@@ -273,6 +273,13 @@ static void ConfigureRequest(
}
inline void ImageLoader::DispatchErrorEvent() {
+ // There can be cases where DispatchErrorEvent() is called when there is
+ // already a scheduled error event for the previous load attempt.
+ // In such cases we cancel the previous event and then re-schedule a new
+ // error event here. crbug.com/722500
+ if (has_pending_error_event_)
+ ErrorEventSender().CancelEvent(this);
+
has_pending_error_event_ = true;
ErrorEventSender().DispatchEventSoon(this);
}
@@ -679,12 +686,7 @@ void ImageLoader::DispatchPendingLoadEvent() {
}
void ImageLoader::DispatchPendingErrorEvent() {
- // Currently this if condition is needed because there can be multiple
- // in-flight error event tasks and we process only the first here.
- // crbug.com/722500
- // TODO(hiroshige): Replace this with |CHECK(has_pending_load_event_)|.
- if (!has_pending_error_event_)
- return;
+ CHECK(has_pending_error_event_);
has_pending_error_event_ = false;
if (GetElement()->GetDocument().GetFrame())
« no previous file with comments | « third_party/WebKit/LayoutTests/images/multiple-inflight-error-event-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698