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

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: Created 5 years, 9 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
Index: Source/core/loader/ImageLoader.cpp
diff --git a/Source/core/loader/ImageLoader.cpp b/Source/core/loader/ImageLoader.cpp
index 3c0d8b679fdac3776145ae9c6e980eae03d51343..147db3536a8078aa7498915b4d61e58b5745402b 100644
--- a/Source/core/loader/ImageLoader.cpp
+++ b/Source/core/loader/ImageLoader.cpp
@@ -353,6 +353,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);
}

Powered by Google App Engine
This is Rietveld 408576698