OSDN Git Service

Do not send empty data.
authorPatrick Scott <phanna@android.com>
Tue, 18 Jan 2011 21:17:21 +0000 (16:17 -0500)
committerPatrick Scott <phanna@android.com>
Tue, 18 Jan 2011 21:17:21 +0000 (16:17 -0500)
WebKit asserts that the length of data is 0 and assumes that the length is
non-zero.

Change-Id: Ic1e62bcfaca5b875256216ed20013f1b4ad7e653

WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp

index d6224e0..ed7ece7 100644 (file)
@@ -302,7 +302,7 @@ void WebUrlLoaderClient::didReceiveResponse(PassOwnPtr<WebResponse> webResponse)
 
 void WebUrlLoaderClient::didReceiveData(scoped_refptr<net::IOBuffer> buf, int size)
 {
-    if (!isActive())
+    if (!isActive() || !size)
         return;
 
     // didReceiveData will take a copy of the data
@@ -313,7 +313,7 @@ void WebUrlLoaderClient::didReceiveData(scoped_refptr<net::IOBuffer> buf, int si
 // For data url's
 void WebUrlLoaderClient::didReceiveDataUrl(PassOwnPtr<std::string> str)
 {
-    if (!isActive())
+    if (!isActive() || !str->size())
         return;
 
     // didReceiveData will take a copy of the data
@@ -323,7 +323,7 @@ void WebUrlLoaderClient::didReceiveDataUrl(PassOwnPtr<std::string> str)
 // For special android files
 void WebUrlLoaderClient::didReceiveAndroidFileData(PassOwnPtr<std::vector<char> > vector)
 {
-    if (!isActive())
+    if (!isActive() || !vector->size())
         return;
 
     // didReceiveData will take a copy of the data