| 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..b77da6eaa1a43952275152d5eadba8f6dc5052b3 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;
|
|
|
| @@ -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_);
|
|
|
| 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;
|
|
|
|
|