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

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

Issue 1047803005: Allow the "img.src='';img.src='.." idiom to clear down images immediately. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 5 years, 8 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 | « LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-null-src-load-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 767c9d22abbd153c0576a0d6cd416793cc8e5ff8..d87bcf5712d241df1d4e75084224bbd618ba91cb 100644
--- a/Source/core/loader/ImageLoader.cpp
+++ b/Source/core/loader/ImageLoader.cpp
@@ -356,6 +356,14 @@ void ImageLoader::updateFromElement(UpdateFromElementBehavior updateBehavior)
doUpdateFromElement(DoNotBypassMainWorldCSP, updateBehavior);
return;
}
+ // Allow the idiom "img.src=''; img.src='.." to clear down the image before
+ // an asynchronous load completes.
+ if (imageSourceURL.isEmpty()) {
+ ImageResource* image = m_image.get();
+ if (image)
+ image->removeClient(this);
+ m_image = nullptr;
+ }
enqueueImageLoadingMicroTask(updateBehavior);
}
« no previous file with comments | « LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-null-src-load-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698