Title: [206397] trunk
Revision
206397
Author
[email protected]
Date
2016-09-26 15:20:27 -0700 (Mon, 26 Sep 2016)

Log Message

[WK2] BlobDownloadClient should use asynchronous IPC to decide destination path
https://bugs.webkit.org/show_bug.cgi?id=162568

Reviewed by Alex Christensen.

Source/WebCore:

Update BlobResourceHandle to wait for continueDidReceiveResponse() to be
called after it calls the client's didReceiveResponseAsync(), before
actually reading the Blob Data.

No new tests, covered by existing tests.

* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::continueDidReceiveResponse):
(WebCore::BlobResourceHandle::getSizeForNext):
(WebCore::BlobResourceHandle::notifyResponseOnSuccess):
(WebCore::BlobResourceHandle::notifyResponseOnError):

Source/WebKit2:

Use DecideDestinationWithSuggestedFilenameAsync IPC to decide the destination
path in the case of Blob downloads, instead of the synchronous alternative.
To achieve this, BlobResourceHandle was updated in WebCore to properly support
asynchronous callback and BlobDownloadClient was updated to use asynchronous
callbacks. When BlobDownloadClient::didReceiveResponseAsync() is called, we
now ask the WebContent process asynchronously to decide what the destination
path should be. Then, when we later get the destination path back from the
WebContent process, we create the file on disk and call
continueDidReceiveResponse() on the BlobResourceHandle so we start getting the
blob data to write.

* NetworkProcess/Downloads/BlobDownloadClient.cpp:
(WebKit::BlobDownloadClient::didReceiveResponseAsync):
(WebKit::BlobDownloadClient::didDecideDownloadDestination):
* NetworkProcess/Downloads/BlobDownloadClient.h:
* NetworkProcess/Downloads/Download.cpp:
(WebKit::Download::decideDestinationWithSuggestedFilenameAsync):
(WebKit::Download::didDecideDownloadDestination):
(WebKit::Download::continueDidReceiveResponse):
(WebKit::Download::decideDestinationWithSuggestedFilename): Deleted.
* NetworkProcess/Downloads/Download.h:
* NetworkProcess/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::willDecidePendingDownloadDestination):
(WebKit::DownloadManager::continueDecidePendingDownloadDestination):
(WebKit::DownloadManager::convertHandleToDownload): Deleted.
* NetworkProcess/Downloads/DownloadManager.h:
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::continueDidReceiveResponse):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::continueDecidePendingDownloadDestination):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync): Deleted.
* UIProcess/Downloads/DownloadProxy.h:
* UIProcess/Downloads/DownloadProxy.messages.in:

LayoutTests:

* fast/dom/HTMLAnchorElement/anchor-download-expected.txt:
* fast/dom/HTMLAnchorElement/anchor-nodownload-set-expected.txt:
* http/tests/security/anchor-download-allow-blob-expected.txt:
Rebaseline several Blob download tests now that the "Download started"
message always comes first (as it should).

* platform/mac-wk2/TestExpectations:
Unskip test that is no longer flaky.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206396 => 206397)


--- trunk/LayoutTests/ChangeLog	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/LayoutTests/ChangeLog	2016-09-26 22:20:27 UTC (rev 206397)
@@ -1,3 +1,19 @@
+2016-09-26  Chris Dumez  <[email protected]>
+
+        [WK2] BlobDownloadClient should use asynchronous IPC to decide destination path
+        https://bugs.webkit.org/show_bug.cgi?id=162568
+
+        Reviewed by Alex Christensen.
+
+        * fast/dom/HTMLAnchorElement/anchor-download-expected.txt:
+        * fast/dom/HTMLAnchorElement/anchor-nodownload-set-expected.txt:
+        * http/tests/security/anchor-download-allow-blob-expected.txt:
+        Rebaseline several Blob download tests now that the "Download started"
+        message always comes first (as it should).
+
+        * platform/mac-wk2/TestExpectations:
+        Unskip test that is no longer flaky.
+
 2016-09-26  Nan Wang  <[email protected]>
 
         AX: Progress: [Mac] Content in label element should be used as AXTitle or AXDescription

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-expected.txt (206396 => 206397)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-expected.txt	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-expected.txt	2016-09-26 22:20:27 UTC (rev 206397)
@@ -1,4 +1,4 @@
+Download started.
 Downloading URL with suggested filename ""
-Download started.
 Download completed.
 Blob URL

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-nodownload-set-expected.txt (206396 => 206397)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-nodownload-set-expected.txt	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-nodownload-set-expected.txt	2016-09-26 22:20:27 UTC (rev 206397)
@@ -1,4 +1,4 @@
+Download started.
 Downloading URL with suggested filename ""
-Download started.
 Download completed.
 Blob URL

Modified: trunk/LayoutTests/http/tests/security/anchor-download-allow-blob-expected.txt (206396 => 206397)


--- trunk/LayoutTests/http/tests/security/anchor-download-allow-blob-expected.txt	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/LayoutTests/http/tests/security/anchor-download-allow-blob-expected.txt	2016-09-26 22:20:27 UTC (rev 206397)
@@ -1,5 +1,5 @@
+Download started.
 Downloading URL with suggested filename "foo.pdf"
-Download started.
 Download completed.
 Tests that a suggested filename on a download attribute is allowed if the link is a blob URL.
 

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (206396 => 206397)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2016-09-26 22:20:27 UTC (rev 206397)
@@ -210,9 +210,6 @@
 
 webkit.org/b/136109 fast/multicol/mixed-opacity-fixed-test.html  [ ImageOnlyFailure ]
 
-# Flaky on WebKit2.
-webkit.org/b/162543 fast/dom/HTMLAnchorElement/anchor-download.html [ Pass Failure ]
-
 # Reference expectation doesn't end up in compositing code path, leading to antialiasing differences.
 webkit.org/b/132421 fast/multicol/fixed-stack.html [ ImageOnlyFailure ]
 

Modified: trunk/Source/WebCore/ChangeLog (206396 => 206397)


--- trunk/Source/WebCore/ChangeLog	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebCore/ChangeLog	2016-09-26 22:20:27 UTC (rev 206397)
@@ -1,3 +1,22 @@
+2016-09-26  Chris Dumez  <[email protected]>
+
+        [WK2] BlobDownloadClient should use asynchronous IPC to decide destination path
+        https://bugs.webkit.org/show_bug.cgi?id=162568
+
+        Reviewed by Alex Christensen.
+
+        Update BlobResourceHandle to wait for continueDidReceiveResponse() to be
+        called after it calls the client's didReceiveResponseAsync(), before
+        actually reading the Blob Data.
+
+        No new tests, covered by existing tests.
+
+        * platform/network/BlobResourceHandle.cpp:
+        (WebCore::BlobResourceHandle::continueDidReceiveResponse):
+        (WebCore::BlobResourceHandle::getSizeForNext):
+        (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
+        (WebCore::BlobResourceHandle::notifyResponseOnError):
+
 2016-09-26  Daniel Bates  <[email protected]>
 
         Mark Ping{Handle, Load} as final

Modified: trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp (206396 => 206397)


--- trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp	2016-09-26 22:20:27 UTC (rev 206397)
@@ -158,7 +158,11 @@
 
 void BlobResourceHandle::continueDidReceiveResponse()
 {
-    // BlobResourceHandle doesn't wait for didReceiveResponse, and it currently cannot be used for downloading.
+    ASSERT(m_async);
+    ASSERT(usesAsyncCallbacks());
+
+    m_buffer.resize(bufferSize);
+    readAsync();
 }
 
 void BlobResourceHandle::start()
@@ -223,8 +227,10 @@
         if (m_async) {
             Ref<BlobResourceHandle> protectedThis(*this);
             notifyResponse();
-            m_buffer.resize(bufferSize);
-            readAsync();
+            if (!usesAsyncCallbacks()) {
+                m_buffer.resize(bufferSize);
+                readAsync();
+            }
         }
         return;
     }
@@ -568,9 +574,6 @@
     // as if the response had a Content-Disposition header with the filename parameter set to the File's name attribute.
     // Notably, this will affect a name suggested in "File Save As".
 
-    // 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 (usesAsyncCallbacks())
         client()->didReceiveResponseAsync(this, WTFMove(response));
     else
@@ -597,8 +600,6 @@
         break;
     }
 
-    // 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 (usesAsyncCallbacks())
         client()->didReceiveResponseAsync(this, WTFMove(response));
     else

Modified: trunk/Source/WebKit2/ChangeLog (206396 => 206397)


--- trunk/Source/WebKit2/ChangeLog	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebKit2/ChangeLog	2016-09-26 22:20:27 UTC (rev 206397)
@@ -1,3 +1,47 @@
+2016-09-26  Chris Dumez  <[email protected]>
+
+        [WK2] BlobDownloadClient should use asynchronous IPC to decide destination path
+        https://bugs.webkit.org/show_bug.cgi?id=162568
+
+        Reviewed by Alex Christensen.
+
+        Use DecideDestinationWithSuggestedFilenameAsync IPC to decide the destination
+        path in the case of Blob downloads, instead of the synchronous alternative.
+        To achieve this, BlobResourceHandle was updated in WebCore to properly support
+        asynchronous callback and BlobDownloadClient was updated to use asynchronous
+        callbacks. When BlobDownloadClient::didReceiveResponseAsync() is called, we
+        now ask the WebContent process asynchronously to decide what the destination
+        path should be. Then, when we later get the destination path back from the
+        WebContent process, we create the file on disk and call
+        continueDidReceiveResponse() on the BlobResourceHandle so we start getting the
+        blob data to write.
+
+        * NetworkProcess/Downloads/BlobDownloadClient.cpp:
+        (WebKit::BlobDownloadClient::didReceiveResponseAsync):
+        (WebKit::BlobDownloadClient::didDecideDownloadDestination):
+        * NetworkProcess/Downloads/BlobDownloadClient.h:
+        * NetworkProcess/Downloads/Download.cpp:
+        (WebKit::Download::decideDestinationWithSuggestedFilenameAsync):
+        (WebKit::Download::didDecideDownloadDestination):
+        (WebKit::Download::continueDidReceiveResponse):
+        (WebKit::Download::decideDestinationWithSuggestedFilename): Deleted.
+        * NetworkProcess/Downloads/Download.h:
+        * NetworkProcess/Downloads/DownloadManager.cpp:
+        (WebKit::DownloadManager::willDecidePendingDownloadDestination):
+        (WebKit::DownloadManager::continueDecidePendingDownloadDestination):
+        (WebKit::DownloadManager::convertHandleToDownload): Deleted.
+        * NetworkProcess/Downloads/DownloadManager.h:
+        * NetworkProcess/NetworkLoad.cpp:
+        (WebKit::NetworkLoad::continueDidReceiveResponse):
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::continueDecidePendingDownloadDestination):
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+        * UIProcess/Downloads/DownloadProxy.cpp:
+        (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync): Deleted.
+        * UIProcess/Downloads/DownloadProxy.h:
+        * UIProcess/Downloads/DownloadProxy.messages.in:
+
 2016-09-26  Daniel Bates  <[email protected]>
 
         Mark Ping{Handle, Load} as final

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.cpp (206396 => 206397)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.cpp	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.cpp	2016-09-26 22:20:27 UTC (rev 206397)
@@ -41,27 +41,29 @@
 {
 }
 
-void BlobDownloadClient::didReceiveResponse(ResourceHandle*, ResourceResponse&& response)
+void BlobDownloadClient::didReceiveResponseAsync(ResourceHandle*, ResourceResponse&& response)
 {
     m_download.didReceiveResponse(WTFMove(response));
+    m_download.decideDestinationWithSuggestedFilenameAsync(m_download.suggestedName());
+}
 
-    bool allowOverwrite = false;
-    m_destinationPath = m_download.decideDestinationWithSuggestedFilename(m_download.suggestedName(), allowOverwrite);
-    if (m_destinationPath.isEmpty()) {
-        didFail(nullptr, cancelledError(m_download.request()));
-        return;
-    }
-    if (fileExists(m_destinationPath)) {
+void BlobDownloadClient::didDecideDownloadDestination(const String& destinationPath, bool allowOverwrite)
+{
+    ASSERT(!destinationPath.isEmpty());
+
+    if (fileExists(destinationPath)) {
         if (!allowOverwrite) {
-            m_destinationPath = emptyString();
             didFail(nullptr, cancelledError(m_download.request()));
             return;
         }
-        deleteFile(m_destinationPath);
+        deleteFile(destinationPath);
     }
 
+    m_destinationPath = destinationPath;
     m_destinationFile = openFile(m_destinationPath, OpenForWrite);
     m_download.didCreateDestination(m_destinationPath);
+
+    m_download.continueDidReceiveResponse();
 }
 
 void BlobDownloadClient::didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&& buffer, int)

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.h (206396 => 206397)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.h	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.h	2016-09-26 22:20:27 UTC (rev 206397)
@@ -39,13 +39,15 @@
     explicit BlobDownloadClient(Download&);
 
     void didCancel();
+    void didDecideDownloadDestination(const String& destinationPath, bool allowOverwrite);
 
 private:
     // ResourceHandleClient
-    void didReceiveResponse(WebCore::ResourceHandle*, WebCore::ResourceResponse&&) final;
+    void didReceiveResponseAsync(WebCore::ResourceHandle*, WebCore::ResourceResponse&&) final;
     void didReceiveBuffer(WebCore::ResourceHandle*, Ref<WebCore::SharedBuffer>&&, int reportedEncodedDataLength) final;
     void didFinishLoading(WebCore::ResourceHandle*, double finishTime) final;
     void didFail(WebCore::ResourceHandle*, const WebCore::ResourceError&) final;
+    bool usesAsyncCallbacks() final { return true; }
 
     Download& m_download;
     String m_destinationPath;

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/Download.cpp (206396 => 206397)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/Download.cpp	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/Download.cpp	2016-09-26 22:20:27 UTC (rev 206397)
@@ -146,6 +146,8 @@
     return result;
 }
 
+#if !USE(NETWORK_SESSION)
+
 String Download::decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite)
 {
     String destination;
@@ -160,6 +162,34 @@
     return destination;
 }
 
+#endif
+
+void Download::decideDestinationWithSuggestedFilenameAsync(const String& suggestedFilename)
+{
+    send(Messages::DownloadProxy::DecideDestinationWithSuggestedFilenameAsync(downloadID(), suggestedFilename));
+}
+
+void Download::didDecideDownloadDestination(const String& destinationPath, const SandboxExtension::Handle& sandboxExtensionHandle, bool allowOverwrite)
+{
+    ASSERT(!m_sandboxExtension);
+    m_sandboxExtension = SandboxExtension::create(sandboxExtensionHandle);
+    if (m_sandboxExtension)
+        m_sandboxExtension->consume();
+
+    if (m_request.url().protocolIsBlob()) {
+        static_cast<BlobDownloadClient*>(m_downloadClient.get())->didDecideDownloadDestination(destinationPath, allowOverwrite);
+        return;
+    }
+
+    // For now, only Blob URL downloads go through this code path.
+    ASSERT_NOT_REACHED();
+}
+
+void Download::continueDidReceiveResponse()
+{
+    m_resourceHandle->continueDidReceiveResponse();
+}
+
 void Download::didCreateDestination(const String& path)
 {
     send(Messages::DownloadProxy::DidCreateDestination(path));

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/Download.h (206396 => 206397)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/Download.h	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/Download.h	2016-09-26 22:20:27 UTC (rev 206397)
@@ -100,7 +100,12 @@
     void didReceiveResponse(const WebCore::ResourceResponse&);
     void didReceiveData(uint64_t length);
     bool shouldDecodeSourceDataOfMIMEType(const String& mimeType);
+#if !USE(NETWORK_SESSION)
     String decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite);
+#endif
+    void decideDestinationWithSuggestedFilenameAsync(const String&);
+    void didDecideDownloadDestination(const String& destinationPath, const SandboxExtension::Handle&, bool allowOverwrite);
+    void continueDidReceiveResponse();
     void didCreateDestination(const String& path);
     void didFinish();
     void platformDidFinish();

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp (206396 => 206397)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp	2016-09-26 22:20:27 UTC (rev 206397)
@@ -105,25 +105,6 @@
     auto addResult = m_downloadsWaitingForDestination.set(downloadID, std::make_pair<RefPtr<NetworkDataTask>, ResponseCompletionHandler>(&networkDataTask, WTFMove(completionHandler)));
     ASSERT_UNUSED(addResult, addResult.isNewEntry);
 }
-
-void DownloadManager::continueDecidePendingDownloadDestination(DownloadID downloadID, String destination, const SandboxExtension::Handle& sandboxExtensionHandle, bool allowOverwrite)
-{
-    auto pair = m_downloadsWaitingForDestination.take(downloadID);
-    auto networkDataTask = WTFMove(pair.first);
-    auto completionHandler = WTFMove(pair.second);
-    if (!networkDataTask || !completionHandler)
-        return;
-
-    networkDataTask->setPendingDownloadLocation(destination, sandboxExtensionHandle);
-    
-    if (allowOverwrite && fileExists(destination))
-        deleteFile(destination);
-
-    completionHandler(PolicyDownload);
-    
-    ASSERT(!m_downloadsAfterDestinationDecided.contains(downloadID));
-    m_downloadsAfterDestinationDecided.set(downloadID, networkDataTask);
-}
 #else
 void DownloadManager::convertHandleToDownload(DownloadID downloadID, ResourceHandle* handle, const ResourceRequest& request, const ResourceResponse& response)
 {
@@ -135,6 +116,32 @@
 }
 #endif
 
+void DownloadManager::continueDecidePendingDownloadDestination(DownloadID downloadID, String destination, const SandboxExtension::Handle& sandboxExtensionHandle, bool allowOverwrite)
+{
+#if USE(NETWORK_SESSION)
+    if (m_downloadsWaitingForDestination.contains(downloadID)) {
+        auto pair = m_downloadsWaitingForDestination.take(downloadID);
+        auto networkDataTask = WTFMove(pair.first);
+        auto completionHandler = WTFMove(pair.second);
+        if (!networkDataTask || !completionHandler)
+            return;
+
+        networkDataTask->setPendingDownloadLocation(destination, sandboxExtensionHandle);
+
+        if (allowOverwrite && fileExists(destination))
+            deleteFile(destination);
+
+        completionHandler(PolicyDownload);
+
+        ASSERT(!m_downloadsAfterDestinationDecided.contains(downloadID));
+        m_downloadsAfterDestinationDecided.set(downloadID, networkDataTask);
+        return;
+    }
+#endif
+    if (auto* waitingDownload = download(downloadID))
+        waitingDownload->didDecideDownloadDestination(destination, sandboxExtensionHandle, allowOverwrite);
+}
+
 void DownloadManager::resumeDownload(SessionID, DownloadID downloadID, const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle& sandboxExtensionHandle)
 {
 #if USE(NETWORK_SESSION)

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h (206396 => 206397)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h	2016-09-26 22:20:27 UTC (rev 206397)
@@ -80,10 +80,10 @@
     void continueCanAuthenticateAgainstProtectionSpace(DownloadID, bool canAuthenticate);
     void continueWillSendRequest(DownloadID, WebCore::ResourceRequest&&);
     void willDecidePendingDownloadDestination(NetworkDataTask&, ResponseCompletionHandler&&);
-    void continueDecidePendingDownloadDestination(DownloadID, String destination, const SandboxExtension::Handle&, bool allowOverwrite);
 #else
     void convertHandleToDownload(DownloadID, WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
 #endif
+    void continueDecidePendingDownloadDestination(DownloadID, String destination, const SandboxExtension::Handle&, bool allowOverwrite);
 
     void resumeDownload(WebCore::SessionID, DownloadID, const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle&);
 

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp (206396 => 206397)


--- trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp	2016-09-26 22:20:27 UTC (rev 206397)
@@ -149,7 +149,6 @@
 void NetworkLoad::continueDidReceiveResponse()
 {
 #if USE(NETWORK_SESSION)
-    ASSERT(m_responseCompletionHandler);
     if (m_responseCompletionHandler) {
         m_responseCompletionHandler(PolicyUse);
         m_responseCompletionHandler = nullptr;

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (206396 => 206397)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp	2016-09-26 22:20:27 UTC (rev 206397)
@@ -525,7 +525,8 @@
     downloadManager().willDecidePendingDownloadDestination(networkDataTask, WTFMove(completionHandler));
     downloadProxyConnection()->send(Messages::DownloadProxy::DecideDestinationWithSuggestedFilenameAsync(networkDataTask.pendingDownloadID(), networkDataTask.suggestedFilename()), destinationID);
 }
-    
+#endif
+
 void NetworkProcess::continueDecidePendingDownloadDestination(DownloadID downloadID, String destination, const SandboxExtension::Handle& sandboxExtensionHandle, bool allowOverwrite)
 {
     if (destination.isEmpty())
@@ -533,7 +534,6 @@
     else
         downloadManager().continueDecidePendingDownloadDestination(downloadID, destination, sandboxExtensionHandle, allowOverwrite);
 }
-#endif
 
 void NetworkProcess::setCacheModel(uint32_t cm)
 {

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (206396 => 206397)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h	2016-09-26 22:20:27 UTC (rev 206397)
@@ -179,8 +179,9 @@
 #if USE(NETWORK_SESSION)
     void continueCanAuthenticateAgainstProtectionSpaceDownload(DownloadID, bool canAuthenticate);
     void continueWillSendRequest(DownloadID, WebCore::ResourceRequest&&);
+#endif
     void continueDecidePendingDownloadDestination(DownloadID, String destination, const SandboxExtension::Handle& sandboxExtensionHandle, bool allowOverwrite);
-#endif
+
     void setCacheModel(uint32_t);
     void allowSpecificHTTPSCertificateForHost(const WebCore::CertificateInfo&, const String& host);
     void setCanHandleHTTPSServerTrustEvaluation(bool);

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in (206396 => 206397)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in	2016-09-26 22:20:27 UTC (rev 206397)
@@ -51,8 +51,8 @@
 #if USE(NETWORK_SESSION)
     ContinueCanAuthenticateAgainstProtectionSpaceDownload(WebKit::DownloadID downloadID, bool canAuthenticate)
     ContinueWillSendRequest(WebKit::DownloadID downloadID, WebCore::ResourceRequest request)
+#endif
     ContinueDecidePendingDownloadDestination(WebKit::DownloadID downloadID, String destination, WebKit::SandboxExtension::Handle sandboxExtensionHandle, bool allowOverwrite)
-#endif
 
     SetProcessSuppressionEnabled(bool flag)
 #if PLATFORM(COCOA)

Modified: trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp (206396 => 206397)


--- trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp	2016-09-26 22:20:27 UTC (rev 206397)
@@ -172,7 +172,6 @@
     result = m_processPool->downloadClient().shouldDecodeSourceDataOfMIMEType(m_processPool.get(), this, mimeType);
 }
 
-#if USE(NETWORK_SESSION)
 void DownloadProxy::decideDestinationWithSuggestedFilenameAsync(DownloadID downloadID, const String& suggestedFilename)
 {
     bool allowOverwrite = false;
@@ -189,8 +188,9 @@
     if (NetworkProcessProxy* networkProcess = m_processPool->networkProcess())
         networkProcess->connection()->send(Messages::NetworkProcess::ContinueDecidePendingDownloadDestination(downloadID, destination, sandboxExtensionHandle, allowOverwrite), 0);
 }
-#endif
 
+#if !USE(NETWORK_SESSION)
+
 void DownloadProxy::decideDestinationWithSuggestedFilename(const String& filename, String& destination, bool& allowOverwrite, SandboxExtension::Handle& sandboxExtensionHandle)
 {
     allowOverwrite = false;
@@ -208,6 +208,8 @@
         SandboxExtension::createHandle(destination, SandboxExtension::ReadWrite, sandboxExtensionHandle);
 }
 
+#endif
+
 void DownloadProxy::didCreateDestination(const String& path)
 {
     if (!m_processPool)

Modified: trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h (206396 => 206397)


--- trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h	2016-09-26 22:20:27 UTC (rev 206397)
@@ -82,7 +82,6 @@
     void didReceiveResponse(const WebCore::ResourceResponse&);
     void didReceiveData(uint64_t length);
     void shouldDecodeSourceDataOfMIMEType(const String& mimeType, bool& result);
-    void decideDestinationWithSuggestedFilename(const String& filename, String& destination, bool& allowOverwrite, SandboxExtension::Handle& sandboxExtensionHandle);
     void didCreateDestination(const String& path);
     void didFinish();
     void didFail(const WebCore::ResourceError&, const IPC::DataReference& resumeData);
@@ -90,8 +89,10 @@
 #if USE(NETWORK_SESSION)
     void canAuthenticateAgainstProtectionSpace(const WebCore::ProtectionSpace&);
     void willSendRequest(const WebCore::ResourceRequest& redirectRequest, const WebCore::ResourceResponse& redirectResponse);
+#else
+    void decideDestinationWithSuggestedFilename(const String& filename, String& destination, bool& allowOverwrite, SandboxExtension::Handle& sandboxExtensionHandle);
+#endif
     void decideDestinationWithSuggestedFilenameAsync(DownloadID, const String& suggestedFilename);
-#endif
 
     DownloadProxyMap& m_downloadProxyMap;
     RefPtr<WebProcessPool> m_processPool;

Modified: trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in (206396 => 206397)


--- trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in	2016-09-26 21:55:34 UTC (rev 206396)
+++ trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in	2016-09-26 22:20:27 UTC (rev 206397)
@@ -26,13 +26,15 @@
 #if USE(NETWORK_SESSION)
     WillSendRequest(WebCore::ResourceRequest redirectRequest, WebCore::ResourceResponse redirectResponse));
     CanAuthenticateAgainstProtectionSpace(WebCore::ProtectionSpace protectionSpace)
+#endif
     DecideDestinationWithSuggestedFilenameAsync(WebKit::DownloadID downloadID, String suggestedFilename)
-#endif
 
     DidReceiveResponse(WebCore::ResourceResponse response)
     DidReceiveData(uint64_t length)
     ShouldDecodeSourceDataOfMIMEType(String mimeType) -> (bool result)
+#if !USE(NETWORK_SESSION)
     DecideDestinationWithSuggestedFilename(String filename) -> (String destination, bool allowOverwrite, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
+#endif
     DidCreateDestination(String path)
     DidFinish()
     DidFail(WebCore::ResourceError error, IPC::DataReference resumeData)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to