[SOUP] Implement ResourceHandle::continueWillSendRequest()
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Dec 2013 08:30:26 +0000 (08:30 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Dec 2013 08:30:26 +0000 (08:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=126291

Reviewed by Martin Robinson.

* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::continueAfterWillSendRequest): Helper function that
continues with the load after willSendRequest has been called.
(WebCore::doRedirect): Call continueAfterWillSendRequest() when
client doesn't use async callbacks.
(WebCore::ResourceHandle::continueWillSendRequest): Call
continueAfterWillSendRequest().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161177 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp

index d1ea11b..31d40d0 100644 (file)
@@ -1,3 +1,18 @@
+2013-12-31  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [SOUP] Implement ResourceHandle::continueWillSendRequest()
+        https://bugs.webkit.org/show_bug.cgi?id=126291
+
+        Reviewed by Martin Robinson.
+
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::continueAfterWillSendRequest): Helper function that
+        continues with the load after willSendRequest has been called.
+        (WebCore::doRedirect): Call continueAfterWillSendRequest() when
+        client doesn't use async callbacks.
+        (WebCore::ResourceHandle::continueWillSendRequest): Call
+        continueAfterWillSendRequest().
+
 2013-12-30  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [SOUP] willSendRequest doesn't work after a redirect
index 9d6a144..d588d96 100644 (file)
@@ -455,6 +455,20 @@ static bool shouldRedirectAsGET(SoupMessage* message, URL& newURL, bool crossOri
     return false;
 }
 
+static void continueAfterWillSendRequest(ResourceHandle* handle, const ResourceRequest& newRequest)
+{
+    // willSendRequest might cancel the load.
+    if (handle->cancelledOrClientless())
+        return;
+
+    if (!createSoupRequestAndMessageForHandle(handle, newRequest, true)) {
+        handle->getInternal()->client()->cannotShowURL(handle);
+        return;
+    }
+
+    handle->sendPendingRequest();
+}
+
 static void doRedirect(ResourceHandle* handle)
 {
     ResourceHandleInternal* d = handle->getInternal();
@@ -506,23 +520,15 @@ static void doRedirect(ResourceHandle* handle)
     // the WebKit layer. They were only placed in the URL for the benefit of libsoup.
     newRequest.removeCredentials();
 
+    cleanupSoupRequestOperation(handle);
+
     if (d->client()->usesAsyncCallbacks())
         d->client()->willSendRequestAsync(handle, newRequest, d->m_response);
-    else
+    else {
         d->client()->willSendRequest(handle, newRequest, d->m_response);
-
-    cleanupSoupRequestOperation(handle);
-
-    // willSendRequest might cancel the load.
-    if (handle->cancelledOrClientless())
-        return;
-
-    if (!createSoupRequestAndMessageForHandle(handle, newRequest, true)) {
-        d->client()->cannotShowURL(handle);
-        return;
+        continueAfterWillSendRequest(handle, newRequest);
     }
 
-    handle->sendPendingRequest();
 }
 
 static void redirectSkipCallback(GObject*, GAsyncResult* asyncResult, gpointer data)
@@ -1392,7 +1398,7 @@ void ResourceHandle::continueWillSendRequest(const ResourceRequest& request)
 {
     ASSERT(client());
     ASSERT(client()->usesAsyncCallbacks());
-    // FIXME: Implement this method if needed: https://bugs.webkit.org/show_bug.cgi?id=126114.
+    continueAfterWillSendRequest(this, request);
 }
 
 void ResourceHandle::continueDidReceiveResponse()