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 efb2bde0845ca1dad5712bc41534ff1f914726d1..49a8cfbfddf11320a29348b0d5cda3ecb3e3342e 100644 |
--- a/third_party/WebKit/Source/core/loader/ImageLoader.cpp |
+++ b/third_party/WebKit/Source/core/loader/ImageLoader.cpp |
@@ -359,7 +359,6 @@ void ImageLoader::DoUpdateFromElement(BypassMainWorldBehavior bypass_behavior, |
} |
image_ = new_image; |
- has_pending_load_event_ = new_image; |
image_complete_ = !new_image; |
delay_until_image_notify_finished_ = nullptr; |
hiroshige
2017/05/05 19:58:31
Previous: has_pending_load_event_ == true iff new_
|
@@ -515,12 +514,8 @@ void ImageLoader::ImageNotifyFinished(ImageResourceContent* resource) { |
ToSVGImage(image_->GetImage()) |
->UpdateUseCounters(GetElement()->GetDocument()); |
- if (loading_image_document_) { |
- CHECK(!has_pending_load_event_); |
+ if (loading_image_document_) |
return; |
- } |
- |
- CHECK(has_pending_load_event_); |
hiroshige
2017/05/05 19:58:31
Previous: We assert has_pending_load_event_ == tru
|
if (resource->ErrorOccurred()) { |
LoadEventSender().CancelEvent(this); |
@@ -543,6 +538,7 @@ void ImageLoader::ImageNotifyFinished(ImageResourceContent* resource) { |
UpdatedHasPendingEvent(); |
return; |
} |
+ has_pending_load_event_ = true; |
LoadEventSender().DispatchEventSoon(this); |
} |
@@ -589,7 +585,8 @@ void ImageLoader::UpdatedHasPendingEvent() { |
// such an Element wishes for the load to stop when removed from the DOM it |
// needs to stop the ImageLoader explicitly. |
bool was_protected = element_is_protected_; |
- element_is_protected_ = has_pending_load_event_ || has_pending_error_event_; |
+ element_is_protected_ = (image_ && !image_complete_) || |
+ has_pending_load_event_ || has_pending_error_event_; |
if (was_protected == element_is_protected_) |
return; |
@@ -625,6 +622,7 @@ void ImageLoader::DispatchPendingLoadEvent() { |
return; |
CHECK(image_complete_); |
has_pending_load_event_ = false; |
+ CHECK(image_complete_); |
if (GetElement()->GetDocument().GetFrame()) |
DispatchLoadEvent(); |