Title: [148068] trunk/Source/WebCore
Revision
148068
Author
[email protected]
Date
2013-04-09 17:04:55 -0700 (Tue, 09 Apr 2013)

Log Message

        REGRESSION: Blob URLs broken with NetworkProcess
        https://bugs.webkit.org/show_bug.cgi?id=114320

        Reviewed by Brady Eidson.

        Update BlobResourceHandle to use modern resource client calls.

        * platform/network/BlobResourceHandle.cpp:
        (WebCore::BlobResourceHandle::readSync): Don't call notifyReceiveData if there is
        no data (it's especially egregious when length is -1, signaling an error).
        (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Use didReceiveResponseAsync
        when a client wants async callbacks. This is not very clean, as we don't wait
        for response, but should be workable for blobs.
        (WebCore::BlobResourceHandle::notifyResponseOnError): Ditto.
        (WebCore::BlobResourceHandle::notifyReceiveData): Use didReceiveBuffer (clients
        that only implement didReceiveData will have it automatically unwrapped).

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (148067 => 148068)


--- trunk/Source/WebCore/ChangeLog	2013-04-10 00:03:30 UTC (rev 148067)
+++ trunk/Source/WebCore/ChangeLog	2013-04-10 00:04:55 UTC (rev 148068)
@@ -1,3 +1,22 @@
+2013-04-09  Alexey Proskuryakov  <[email protected]>
+
+        REGRESSION: Blob URLs broken with NetworkProcess
+        https://bugs.webkit.org/show_bug.cgi?id=114320
+
+        Reviewed by Brady Eidson.
+
+        Update BlobResourceHandle to use modern resource client calls.
+
+        * platform/network/BlobResourceHandle.cpp:
+        (WebCore::BlobResourceHandle::readSync): Don't call notifyReceiveData if there is
+        no data (it's especially egregious when length is -1, signaling an error).
+        (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Use didReceiveResponseAsync
+        when a client wants async callbacks. This is not very clean, as we don't wait
+        for response, but should be workable for blobs.
+        (WebCore::BlobResourceHandle::notifyResponseOnError): Ditto.
+        (WebCore::BlobResourceHandle::notifyReceiveData): Use didReceiveBuffer (clients
+        that only implement didReceiveData will have it automatically unwrapped).
+
 2013-04-09  Jer Noble  <[email protected]>
 
         REGRESSION (r123837): Full screen transition is broken at apple.com

Modified: trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp (148067 => 148068)


--- trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp	2013-04-10 00:03:30 UTC (rev 148067)
+++ trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp	2013-04-10 00:04:55 UTC (rev 148068)
@@ -44,6 +44,7 @@
 #include "ResourceHandleClient.h"
 #include "ResourceRequest.h"
 #include "ResourceResponse.h"
+#include "SharedBuffer.h"
 #include <wtf/MainThread.h>
 
 namespace WebCore {
@@ -378,7 +379,9 @@
     else
         result = length - remaining;
 
-    notifyReceiveData(buf, result);
+    if (result > 0)
+        notifyReceiveData(buf, result);
+
     if (!result)
         notifyFinish();
 
@@ -580,7 +583,14 @@
     response.setHTTPStatusText(isRangeRequest ? httpPartialContentText : httpOKText);
     if (!m_blobData->contentDisposition().isEmpty())
         response.setHTTPHeaderField("Content-Disposition", m_blobData->contentDisposition());
-    client()->didReceiveResponse(this, response);
+
+    // BlobResourceHandle cannot be used with downloading, and doesn't even wait for continueDidReceiveResponse.
+    // It's currently client's responsibility to know that didReceiveResponseAsync cannot be used to convert a
+    // load into a download or blobs.
+    if (client()->usesAsyncCallbacks())
+        client()->didReceiveResponseAsync(this, response);
+    else
+        client()->didReceiveResponse(this, response);
 }
 
 void BlobResourceHandle::notifyResponseOnError()
@@ -606,13 +616,19 @@
         response.setHTTPStatusText(httpInternalErrorText);
         break;
     }
-    client()->didReceiveResponse(this, response);
+
+    // Note that we don't wait for continueDidReceiveResponse when using didReceiveResponseAsync.
+    // This is not formally correct, but the client has to be a no-op anyway, because blobs can't be downloaded.
+    if (client()->usesAsyncCallbacks())
+        client()->didReceiveResponseAsync(this, response);
+    else
+        client()->didReceiveResponse(this, response);
 }
 
 void BlobResourceHandle::notifyReceiveData(const char* data, int bytesRead)
 {
     if (client())
-        client()->didReceiveData(this, data, bytesRead, bytesRead);
+        client()->didReceiveBuffer(this, SharedBuffer::create(data, bytesRead), bytesRead);
 }
 
 void BlobResourceHandle::notifyFail(int errorCode)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to