Reviewed by Brady
- pixel test for http://bugs.webkit.org/show_bug.cgi?id=13759
REGRESSION (r20182-r20184): Incorrect rendering of multipart images
Created http/tests/multipart and moved the existing multipart test there.
* http/tests/misc/multipart-expected.txt: Removed.
* http/tests/misc/multipart.html: Removed.
* http/tests/misc/resources/1x1-blue.png: Removed.
* http/tests/misc/resources/multipart.php: Removed.
* http/tests/multipart/invalid-image-data-expected.checksum: Added.
* http/tests/multipart/invalid-image-data-expected.png: Added.
* http/tests/multipart/invalid-image-data-expected.txt: Added.
* http/tests/multipart/invalid-image-data.html: Added.
* http/tests/multipart/resources/2x2-green.png: Added. Shared by both
multipart tests.
* http/tests/multipart/resources/abe.png: Added.
* http/tests/multipart/resources/multipart.php: Added. Shared by both
multipart tests.
* http/tests/multipart/stop-crash.html: Renamed from misc/multipart.html.
WebCore:
Reviewed by Brady
- fix http://bugs.webkit.org/show_bug.cgi?id=13759
REGRESSION (r20182-r20184): Incorrect rendering of multipart images
Test: http/tests/multipart/invalid-image-data.html
* loader/loader.cpp:
(WebCore::Loader::didReceiveData): Make a copy of the current part's data
instead of using the resource data, because the latter is going to be
overwritten by the new part being received.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@21536
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-05-17 Mitz Pettel <mitz@webkit.org>
+
+ Reviewed by Brady
+
+ - pixel test for http://bugs.webkit.org/show_bug.cgi?id=13759
+ REGRESSION (r20182-r20184): Incorrect rendering of multipart images
+
+ Created http/tests/multipart and moved the existing multipart test there.
+
+ * http/tests/misc/multipart-expected.txt: Removed.
+ * http/tests/misc/multipart.html: Removed.
+ * http/tests/misc/resources/1x1-blue.png: Removed.
+ * http/tests/misc/resources/multipart.php: Removed.
+ * http/tests/multipart/invalid-image-data-expected.checksum: Added.
+ * http/tests/multipart/invalid-image-data-expected.png: Added.
+ * http/tests/multipart/invalid-image-data-expected.txt: Added.
+ * http/tests/multipart/invalid-image-data.html: Added.
+ * http/tests/multipart/resources/2x2-green.png: Added. Shared by both
+ multipart tests.
+ * http/tests/multipart/resources/abe.png: Added.
+ * http/tests/multipart/resources/multipart.php: Added. Shared by both
+ multipart tests.
+ * http/tests/multipart/stop-crash.html: Renamed from misc/multipart.html.
+
2007-05-17 Justin Garcia <justin.garcia@apple.com>
Reviewed by harrison
+++ /dev/null
-<?php
- $boundary = "cutHere";
-
- function sendPart($data)
- {
- global $boundary;
-
- echo("Content-Type: image/png\r\n\r\n");
- echo($data);
- echo("--$boundary\r\n");
- flush();
- }
-
- $blue = file_get_contents("1x1-blue.png");
-
- header("Content-Type: multipart/x-mixed-replace; boundary=$boundary");
-
- echo("--$boundary\r\n");
- sendPart($blue);
- sendPart($blue);
- sleep(10);
-?>
--- /dev/null
+a501b3b6dcb0a994e9980b3158e4948c
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {P} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 53x18
+ text run at (0,0) width 53: "Test for "
+ RenderInline {I} at (0,0) size 776x36
+ RenderInline {A} at (0,0) size 301x18 [color=#0000EE]
+ RenderText {#text} at (53,0) size 301x18
+ text run at (53,0) width 301: "http://bugs.webkit.org/show_bug.cgi?id=13759"
+ RenderText {#text} at (354,0) size 776x36
+ text run at (354,0) width 4: " "
+ text run at (358,0) width 418: "REGRESSION (r20182-r20184): Incorrect rendering of multipart"
+ text run at (0,18) width 45: "images"
+ RenderText {#text} at (45,18) size 4x18
+ text run at (45,18) width 4: "."
+ RenderBlock {P} at (0,52) size 784x18
+ RenderText {#text} at (0,0) size 285x18
+ text run at (0,0) width 285: "There should be a bright green square below."
+ RenderBlock (anonymous) at (0,86) size 784x100
+ RenderImage {IMG} at (0,0) size 100x100
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
--- /dev/null
+<html>
+<head>
+ <script>
+ if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+ function loadedFirstPart()
+ {
+ if (window.layoutTestController)
+ setTimeout("layoutTestController.notifyDone()", 200);
+ }
+ </script>
+</head>
+<body>
+ <p>
+ Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=13759">http://bugs.webkit.org/show_bug.cgi?id=13759</a>
+ REGRESSION (r20182-r20184): Incorrect rendering of multipart images</i>.
+ </p>
+ <p>
+ There should be a bright green square below.
+ </p>
+ <img width="100" height="100" src="resources/multipart.php?interval=0&img1=2x2-green.png&img2=abe.png" onload="loadedFirstPart()">
+</body>
+</html>
--- /dev/null
+<?php
+ $boundary = "cutHere";
+
+ function sendPart($data)
+ {
+ global $boundary;
+
+ echo("Content-Type: image/png\r\n\r\n");
+ echo($data);
+ echo("--$boundary\r\n");
+ flush();
+ }
+
+ $i = 1;
+ while ($img = $_GET['img' . $i]) {
+ $images[$i] = file_get_contents($img);
+ $i++;
+ }
+
+ if (isset($_GET['interval']))
+ $interval = $_GET['interval'] * 1000000;
+ else
+ $interval = 1000000;
+
+ header("Content-Type: multipart/x-mixed-replace; boundary=$boundary");
+
+ echo("--$boundary\r\n");
+
+ do {
+ for ($k = 1; $k < $i; $k++) {
+ sendPart($images[$k]);
+ usleep($interval);
+ }
+ } while ($_GET['loop']);
+
+ if (isset($_GET['wait']))
+ usleep($_GET['wait'] * 1000000);
+?>
<p>
If WebKit does not assert or crash after the test, then it passed.
</p>
- <img width=24 height=24 src="resources/multipart.php" onload="firstPartLoaded()">
+ <img width=24 height=24 src="resources/multipart.php?interval=0&img1=2x2-green.png&img2=2x2-green.png&wait=10" onload="firstPartLoaded()">
</body>
</html>
+2007-05-17 Mitz Pettel <mitz@webkit.org>
+
+ Reviewed by Brady
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=13759
+ REGRESSION (r20182-r20184): Incorrect rendering of multipart images
+
+ Test: http/tests/multipart/invalid-image-data.html
+
+ * loader/loader.cpp:
+ (WebCore::Loader::didReceiveData): Make a copy of the current part's data
+ instead of using the resource data, because the latter is going to be
+ overwritten by the new part being received.
+
2007-05-17 Oliver Hunt <oliver@apple.com>
Reviewed by Justin.
CachedResource* object = request->cachedResource();
// Set the data.
- if (request->isMultipart())
+ if (request->isMultipart()) {
// The loader delivers the data in a multipart section all at once, send eof.
- object->data(loader->resourceData(), true);
- else if (request->isIncremental())
+ // The resource data will change as the next part is loaded, so we need to make a copy.
+ SharedBuffer* copiedData = new SharedBuffer(data, size);
+ object->data(copiedData, true);
+ } else if (request->isIncremental())
object->data(loader->resourceData(), false);
}