Title: [215574] trunk/Source/WebCore
- Revision
- 215574
- Author
- commit-qu...@webkit.org
- Date
- 2017-04-20 13:09:47 -0700 (Thu, 20 Apr 2017)
Log Message
CachedImage should cancel loading images for unsupported/unknown types
https://bugs.webkit.org/show_bug.cgi?id=170697
Patch by Said Abou-Hallawa <sabouhall...@apple.com> on 2017-04-20
Reviewed by Youenn Fablet.
Currently when the image decoder detects an error with the incoming encoded
data of an image, we mark the image to be a broken image. But the network
process keeps feeding the web process with the rest of the data. We should
cancel loading the rest of the data to save network bandwidth and CPU time
loading and processing useless data.
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::addIncrementalDataBuffer):
(WebCore::CachedImage::finishLoading):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (215573 => 215574)
--- trunk/Source/WebCore/ChangeLog 2017-04-20 19:59:46 UTC (rev 215573)
+++ trunk/Source/WebCore/ChangeLog 2017-04-20 20:09:47 UTC (rev 215574)
@@ -1,3 +1,20 @@
+2017-04-20 Said Abou-Hallawa <sabouhall...@apple.com>
+
+ CachedImage should cancel loading images for unsupported/unknown types
+ https://bugs.webkit.org/show_bug.cgi?id=170697
+
+ Reviewed by Youenn Fablet.
+
+ Currently when the image decoder detects an error with the incoming encoded
+ data of an image, we mark the image to be a broken image. But the network
+ process keeps feeding the web process with the rest of the data. We should
+ cancel loading the rest of the data to save network bandwidth and CPU time
+ loading and processing useless data.
+
+ * loader/cache/CachedImage.cpp:
+ (WebCore::CachedImage::addIncrementalDataBuffer):
+ (WebCore::CachedImage::finishLoading):
+
2017-04-20 Aaron Chu <aaron_...@apple.com>
AX: Modern Media Controls Timeline slider should be operable
Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (215573 => 215574)
--- trunk/Source/WebCore/loader/cache/CachedImage.cpp 2017-04-20 19:59:46 UTC (rev 215573)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp 2017-04-20 20:09:47 UTC (rev 215574)
@@ -406,6 +406,8 @@
if (encodedDataStatus == EncodedDataStatus::Error || m_image->isNull()) {
// Image decoding failed. Either we need more image data or the image data is malformed.
error(errorOccurred() ? status() : DecodeError);
+ if (m_loader && encodedDataStatus == EncodedDataStatus::Error)
+ m_loader->cancel();
if (inCache())
MemoryCache::singleton().remove(*this);
return;
@@ -440,10 +442,9 @@
if (!m_image && data)
createImage();
- if (m_image)
- m_image->setData(data, true);
+ EncodedDataStatus encodedDataStatus = m_image ? m_image->setData(data, true) : EncodedDataStatus::Error;
- if (!m_image || m_image->isNull()) {
+ if (encodedDataStatus == EncodedDataStatus::Error || m_image->isNull()) {
// Image decoding failed; the image data is malformed.
error(errorOccurred() ? status() : DecodeError);
if (inCache())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes