Title: [119332] releases/WebKitGTK/webkit-1.8
Revision
119332
Author
[email protected]
Date
2012-06-02 13:30:11 -0700 (Sat, 02 Jun 2012)

Log Message

2012-03-09  Nate Chapin  <[email protected]>

        CachedRawResource breaks when trying to load
        a resource with an empty response body from cache.

        Reviewed by Alexey Proskuryakov.

        Test: http/tests/cache/zero-length-xhr.html

        * loader/cache/CachedRawResource.cpp:
        (WebCore::CachedRawResource::didAddClient): Don't exit early
            if m_data is empty, we may still need to notifyFinished().

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog (119331 => 119332)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-06-02 20:29:47 UTC (rev 119331)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-06-02 20:30:11 UTC (rev 119332)
@@ -1,3 +1,13 @@
+2012-03-09  Nate Chapin  <[email protected]>
+
+        Test for https://bugs.webkit.org/show_bug.cgi?id=80551
+
+        Reviewed by Alexey Proskuryakov.
+
+        * http/tests/cache/resources/empty.txt: Added.
+        * http/tests/cache/zero-length-xhr-expected.txt: Added.
+        * http/tests/cache/zero-length-xhr.html: Added.
+
 2012-02-22  Nate Chapin  <[email protected]>
 
         inspector/debugger/script-formatter-console.html should

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/cache/resources/empty.txt ( => )


Added: releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/cache/zero-length-xhr-expected.txt
===================================================================
--- releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/cache/zero-length-xhr-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/cache/zero-length-xhr-expected.txt	2012-06-02 20:30:11 UTC (rev 119332)
@@ -0,0 +1,6 @@
+Test that we don't hang xhr loads from cache when the resposne body was empty.
+
+load
+load
+DONE
+

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/cache/zero-length-xhr.html (0 => 119332)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/cache/zero-length-xhr.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/cache/zero-length-xhr.html	2012-06-02 20:30:11 UTC (rev 119332)
@@ -0,0 +1,41 @@
+<body _onload_="test();">
+<p>Test that we don't hang xhr loads from cache when the resposne body was empty.<p>
+<pre id=log></pre>
+<script type="text/_javascript_">
+
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+function log(msg) {
+    document.getElementById("log").innerHTML += msg + "\n";
+}
+
+function test() {
+    var request = new XMLHttpRequest();
+    request.addEventListener("progress", function() { log("progress") }, false);
+    request.addEventListener("load", function() { log("load"); repeat(); }, false);
+    request.addEventListener("error", function() { log("error"); repeat(); }, false);
+    request.addEventListener("abort", function() { log("abort"); repeat(); }, false);
+    request.open("GET", "resources/empty.txt", true);
+    request.send();
+}
+
+function repeat() {
+    var request = new XMLHttpRequest();
+    request.addEventListener("progress", function() { log("progress") }, false);
+    request.addEventListener("load", function() { log("load"); end(); }, false);
+    request.addEventListener("error", function() { log("error"); end(); }, false);
+    request.addEventListener("abort", function() { log("abort"); end(); }, false);
+    request.open("GET", "resources/empty.txt", true);
+    request.send();
+}
+
+function end() {
+    log("DONE");
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+</script>
+</body>

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog (119331 => 119332)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-06-02 20:29:47 UTC (rev 119331)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-06-02 20:30:11 UTC (rev 119332)
@@ -1,3 +1,16 @@
+2012-03-09  Nate Chapin  <[email protected]>
+
+        CachedRawResource breaks when trying to load
+        a resource with an empty response body from cache.
+
+        Reviewed by Alexey Proskuryakov.
+
+        Test: http/tests/cache/zero-length-xhr.html
+
+        * loader/cache/CachedRawResource.cpp:
+        (WebCore::CachedRawResource::didAddClient): Don't exit early
+            if m_data is empty, we may still need to notifyFinished().
+
 2012-02-22  Nate Chapin  <[email protected]>
 
         Prevent CachedRawResource from sending the same data

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/loader/cache/CachedRawResource.cpp (119331 => 119332)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/loader/cache/CachedRawResource.cpp	2012-06-02 20:29:47 UTC (rev 119331)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/loader/cache/CachedRawResource.cpp	2012-06-02 20:30:11 UTC (rev 119332)
@@ -74,9 +74,10 @@
         return;
     CachedRawResourceClient* client = static_cast<CachedRawResourceClient*>(c);
     client->responseReceived(this, m_response);
-    if (!hasClient(c) || !m_data)
+    if (!hasClient(c))
         return;
-    client->dataReceived(this, m_data->data(), m_data->size());
+    if (m_data)
+        client->dataReceived(this, m_data->data(), m_data->size());
     if (!hasClient(c))
        return;
     CachedResource::didAddClient(client);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to