Title: [184376] trunk/Source
Revision
184376
Author
[email protected]
Date
2015-05-15 01:03:16 -0700 (Fri, 15 May 2015)

Log Message

REGRESSION(r183861): [SOUP] Downloads are broken when using the Network Process
https://bugs.webkit.org/show_bug.cgi?id=144738

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Add ResourceHandle::releaseForDownload() that releases the current
handle to be used as a download.

* platform/network/ResourceHandle.h:
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::ResourceHandle::releaseForDownload):

Source/WebKit2:

When converting the main resource handle to a download, the
NetworkResourceLoader is aborted, and the ResourceHandle is
cleaned up aborting the download operation. We need to use a
different ResourceHandle for the download operation.

* Shared/Downloads/soup/DownloadSoup.cpp:
(WebKit::Download::startWithHandle): Use ResourceHandle::releaseForDownload()
instead of reusing the given handle.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (184375 => 184376)


--- trunk/Source/WebCore/ChangeLog	2015-05-15 08:01:42 UTC (rev 184375)
+++ trunk/Source/WebCore/ChangeLog	2015-05-15 08:03:16 UTC (rev 184376)
@@ -1,3 +1,17 @@
+2015-05-14  Carlos Garcia Campos  <[email protected]>
+
+        REGRESSION(r183861): [SOUP] Downloads are broken when using the Network Process
+        https://bugs.webkit.org/show_bug.cgi?id=144738
+
+        Reviewed by Alexey Proskuryakov.
+
+        Add ResourceHandle::releaseForDownload() that releases the current
+        handle to be used as a download.
+
+        * platform/network/ResourceHandle.h:
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::ResourceHandle::releaseForDownload):
+
 2015-05-15  Zan Dobersek  <[email protected]>
 
         [GTK] Fix PlatformDisplayWayland construction error, implement the destructor

Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (184375 => 184376)


--- trunk/Source/WebCore/platform/network/ResourceHandle.h	2015-05-15 08:01:42 UTC (rev 184375)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.h	2015-05-15 08:03:16 UTC (rev 184376)
@@ -177,6 +177,7 @@
 #endif
 
 #if USE(SOUP)
+    RefPtr<ResourceHandle> releaseForDownload(ResourceHandleClient*);
     void continueDidReceiveAuthenticationChallenge(const Credential& credentialFromPersistentStorage);
     void sendPendingRequest();
     bool cancelledOrClientless();

Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (184375 => 184376)


--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2015-05-15 08:01:42 UTC (rev 184375)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2015-05-15 08:03:16 UTC (rev 184376)
@@ -1027,6 +1027,21 @@
     return true;
 }
 
+RefPtr<ResourceHandle> ResourceHandle::releaseForDownload(ResourceHandleClient* downloadClient)
+{
+    // We don't adopt the ref, as it will be released by cleanupSoupRequestOperation, which should always run.
+    RefPtr<ResourceHandle> newHandle = new ResourceHandle(d->m_context.get(), firstRequest(), nullptr, d->m_defersLoading, d->m_shouldContentSniff);
+    std::swap(d, newHandle->d);
+
+    g_signal_handlers_disconnect_matched(newHandle->d->m_soupMessage.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
+    g_object_set_data(G_OBJECT(newHandle->d->m_soupMessage.get()), "handle", newHandle.get());
+
+    newHandle->d->m_client = downloadClient;
+    continueAfterDidReceiveResponse(newHandle.get());
+
+    return newHandle;
+}
+
 void ResourceHandle::sendPendingRequest()
 {
 #if ENABLE(WEB_TIMING)

Modified: trunk/Source/WebKit2/ChangeLog (184375 => 184376)


--- trunk/Source/WebKit2/ChangeLog	2015-05-15 08:01:42 UTC (rev 184375)
+++ trunk/Source/WebKit2/ChangeLog	2015-05-15 08:03:16 UTC (rev 184376)
@@ -1,3 +1,19 @@
+2015-05-14  Carlos Garcia Campos  <[email protected]>
+
+        REGRESSION(r183861): [SOUP] Downloads are broken when using the Network Process
+        https://bugs.webkit.org/show_bug.cgi?id=144738
+
+        Reviewed by Alexey Proskuryakov.
+
+        When converting the main resource handle to a download, the
+        NetworkResourceLoader is aborted, and the ResourceHandle is
+        cleaned up aborting the download operation. We need to use a
+        different ResourceHandle for the download operation.
+
+        * Shared/Downloads/soup/DownloadSoup.cpp:
+        (WebKit::Download::startWithHandle): Use ResourceHandle::releaseForDownload()
+        instead of reusing the given handle.
+
 2015-05-14  Brady Eidson  <[email protected]>
 
         Rename connectionDidClose and related methods to be more clear.

Modified: trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp (184375 => 184376)


--- trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp	2015-05-15 08:01:42 UTC (rev 184375)
+++ trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp	2015-05-15 08:03:16 UTC (rev 184376)
@@ -230,8 +230,7 @@
     ASSERT(!m_downloadClient);
     ASSERT(!m_resourceHandle);
     m_downloadClient = std::make_unique<DownloadClient>(this);
-    resourceHandle->setClient(m_downloadClient.get());
-    m_resourceHandle = resourceHandle;
+    m_resourceHandle = resourceHandle->releaseForDownload(m_downloadClient.get());
     didStart();
     static_cast<DownloadClient*>(m_downloadClient.get())->handleResponseLater(response);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to