Title: [139484] trunk/Source/WebCore
- Revision
- 139484
- Author
- [email protected]
- Date
- 2013-01-11 12:23:46 -0800 (Fri, 11 Jan 2013)
Log Message
Skip CachedImage::CreateImage if we don't have image data
https://bugs.webkit.org/show_bug.cgi?id=106156
Reviewed by Nate Chapin.
This patch skips image creation if we do not have image data. This can occur during
cache revalidation when the revalidation request (304 not modified) comes back without
any content. In this revalidation case, the http spec requires that a mimetype not be set
on the response to prevent a cached resource from having a different mimetype
from the revalidated resource. Because revalidation requests do not have a mimetype,
CachedImage::CreateImage() will fail on SVG images. This patch prevents
CachedImage::CreateImage() from being called during revalidation.
No new tests as there are no observable changes from this patch.
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::data):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (139483 => 139484)
--- trunk/Source/WebCore/ChangeLog 2013-01-11 20:21:41 UTC (rev 139483)
+++ trunk/Source/WebCore/ChangeLog 2013-01-11 20:23:46 UTC (rev 139484)
@@ -1,3 +1,23 @@
+2013-01-11 Philip Rogers <[email protected]>
+
+ Skip CachedImage::CreateImage if we don't have image data
+ https://bugs.webkit.org/show_bug.cgi?id=106156
+
+ Reviewed by Nate Chapin.
+
+ This patch skips image creation if we do not have image data. This can occur during
+ cache revalidation when the revalidation request (304 not modified) comes back without
+ any content. In this revalidation case, the http spec requires that a mimetype not be set
+ on the response to prevent a cached resource from having a different mimetype
+ from the revalidated resource. Because revalidation requests do not have a mimetype,
+ CachedImage::CreateImage() will fail on SVG images. This patch prevents
+ CachedImage::CreateImage() from being called during revalidation.
+
+ No new tests as there are no observable changes from this patch.
+
+ * loader/cache/CachedImage.cpp:
+ (WebCore::CachedImage::data):
+
2013-01-11 Kentaro Hara <[email protected]>
Unreviewed. Rebaselined run-bindings-tests.
Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (139483 => 139484)
--- trunk/Source/WebCore/loader/cache/CachedImage.cpp 2013-01-11 20:21:41 UTC (rev 139483)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp 2013-01-11 20:23:46 UTC (rev 139484)
@@ -360,14 +360,16 @@
{
m_data = data;
- createImage();
+ if (m_data)
+ createImage();
bool sizeAvailable = false;
// Have the image update its data from its internal buffer.
// It will not do anything now, but will delay decoding until
// queried for info (like size or specific image frames).
- sizeAvailable = m_image->setData(m_data ? m_data->sharedBuffer() : 0, allDataReceived);
+ if (m_image)
+ sizeAvailable = m_image->setData(m_data ? m_data->sharedBuffer() : 0, allDataReceived);
// Go ahead and tell our observers to try to draw if we have either
// received all the data or the size is known. Each chunk from the
@@ -375,9 +377,9 @@
// to decode.
if (sizeAvailable || allDataReceived) {
size_t maxDecodedImageSize = maximumDecodedImageSize();
- IntSize s = m_image->size();
+ IntSize s = m_image ? m_image->size() : IntSize();
size_t estimatedDecodedImageSize = s.width() * s.height() * 4; // no overflow check
- if (m_image->isNull() || (maxDecodedImageSize > 0 && estimatedDecodedImageSize > maxDecodedImageSize)) {
+ if (!m_image || m_image->isNull() || (maxDecodedImageSize > 0 && estimatedDecodedImageSize > maxDecodedImageSize)) {
error(errorOccurred() ? status() : DecodeError);
if (inCache())
memoryCache()->remove(this);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes