Title: [164863] trunk
Revision
164863
Author
[email protected]
Date
2014-02-28 09:30:36 -0800 (Fri, 28 Feb 2014)

Log Message

SubresourceLoader::didFinishLoading() should not assert when a decode error occurs
https://bugs.webkit.org/show_bug.cgi?id=127029

Reviewed by Darin Adler.

Source/WebCore:

SubresourceLoader::didFinishLoading() can be called for a resource (e.g. an image) that
failed to be decoded or, in the case of an image, whose estimated decoded size exceeds
the maximum decoded size (Settings::maximumDecodedImageSize()).

Test: fast/images/decoded-size-exceeds-max-decoded-size.html

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didFinishLoading):

LayoutTests:

Added a test to ensure that we don't cause an assertion failure when an image fails
to load because of a decode error. In particular, the estimated decoded image size
exceeds the maximum decoded image size.

* fast/images/decoded-size-exceeds-max-decoded-size-expected.txt: Added.
* fast/images/decoded-size-exceeds-max-decoded-size.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (164862 => 164863)


--- trunk/LayoutTests/ChangeLog	2014-02-28 16:56:17 UTC (rev 164862)
+++ trunk/LayoutTests/ChangeLog	2014-02-28 17:30:36 UTC (rev 164863)
@@ -1,3 +1,17 @@
+2014-02-28  Daniel Bates  <[email protected]>
+
+        SubresourceLoader::didFinishLoading() should not assert when a decode error occurs
+        https://bugs.webkit.org/show_bug.cgi?id=127029
+
+        Reviewed by Darin Adler.
+
+        Added a test to ensure that we don't cause an assertion failure when an image fails
+        to load because of a decode error. In particular, the estimated decoded image size
+        exceeds the maximum decoded image size.
+
+        * fast/images/decoded-size-exceeds-max-decoded-size-expected.txt: Added.
+        * fast/images/decoded-size-exceeds-max-decoded-size.html: Added.
+
 2014-02-28  Martin Hodovan  <[email protected]>
 
         ASSERTION FAILED: roundedIntPoint(rendererMappedResult) == roundedIntPoint(result) in WebCore::RenderGeometryMap::mapToContainer

Added: trunk/LayoutTests/fast/images/decoded-size-exceeds-max-decoded-size-expected.txt (0 => 164863)


--- trunk/LayoutTests/fast/images/decoded-size-exceeds-max-decoded-size-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/images/decoded-size-exceeds-max-decoded-size-expected.txt	2014-02-28 17:30:36 UTC (rev 164863)
@@ -0,0 +1,10 @@
+Tests that an image whose size exceeds the maximum decoded size dispatches a DOM error event.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS event.type is 'error'.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/images/decoded-size-exceeds-max-decoded-size.html (0 => 164863)


--- trunk/LayoutTests/fast/images/decoded-size-exceeds-max-decoded-size.html	                        (rev 0)
+++ trunk/LayoutTests/fast/images/decoded-size-exceeds-max-decoded-size.html	2014-02-28 17:30:36 UTC (rev 164863)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+window.jsTestIsAsync = true;
+if (window.internals)
+    window.internals.settings.setMaximumDecodedImageSize(0); // bytes
+</script>
+</head>
+<body>
+<img src="" width="256" height="256" _onerror_="checkDispatchedEvent(event)" _onload_="checkDispatchedEvent(event)">
+<script>
+description("Tests that an image whose size exceeds the maximum decoded size dispatches a DOM error event.");
+function checkDispatchedEvent(event)
+{
+    if (event.type === "error")
+        testPassed("event.type is 'error'.");
+    else
+        testPassed("event.type should have been 'error'. Was '" + event.type + "'.");
+    finishJSTest();
+}
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (164862 => 164863)


--- trunk/Source/WebCore/ChangeLog	2014-02-28 16:56:17 UTC (rev 164862)
+++ trunk/Source/WebCore/ChangeLog	2014-02-28 17:30:36 UTC (rev 164863)
@@ -1,3 +1,19 @@
+2014-02-28  Daniel Bates  <[email protected]>
+
+        SubresourceLoader::didFinishLoading() should not assert when a decode error occurs
+        https://bugs.webkit.org/show_bug.cgi?id=127029
+
+        Reviewed by Darin Adler.
+
+        SubresourceLoader::didFinishLoading() can be called for a resource (e.g. an image) that
+        failed to be decoded or, in the case of an image, whose estimated decoded size exceeds
+        the maximum decoded size (Settings::maximumDecodedImageSize()).
+
+        Test: fast/images/decoded-size-exceeds-max-decoded-size.html
+
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::didFinishLoading):
+
 2014-02-28  Martin Hodovan  <[email protected]>
 
         ASSERTION FAILED: roundedIntPoint(rendererMappedResult) == roundedIntPoint(result) in WebCore::RenderGeometryMap::mapToContainer

Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (164862 => 164863)


--- trunk/Source/WebCore/loader/SubresourceLoader.cpp	2014-02-28 16:56:17 UTC (rev 164862)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp	2014-02-28 17:30:36 UTC (rev 164863)
@@ -294,7 +294,8 @@
         return;
     ASSERT(!reachedTerminalState());
     ASSERT(!m_resource->resourceToRevalidate());
-    ASSERT(!m_resource->errorOccurred());
+    // FIXME (129394): We should cancel the load when a decode error occurs instead of continuing the load to completion.
+    ASSERT(!m_resource->errorOccurred() || m_resource->status() == CachedResource::DecodeError);
     LOG(ResourceLoading, "Received '%s'.", m_resource->url().string().latin1().data());
 
     Ref<SubresourceLoader> protect(*this);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to