Title: [105000] trunk
Revision
105000
Author
[email protected]
Date
2012-01-13 15:32:42 -0800 (Fri, 13 Jan 2012)

Log Message

Source/WebCore: Revert most of the multipart changes in
http://trac.webkit.org/changeset/104756.
https://bugs.webkit.org/show_bug.cgi?id=76297

Reviewed by Alexey Proskuryakov.

http/tests/multipart/invalid-image-data.html
should stop asserting on chromium win dbg.

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didReceiveResponse):
(WebCore::SubresourceLoader::didReceiveData):
(WebCore::SubresourceLoader::sendDataToResource):

LayoutTests: http/tests/multipart/invalid-image-data.html should no longer
be crashing on chromium win dbg.
https://bugs.webkit.org/show_bug.cgi?id=76297

Reviewed by Alexey Proskuryakov.

* platform/chromium/test_expectations.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (104999 => 105000)


--- trunk/LayoutTests/ChangeLog	2012-01-13 23:31:40 UTC (rev 104999)
+++ trunk/LayoutTests/ChangeLog	2012-01-13 23:32:42 UTC (rev 105000)
@@ -1,3 +1,13 @@
+2012-01-13  Nate Chapin  <[email protected]>
+
+        http/tests/multipart/invalid-image-data.html should no longer
+        be crashing on chromium win dbg.
+        https://bugs.webkit.org/show_bug.cgi?id=76297
+
+        Reviewed by Alexey Proskuryakov.
+
+        * platform/chromium/test_expectations.txt:
+
 2012-01-13  Raymond Toy   <[email protected]>
         EQUALPOWER panner incorrectly computes gain
         https://bugs.webkit.org/show_bug.cgi?id=75767

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (104999 => 105000)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2012-01-13 23:31:40 UTC (rev 104999)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2012-01-13 23:32:42 UTC (rev 105000)
@@ -1213,8 +1213,7 @@
 BUGCR10361 WIN : http/tests/misc/single-character-pi-stylesheet.xhtml = FAIL
 
 // Windows is missing the green box. Started to pass in roll to WebKit r50313
-// Started crashing on XP after http://trac.webkit.org/changeset/104756
-BUGCR8729 WIN : http/tests/multipart/invalid-image-data.html = IMAGE+TEXT CRASH
+BUGCR8729 WIN : http/tests/multipart/invalid-image-data.html = IMAGE+TEXT
 
 // -----------------------------------------------------------------
 // MAC PORT TESTS

Modified: trunk/Source/WebCore/ChangeLog (104999 => 105000)


--- trunk/Source/WebCore/ChangeLog	2012-01-13 23:31:40 UTC (rev 104999)
+++ trunk/Source/WebCore/ChangeLog	2012-01-13 23:32:42 UTC (rev 105000)
@@ -1,3 +1,19 @@
+2012-01-13  Nate Chapin  <[email protected]>
+
+        Revert most of the multipart changes in
+        http://trac.webkit.org/changeset/104756.
+        https://bugs.webkit.org/show_bug.cgi?id=76297
+
+        Reviewed by Alexey Proskuryakov.
+
+        http/tests/multipart/invalid-image-data.html
+        should stop asserting on chromium win dbg.
+
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::didReceiveResponse):
+        (WebCore::SubresourceLoader::didReceiveData):
+        (WebCore::SubresourceLoader::sendDataToResource):
+
 2011-01-13  Jer Noble  <[email protected]>
 
         WebAudio: Use float instead of double values for gain operations.

Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (104999 => 105000)


--- trunk/Source/WebCore/loader/SubresourceLoader.cpp	2012-01-13 23:31:40 UTC (rev 104999)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp	2012-01-13 23:32:42 UTC (rev 105000)
@@ -197,12 +197,21 @@
 
         // We don't count multiParts in a CachedResourceLoader's request count
         m_requestCountTracker.clear();
-        setShouldBufferData(DoNotBufferData);
         if (!m_resource->isImage()) {
             cancel();
             return;
         }
     }
+
+    RefPtr<SharedBuffer> buffer = resourceData();
+    if (m_loadingMultipartContent && buffer && buffer->size()) {
+        sendDataToResource(buffer->data(), buffer->size());
+        clearResourceData();
+        // Since a subresource loader does not load multipart sections progressively, data was delivered to the loader all at once.        
+        // After the first multipart section is complete, signal to delegates that this load is "finished" 
+        m_documentLoader->subresourceLoaderFinishedLoadingOnePart(this);
+        didFinishLoadingOnePart(0);
+    }
 }
 
 void SubresourceLoader::didReceiveData(const char* data, int length, long long encodedDataLength, bool allAtOnce)
@@ -215,17 +224,10 @@
     RefPtr<SubresourceLoader> protect(this);
     ResourceLoader::didReceiveData(data, length, encodedDataLength, allAtOnce);
 
-    if (errorLoadingResource())
+    if (errorLoadingResource() || m_loadingMultipartContent)
         return;
 
     sendDataToResource(data, length);
-    
-    if (m_loadingMultipartContent) {
-        // Since a subresource loader does not load multipart sections progressively, data was delivered to the loader all at once.        
-        // After the first multipart section is complete, signal to delegates that this load is "finished" 
-        m_documentLoader->subresourceLoaderFinishedLoadingOnePart(this);
-        didFinishLoadingOnePart(0);
-    }
 }
 
 bool SubresourceLoader::errorLoadingResource()
@@ -241,8 +243,17 @@
 
 void SubresourceLoader::sendDataToResource(const char* data, int length)
 {
-    RefPtr<SharedBuffer> buffer = resourceData() ? resourceData() : SharedBuffer::create(data, length);
-    m_resource->data(buffer.release(), m_loadingMultipartContent);
+    // There are two cases where we might need to create our own SharedBuffer instead of copying the one in ResourceLoader. 
+    // (1) Multipart content: The loader delivers the data in a multipart section all at once, then sends eof. 
+    //     The resource data will change as the next part is loaded, so we need to make a copy. 
+    // (2) Our client requested that the data not be buffered at the ResourceLoader level via ResourceLoaderOptions. In this case, 
+    //     ResourceLoader::resourceData() will be null. However, unlike the multipart case, we don't want to tell the CachedResource 
+    //     that all data has been received yet. 
+    if (m_loadingMultipartContent || !resourceData()) { 
+        RefPtr<SharedBuffer> copiedData = SharedBuffer::create(data, length); 
+        m_resource->data(copiedData.release(), m_loadingMultipartContent); 
+    } else 
+        m_resource->data(resourceData(), false);
 }
 
 void SubresourceLoader::didReceiveCachedMetadata(const char* data, int length)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to