Title: [208344] trunk/Source
Revision
208344
Author
achristen...@apple.com
Date
2016-11-03 14:06:31 -0700 (Thu, 03 Nov 2016)

Log Message

Unreviewed, rolling out r208298.
Source/WebCore:

https://bugs.webkit.org/show_bug.cgi?id=163939

caused asan crashes

Reverted changeset:

"NetworkSession: Add NetworkDataTask implementation for blobs"
https://bugs.webkit.org/show_bug.cgi?id=163939
http://trac.webkit.org/changeset/208298

Source/WebCore/platform/gtk/po:


caused

Reverted changeset:

"NetworkSession: Add NetworkDataTask implementation for blobs"
https://bugs.webkit.org/show_bug.cgi?id=163939
http://trac.webkit.org/changeset/208298

Source/WebKit2:

https://bugs.webkit.org/show_bug.cgi?id=163939

caused asan crashes

Reverted changeset:

"NetworkSession: Add NetworkDataTask implementation for blobs"
https://bugs.webkit.org/show_bug.cgi?id=163939
http://trac.webkit.org/changeset/208298

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (208343 => 208344)


--- trunk/Source/WebCore/ChangeLog	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebCore/ChangeLog	2016-11-03 21:06:31 UTC (rev 208344)
@@ -1,3 +1,16 @@
+2016-11-03  Alex Christensen  <achristen...@webkit.org>
+
+        Unreviewed, rolling out r208298.
+        https://bugs.webkit.org/show_bug.cgi?id=163939
+
+        caused asan crashes
+
+        Reverted changeset:
+
+        "NetworkSession: Add NetworkDataTask implementation for blobs"
+        https://bugs.webkit.org/show_bug.cgi?id=163939
+        http://trac.webkit.org/changeset/208298
+
 2016-11-03  Brent Fulgham  <bfulg...@apple.com>
 
         [Win][Direct2D] Native Windows widgets are drawn upside-down

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (208343 => 208344)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-11-03 21:06:31 UTC (rev 208344)
@@ -2060,7 +2060,7 @@
 		514C76700CE923A1007EF3CD /* FormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C765B0CE923A1007EF3CD /* FormData.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		514C76710CE923A1007EF3CD /* HTTPHeaderMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C765C0CE923A1007EF3CD /* HTTPHeaderMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		514C76720CE923A1007EF3CD /* HTTPParsers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C765D0CE923A1007EF3CD /* HTTPParsers.cpp */; };
-		514C76730CE923A1007EF3CD /* HTTPParsers.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C765E0CE923A1007EF3CD /* HTTPParsers.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		514C76730CE923A1007EF3CD /* HTTPParsers.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C765E0CE923A1007EF3CD /* HTTPParsers.h */; };
 		514C76740CE923A1007EF3CD /* ProtectionSpaceBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C765F0CE923A1007EF3CD /* ProtectionSpaceBase.cpp */; };
 		514C76750CE923A1007EF3CD /* ProtectionSpaceBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76600CE923A1007EF3CD /* ProtectionSpaceBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		514C76780CE923A1007EF3CD /* ResourceHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76630CE923A1007EF3CD /* ResourceHandle.cpp */; };
@@ -6179,7 +6179,7 @@
 		E1CA5CBC0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CBB0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp */; };
 		E1CAA5C60E8BD23600A73ECA /* JSWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CAA5C50E8BD23600A73ECA /* JSWorker.h */; };
 		E1CDE92015018ED000862CC5 /* AsyncFileStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CDE91F15018ED000862CC5 /* AsyncFileStream.cpp */; };
-		E1CDE9221501916900862CC5 /* AsyncFileStream.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CDE9211501916900862CC5 /* AsyncFileStream.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		E1CDE9221501916900862CC5 /* AsyncFileStream.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CDE9211501916900862CC5 /* AsyncFileStream.h */; settings = {ATTRIBUTES = (); }; };
 		E1D31CDC19196020001005A3 /* BlobDataFileReference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1D31CDA19196020001005A3 /* BlobDataFileReference.cpp */; };
 		E1D31CDD19196020001005A3 /* BlobDataFileReference.h in Headers */ = {isa = PBXBuildFile; fileRef = E1D31CDB19196020001005A3 /* BlobDataFileReference.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E1E1BF00115FF6FB006F52CA /* WindowsKeyboardCodes.h in Headers */ = {isa = PBXBuildFile; fileRef = E1E1BEFF115FF6FB006F52CA /* WindowsKeyboardCodes.h */; settings = {ATTRIBUTES = (Private, ); }; };

Modified: trunk/Source/WebCore/fileapi/AsyncFileStream.h (208343 => 208344)


--- trunk/Source/WebCore/fileapi/AsyncFileStream.h	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebCore/fileapi/AsyncFileStream.h	2016-11-03 21:06:31 UTC (rev 208344)
@@ -42,7 +42,7 @@
 class FileStream;
 class URL;
 
-class WEBCORE_EXPORT AsyncFileStream {
+class AsyncFileStream {
 public:
     explicit AsyncFileStream(FileStreamClient&);
     ~AsyncFileStream();

Modified: trunk/Source/WebCore/platform/gtk/po/ChangeLog (208343 => 208344)


--- trunk/Source/WebCore/platform/gtk/po/ChangeLog	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebCore/platform/gtk/po/ChangeLog	2016-11-03 21:06:31 UTC (rev 208344)
@@ -1,3 +1,15 @@
+2016-11-03  Alex Christensen  <achristen...@webkit.org>
+
+        Unreviewed, rolling out r208298.
+
+        caused
+
+        Reverted changeset:
+
+        "NetworkSession: Add NetworkDataTask implementation for blobs"
+        https://bugs.webkit.org/show_bug.cgi?id=163939
+        http://trac.webkit.org/changeset/208298
+
 2016-11-02  Carlos Garcia Campos  <cgar...@igalia.com>
 
         NetworkSession: Add NetworkDataTask implementation for blobs

Modified: trunk/Source/WebCore/platform/gtk/po/POTFILES.in (208343 => 208344)


--- trunk/Source/WebCore/platform/gtk/po/POTFILES.in	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebCore/platform/gtk/po/POTFILES.in	2016-11-03 21:06:31 UTC (rev 208344)
@@ -1,6 +1,7 @@
 # List of source files which contain translatable strings.
 ErrorsGtk.cpp
 LocalizedStringsGtk.cpp
+../../../WebKit2/NetworkProcess/Downloads/soup/DownloadSoup.cpp
 ../../../WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp
 ../../../WebKit2/UIProcess/API/gtk/WebKitDownload.cpp
 ../../../WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp

Modified: trunk/Source/WebCore/platform/network/BlobData.h (208343 => 208344)


--- trunk/Source/WebCore/platform/network/BlobData.h	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebCore/platform/network/BlobData.h	2016-11-03 21:06:31 UTC (rev 208344)
@@ -59,7 +59,7 @@
     BlobDataFileReference* file() const { return m_file.get(); }
 
     long long offset() const { return m_offset; }
-    WEBCORE_EXPORT long long length() const; // Computes file length if it's not known yet.
+    long long length() const; // Computes file length if it's not known yet.
 
 private:
     friend class BlobData;

Modified: trunk/Source/WebCore/platform/network/HTTPParsers.h (208343 => 208344)


--- trunk/Source/WebCore/platform/network/HTTPParsers.h	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebCore/platform/network/HTTPParsers.h	2016-11-03 21:06:31 UTC (rev 208344)
@@ -81,7 +81,7 @@
 XFrameOptionsDisposition parseXFrameOptionsHeader(const String&);
 
 // -1 could be set to one of the return parameters to indicate the value is not specified.
-WEBCORE_EXPORT bool parseRange(const String&, long long& rangeOffset, long long& rangeEnd, long long& rangeSuffixLength);
+bool parseRange(const String&, long long& rangeOffset, long long& rangeEnd, long long& rangeSuffixLength);
 
 #if ENABLE(NOSNIFF)
 ContentTypeOptionsDisposition parseContentTypeOptionsHeader(const String& header);

Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (208343 => 208344)


--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h	2016-11-03 21:06:31 UTC (rev 208344)
@@ -99,7 +99,7 @@
     String httpHeaderField(const String& name) const;
     WEBCORE_EXPORT String httpHeaderField(HTTPHeaderName) const;
     WEBCORE_EXPORT void setHTTPHeaderField(const String& name, const String& value);
-    WEBCORE_EXPORT void setHTTPHeaderField(HTTPHeaderName, const String& value);
+    void setHTTPHeaderField(HTTPHeaderName, const String& value);
 
     void addHTTPHeaderField(HTTPHeaderName, const String& value);
     void addHTTPHeaderField(const String& name, const String& value);

Modified: trunk/Source/WebKit2/CMakeLists.txt (208343 => 208344)


--- trunk/Source/WebKit2/CMakeLists.txt	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/CMakeLists.txt	2016-11-03 21:06:31 UTC (rev 208344)
@@ -181,7 +181,6 @@
 set(NetworkProcess_COMMON_SOURCES
     NetworkProcess/NetworkConnectionToWebProcess.cpp
     NetworkProcess/NetworkDataTask.cpp
-    NetworkProcess/NetworkDataTaskBlob.cpp
     NetworkProcess/NetworkLoad.cpp
     NetworkProcess/NetworkProcess.cpp
     NetworkProcess/NetworkProcessPlatformStrategies.cpp

Modified: trunk/Source/WebKit2/ChangeLog (208343 => 208344)


--- trunk/Source/WebKit2/ChangeLog	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/ChangeLog	2016-11-03 21:06:31 UTC (rev 208344)
@@ -1,3 +1,16 @@
+2016-11-03  Alex Christensen  <achristen...@webkit.org>
+
+        Unreviewed, rolling out r208298.
+        https://bugs.webkit.org/show_bug.cgi?id=163939
+
+        caused asan crashes
+
+        Reverted changeset:
+
+        "NetworkSession: Add NetworkDataTask implementation for blobs"
+        https://bugs.webkit.org/show_bug.cgi?id=163939
+        http://trac.webkit.org/changeset/208298
+
 2016-11-03  Ryan Haddad  <ryanhad...@apple.com>
 
         Unreviewed, rolling out r208330.

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.cpp (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.cpp	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.cpp	2016-11-03 21:06:31 UTC (rev 208344)
@@ -26,8 +26,6 @@
 #include "config.h"
 #include "BlobDownloadClient.h"
 
-#if !USE(NETWORK_SESSION)
-
 #include "DataReference.h"
 #include "Download.h"
 #include "WebErrors.h"
@@ -99,5 +97,3 @@
 }
 
 }
-
-#endif // !USE(NETWORK_SESSION)

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.h (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.h	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.h	2016-11-03 21:06:31 UTC (rev 208344)
@@ -25,8 +25,6 @@
 
 #pragma once
 
-#if !USE(NETWORK_SESSION)
-
 #include <WebCore/FileSystem.h>
 #include <WebCore/ResourceHandleClient.h>
 #include <wtf/RefPtr.h>
@@ -57,5 +55,3 @@
 };
 
 }
-
-#endif // !USE(NETWORK_SESSION)

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/Download.cpp (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/Download.cpp	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/Download.cpp	2016-11-03 21:06:31 UTC (rev 208344)
@@ -45,10 +45,10 @@
 namespace WebKit {
 
 #if USE(NETWORK_SESSION)
-Download::Download(DownloadManager& downloadManager, DownloadID downloadID, NetworkDataTask& download, const SessionID& sessionID, const String& suggestedName)
+Download::Download(DownloadManager& downloadManager, DownloadID downloadID, PlatformDownloadTaskRef download, const WebCore::SessionID& sessionID, const String& suggestedName)
     : m_downloadManager(downloadManager)
     , m_downloadID(downloadID)
-    , m_download(&download)
+    , m_download(download)
     , m_sessionID(sessionID)
     , m_suggestedName(suggestedName)
 {
@@ -56,20 +56,8 @@
 
     m_downloadManager.didCreateDownload();
 }
-#if PLATFORM(COCOA)
-Download::Download(DownloadManager& downloadManager, DownloadID downloadID, NSURLSessionDownloadTask* download, const SessionID& sessionID, const String& suggestedName)
-    : m_downloadManager(downloadManager)
-    , m_downloadID(downloadID)
-    , m_downloadTask(download)
-    , m_sessionID(sessionID)
-    , m_suggestedName(suggestedName)
-{
-    ASSERT(m_downloadID.downloadID());
+#endif
 
-    m_downloadManager.didCreateDownload();
-}
-#endif
-#else
 Download::Download(DownloadManager& downloadManager, DownloadID downloadID, const ResourceRequest& request, const String& suggestedName)
     : m_downloadManager(downloadManager)
     , m_downloadID(downloadID)
@@ -80,11 +68,9 @@
 
     m_downloadManager.didCreateDownload();
 }
-#endif // USE(NETWORK_SESSION)
 
 Download::~Download()
 {
-#if !USE(NETWORK_SESSION)
     if (m_resourceHandle) {
         m_resourceHandle->clearClient();
         m_resourceHandle->cancel();
@@ -93,12 +79,10 @@
     m_downloadClient = nullptr;
 
     platformInvalidate();
-#endif
 
     m_downloadManager.didDestroyDownload();
 }
 
-#if !USE(NETWORK_SESSION)
 void Download::start()
 {
     if (m_request.url().protocolIsBlob()) {
@@ -108,7 +92,11 @@
         return;
     }
 
+#if USE(NETWORK_SESSION)
+    ASSERT_NOT_REACHED();
+#else
     startNetworkLoad();
+#endif
 }
 
 void Download::startWithHandle(ResourceHandle* handle, const ResourceResponse& response)
@@ -120,19 +108,17 @@
         return;
     }
 
+#if USE(NETWORK_SESSION)
+    UNUSED_PARAM(handle);
+    UNUSED_PARAM(response);
+    ASSERT_NOT_REACHED();
+#else
     startNetworkLoadWithHandle(handle, response);
+#endif
 }
-#endif
 
 void Download::cancel()
 {
-#if USE(NETWORK_SESSION)
-    if (m_download) {
-        m_download->cancel();
-        didCancel({ });
-        return;
-    }
-#else
     if (m_request.url().protocolIsBlob()) {
         auto resourceHandle = WTFMove(m_resourceHandle);
         resourceHandle->cancel();
@@ -139,20 +125,20 @@
         static_cast<BlobDownloadClient*>(m_downloadClient.get())->didCancel();
         return;
     }
-#endif
-    platformCancelNetworkLoad();
+    cancelNetworkLoad();
 }
 
-#if !USE(NETWORK_SESSION)
 void Download::didStart()
 {
     send(Messages::DownloadProxy::DidStart(m_request, m_suggestedName));
 }
 
+#if !USE(NETWORK_SESSION)
 void Download::didReceiveAuthenticationChallenge(const AuthenticationChallenge& authenticationChallenge)
 {
     m_downloadManager.downloadsAuthenticationManager().didReceiveAuthenticationChallenge(*this, authenticationChallenge);
 }
+#endif
 
 void Download::didReceiveResponse(const ResourceResponse& response)
 {
@@ -161,6 +147,16 @@
     send(Messages::DownloadProxy::DidReceiveResponse(response));
 }
 
+void Download::didReceiveData(uint64_t length)
+{
+    if (!m_hasReceivedData) {
+        RELEASE_LOG_IF_ALLOWED("didReceiveData: Started receiving data (id = %" PRIu64 ")", downloadID().downloadID());
+        m_hasReceivedData = true;
+    }
+
+    send(Messages::DownloadProxy::DidReceiveData(length));
+}
+
 bool Download::shouldDecodeSourceDataOfMIMEType(const String& mimeType)
 {
     bool result;
@@ -170,6 +166,8 @@
     return result;
 }
 
+#if !USE(NETWORK_SESSION)
+
 String Download::decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite)
 {
     String destination;
@@ -184,6 +182,8 @@
     return destination;
 }
 
+#endif
+
 void Download::decideDestinationWithSuggestedFilenameAsync(const String& suggestedFilename)
 {
     send(Messages::DownloadProxy::DecideDestinationWithSuggestedFilenameAsync(downloadID(), suggestedFilename));
@@ -209,7 +209,6 @@
 {
     m_resourceHandle->continueDidReceiveResponse();
 }
-#endif
 
 void Download::didCreateDestination(const String& path)
 {
@@ -216,23 +215,11 @@
     send(Messages::DownloadProxy::DidCreateDestination(path));
 }
 
-void Download::didReceiveData(uint64_t length)
-{
-    if (!m_hasReceivedData) {
-        RELEASE_LOG_IF_ALLOWED("didReceiveData: Started receiving data (id = %" PRIu64 ")", downloadID().downloadID());
-        m_hasReceivedData = true;
-    }
-
-    send(Messages::DownloadProxy::DidReceiveData(length));
-}
-
 void Download::didFinish()
 {
     RELEASE_LOG_IF_ALLOWED("didFinish: (id = %" PRIu64 ")", downloadID().downloadID());
 
-#if !USE(NETWORK_SESSION)
     platformDidFinish();
-#endif
 
     send(Messages::DownloadProxy::DidFinish());
 
@@ -290,10 +277,4 @@
 #endif
 }
 
-#if !PLATFORM(COCOA)
-void Download::platformCancelNetworkLoad()
-{
-}
-#endif
-
 } // namespace WebKit

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/Download.h (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/Download.h	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/Download.h	2016-11-03 21:06:31 UTC (rev 208344)
@@ -40,6 +40,12 @@
 #if USE(NETWORK_SESSION)
 #if PLATFORM(COCOA)
 OBJC_CLASS NSURLSessionDownloadTask;
+typedef NSURLSessionDownloadTask* PlatformDownloadTaskRef;
+#elif USE(SOUP)
+namespace WebKit {
+class NetworkDataTask;
+}
+typedef WebKit::NetworkDataTask* PlatformDownloadTaskRef;
 #endif
 #else // USE(NETWORK_SESSION)
 #if PLATFORM(COCOA)
@@ -67,7 +73,6 @@
 namespace WebKit {
 
 class DownloadManager;
-class NetworkDataTask;
 class NetworkSession;
 class WebPage;
 
@@ -75,43 +80,39 @@
     WTF_MAKE_NONCOPYABLE(Download); WTF_MAKE_FAST_ALLOCATED;
 public:
 #if USE(NETWORK_SESSION)
-    Download(DownloadManager&, DownloadID, NetworkDataTask&, const WebCore::SessionID& sessionID, const String& suggestedFilename = { });
-#if PLATFORM(COCOA)
-    Download(DownloadManager&, DownloadID, NSURLSessionDownloadTask*, const WebCore::SessionID& sessionID, const String& suggestedFilename = { });
+    Download(DownloadManager&, DownloadID, PlatformDownloadTaskRef, const WebCore::SessionID& sessionID, const String& suggestedFilename = { });
 #endif
-#else
     Download(DownloadManager&, DownloadID, const WebCore::ResourceRequest&, const String& suggestedFilename = { });
-#endif
 
     ~Download();
 
-#if !USE(NETWORK_SESSION)
     void start();
     void startWithHandle(WebCore::ResourceHandle*, const WebCore::ResourceResponse&);
-#endif
     void resume(const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle&);
     void cancel();
 
     DownloadID downloadID() const { return m_downloadID; }
     const String& suggestedName() const { return m_suggestedName; }
+    const WebCore::ResourceRequest& request() const { return m_request; }
 
 #if USE(NETWORK_SESSION)
     void setSandboxExtension(RefPtr<SandboxExtension>&& sandboxExtension) { m_sandboxExtension = WTFMove(sandboxExtension); }
 #else
-    const WebCore::ResourceRequest& request() const { return m_request; }
     void didReceiveAuthenticationChallenge(const WebCore::AuthenticationChallenge&);
+#endif
     void didStart();
     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 platformDidFinish();
-#endif
     void didCreateDestination(const String& path);
-    void didReceiveData(uint64_t length);
     void didFinish();
+    void platformDidFinish();
     void didFail(const WebCore::ResourceError&, const IPC::DataReference& resumeData);
     void didCancel(const IPC::DataReference& resumeData);
 
@@ -123,35 +124,37 @@
 #if !USE(NETWORK_SESSION)
     void startNetworkLoad();
     void startNetworkLoadWithHandle(WebCore::ResourceHandle*, const WebCore::ResourceResponse&);
-    void platformInvalidate();
 #endif
-    void platformCancelNetworkLoad();
+    void cancelNetworkLoad();
 
+    void platformInvalidate();
+
     bool isAlwaysOnLoggingAllowed() const;
 
     DownloadManager& m_downloadManager;
     DownloadID m_downloadID;
+    WebCore::ResourceRequest m_request;
 
     RefPtr<SandboxExtension> m_sandboxExtension;
 
 #if USE(NETWORK_SESSION)
+#if PLATFORM(COCOA)
+    RetainPtr<NSURLSessionDownloadTask> m_download;
+#elif USE(SOUP)
     RefPtr<NetworkDataTask> m_download;
-#if PLATFORM(COCOA)
-    RetainPtr<NSURLSessionDownloadTask> m_downloadTask;
 #endif
     WebCore::SessionID m_sessionID;
 #else // USE(NETWORK_SESSION)
-    WebCore::ResourceRequest m_request;
 #if PLATFORM(COCOA)
     RetainPtr<NSURLDownload> m_nsURLDownload;
     RetainPtr<WKDownloadAsDelegate> m_delegate;
 #endif
+#endif // USE(NETWORK_SESSION)
 #if USE(CFURLCONNECTION)
     RetainPtr<CFURLDownloadRef> m_download;
 #endif
     std::unique_ptr<WebCore::ResourceHandleClient> m_downloadClient;
     RefPtr<WebCore::ResourceHandle> m_resourceHandle;
-#endif // USE(NETWORK_SESSION)
     String m_suggestedName;
     bool m_hasReceivedData { false };
 };

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp	2016-11-03 21:06:31 UTC (rev 208344)
@@ -47,21 +47,23 @@
 void DownloadManager::startDownload(SessionID sessionID, DownloadID downloadID, const ResourceRequest& request, const String& suggestedName)
 {
 #if USE(NETWORK_SESSION)
-    auto* networkSession = SessionTracker::networkSession(sessionID);
-    if (!networkSession)
+    if (!request.url().protocolIsBlob()) {
+        auto* networkSession = SessionTracker::networkSession(sessionID);
+        if (!networkSession)
+            return;
+        NetworkLoadParameters parameters;
+        parameters.sessionID = sessionID;
+        parameters.request = request;
+        parameters.clientCredentialPolicy = ClientCredentialPolicy::MayAskClientForCredentials;
+        m_pendingDownloads.add(downloadID, std::make_unique<PendingDownload>(WTFMove(parameters), downloadID, *networkSession, suggestedName));
         return;
-    NetworkLoadParameters parameters;
-    parameters.sessionID = sessionID;
-    parameters.request = request;
-    parameters.clientCredentialPolicy = ClientCredentialPolicy::MayAskClientForCredentials;
-    m_pendingDownloads.add(downloadID, std::make_unique<PendingDownload>(WTFMove(parameters), downloadID, *networkSession, suggestedName));
-#else
+    }
+#endif
     auto download = std::make_unique<Download>(*this, downloadID, request, suggestedName);
     download->start();
 
     ASSERT(!m_downloads.contains(downloadID));
     m_downloads.add(downloadID, WTFMove(download));
-#endif
 }
 
 #if USE(NETWORK_SESSION)
@@ -97,7 +99,8 @@
     auto addResult = m_downloadsWaitingForDestination.set(downloadID, std::make_pair<RefPtr<NetworkDataTask>, ResponseCompletionHandler>(&networkDataTask, WTFMove(completionHandler)));
     ASSERT_UNUSED(addResult, addResult.isNewEntry);
 }
-#else
+#endif
+
 void DownloadManager::convertHandleToDownload(DownloadID downloadID, ResourceHandle* handle, const ResourceRequest& request, const ResourceResponse& response)
 {
     auto download = std::make_unique<Download>(*this, downloadID, request);
@@ -106,7 +109,6 @@
     ASSERT(!m_downloads.contains(downloadID));
     m_downloads.add(downloadID, WTFMove(download));
 }
-#endif // USE(NETWORK_SESSION)
 
 void DownloadManager::continueDecidePendingDownloadDestination(DownloadID downloadID, String destination, const SandboxExtension::Handle& sandboxExtensionHandle, bool allowOverwrite)
 {
@@ -132,11 +134,11 @@
 
         ASSERT(!m_downloadsAfterDestinationDecided.contains(downloadID));
         m_downloadsAfterDestinationDecided.set(downloadID, networkDataTask);
+        return;
     }
-#else
+#endif
     if (auto* waitingDownload = download(downloadID))
         waitingDownload->didDecideDownloadDestination(destination, sandboxExtensionHandle, allowOverwrite);
-#endif
 }
 
 void DownloadManager::resumeDownload(SessionID, DownloadID downloadID, const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle& sandboxExtensionHandle)

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h	2016-11-03 21:06:31 UTC (rev 208344)
@@ -80,9 +80,8 @@
 #endif
     void continueWillSendRequest(DownloadID, WebCore::ResourceRequest&&);
     void willDecidePendingDownloadDestination(NetworkDataTask&, ResponseCompletionHandler&&);
-#else
+#endif
     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/Downloads/cocoa/DownloadCocoa.mm (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/cocoa/DownloadCocoa.mm	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/cocoa/DownloadCocoa.mm	2016-11-03 21:06:31 UTC (rev 208344)
@@ -38,10 +38,10 @@
     notImplemented();
 }
     
-void Download::platformCancelNetworkLoad()
+void Download::cancelNetworkLoad()
 {
-    ASSERT(m_downloadTask);
-    [m_downloadTask cancelByProducingResumeData: ^(NSData * _Nullable resumeData)
+    ASSERT(m_download);
+    [m_download cancelByProducingResumeData: ^(NSData * _Nullable resumeData)
     {
         if (resumeData && resumeData.bytes && resumeData.length)
             didCancel(IPC::DataReference(reinterpret_cast<const uint8_t*>(resumeData.bytes), resumeData.length));
@@ -50,6 +50,15 @@
     }];
 }
 
+void Download::platformInvalidate()
+{
+    notImplemented();
 }
 
+void Download::platformDidFinish()
+{
+}
+    
+}
+
 #endif // USE(NETWORK_SESSION)

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/ios/DownloadIOS.mm (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/ios/DownloadIOS.mm	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/ios/DownloadIOS.mm	2016-11-03 21:06:31 UTC (rev 208344)
@@ -142,7 +142,7 @@
 #pragma clang diagnostic pop
 }
 
-void Download::platformCancelNetworkLoad()
+void Download::cancelNetworkLoad()
 {
     notImplemented();
 }

Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/mac/DownloadMac.mm (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/mac/DownloadMac.mm	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/mac/DownloadMac.mm	2016-11-03 21:06:31 UTC (rev 208344)
@@ -109,7 +109,7 @@
     [m_nsURLDownload setDeletesFileUponFailure:NO];
 }
 
-void Download::platformCancelNetworkLoad()
+void Download::cancelNetworkLoad()
 {
     [m_nsURLDownload cancel];
 

Copied: trunk/Source/WebKit2/NetworkProcess/Downloads/soup/DownloadSoup.cpp (from rev 208297, trunk/Source/WebKit2/NetworkProcess/Downloads/soup/DownloadSoup.cpp) (0 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/Downloads/soup/DownloadSoup.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/soup/DownloadSoup.cpp	2016-11-03 21:06:31 UTC (rev 208344)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Brent Fulgham <bfulg...@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Download.h"
+
+#include "DataReference.h"
+#include "NetworkDataTask.h"
+#include <WebCore/NotImplemented.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void Download::resume(const IPC::DataReference&, const String&, const SandboxExtension::Handle&)
+{
+    notImplemented();
+}
+
+void Download::cancelNetworkLoad()
+{
+    m_download->cancel();
+    didCancel({ });
+}
+
+void Download::platformInvalidate()
+{
+}
+
+void Download::platformDidFinish()
+{
+}
+
+} // namespace WebKit

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp	2016-11-03 21:06:31 UTC (rev 208344)
@@ -207,9 +207,12 @@
     }
 
 #if USE(NETWORK_SESSION)
-    loader->networkLoad()->convertTaskToDownload(downloadID, request, response);
-    loader->didConvertToDownload();
-#else
+    if (!request.url().protocolIsBlob()) {
+        loader->networkLoad()->convertTaskToDownload(downloadID, request, response);
+        loader->didConvertToDownload();
+        return;
+    }
+#endif
     networkProcess.downloadManager().convertHandleToDownload(downloadID, loader->networkLoad()->handle(), request, response);
 
     // Unblock the URL connection operation queue.
@@ -216,7 +219,6 @@
     loader->networkLoad()->handle()->continueDidReceiveResponse();
 
     loader->didConvertToDownload();
-#endif
 }
 
 void NetworkConnectionToWebProcess::cookiesForDOM(SessionID sessionID, const URL& firstParty, const URL& url, String& result)

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkDataTask.cpp (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/NetworkDataTask.cpp	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkDataTask.cpp	2016-11-03 21:06:31 UTC (rev 208344)
@@ -28,7 +28,6 @@
 
 #if USE(NETWORK_SESSION)
 
-#include "NetworkDataTaskBlob.h"
 #include "NetworkSession.h"
 #include <wtf/MainThread.h>
 
@@ -45,9 +44,6 @@
 
 Ref<NetworkDataTask> NetworkDataTask::create(NetworkSession& session, NetworkDataTaskClient& client, const ResourceRequest& request, StoredCredentials storedCredentials, ContentSniffingPolicy shouldContentSniff, bool shouldClearReferrerOnHTTPSToHTTPRedirect)
 {
-    if (request.url().protocolIsBlob())
-        return NetworkDataTaskBlob::create(session, client, request, shouldContentSniff);
-
 #if PLATFORM(COCOA)
     return NetworkDataTaskCocoa::create(session, client, request, storedCredentials, shouldContentSniff, shouldClearReferrerOnHTTPSToHTTPRedirect);
 #endif

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkDataTask.h (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/NetworkDataTask.h	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkDataTask.h	2016-11-03 21:06:31 UTC (rev 208344)
@@ -80,7 +80,6 @@
     virtual void suspend() = 0;
     virtual void cancel() = 0;
     virtual void resume() = 0;
-    virtual void invalidateAndCancel() = 0;
 
     enum class State {
         Running,

Deleted: trunk/Source/WebKit2/NetworkProcess/NetworkDataTaskBlob.cpp (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/NetworkDataTaskBlob.cpp	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkDataTaskBlob.cpp	2016-11-03 21:06:31 UTC (rev 208344)
@@ -1,582 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- * Copyright (C) 2016 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "NetworkDataTaskBlob.h"
-
-#if USE(NETWORK_SESSION)
-
-#include "DataReference.h"
-#include "Download.h"
-#include "Logging.h"
-#include "NetworkProcess.h"
-#include "NetworkSession.h"
-#include "WebErrors.h"
-#include <WebCore/AsyncFileStream.h>
-#include <WebCore/BlobData.h>
-#include <WebCore/BlobRegistryImpl.h>
-#include <WebCore/FileStream.h>
-#include <WebCore/HTTPHeaderNames.h>
-#include <WebCore/HTTPParsers.h>
-#include <WebCore/ParsedContentRange.h>
-#include <WebCore/ResourceError.h>
-#include <WebCore/ResourceResponse.h>
-#include <WebCore/SharedBuffer.h>
-#include <WebCore/URL.h>
-#include <wtf/MainThread.h>
-#include <wtf/RunLoop.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-static const unsigned bufferSize = 512 * 1024;
-
-static const int httpOK = 200;
-static const int httpPartialContent = 206;
-static const int httpNotAllowed = 403;
-static const int httpRequestedRangeNotSatisfiable = 416;
-static const int httpInternalError = 500;
-static const char* httpOKText = "OK";
-static const char* httpPartialContentText = "Partial Content";
-static const char* httpNotAllowedText = "Not Allowed";
-static const char* httpRequestedRangeNotSatisfiableText = "Requested Range Not Satisfiable";
-static const char* httpInternalErrorText = "Internal Server Error";
-
-static const char* const webKitBlobResourceDomain = "WebKitBlobResource";
-
-NetworkDataTaskBlob::NetworkDataTaskBlob(NetworkSession& session, NetworkDataTaskClient& client, const ResourceRequest& request, ContentSniffingPolicy shouldContentSniff)
-    : NetworkDataTask(session, client, request, DoNotAllowStoredCredentials, false)
-    , m_blobData(static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(request.url()))
-    , m_stream(std::make_unique<AsyncFileStream>(*this))
-{
-    m_session->registerNetworkDataTask(*this);
-    LOG(NetworkSession, "%p - Created NetworkDataTaskBlob for %s", this, request.url().string().utf8().data());
-}
-
-NetworkDataTaskBlob::~NetworkDataTaskBlob()
-{
-    clearStream();
-    m_session->unregisterNetworkDataTask(*this);
-}
-
-void NetworkDataTaskBlob::clearStream()
-{
-    if (m_state == State::Completed)
-        return;
-
-    m_state = State::Completed;
-
-    if (m_fileOpened) {
-        m_fileOpened = false;
-        m_stream->close();
-    }
-    m_stream = nullptr;
-}
-
-void NetworkDataTaskBlob::resume()
-{
-    ASSERT(m_state != State::Running);
-    if (m_state == State::Canceling || m_state == State::Completed)
-        return;
-
-    m_state = State::Running;
-
-    if (m_scheduledFailureType != NoFailure) {
-        ASSERT(m_failureTimer.isActive());
-        return;
-    }
-
-    RunLoop::main().dispatch([this, protectedThis = makeRef(*this)] {
-        if (m_state == State::Canceling || m_state == State::Completed || !m_client) {
-            clearStream();
-            return;
-        }
-
-        if (!equalLettersIgnoringASCIICase(m_firstRequest.httpMethod(), "get")) {
-            didFail(Error::MethodNotAllowed);
-            return;
-        }
-
-        // If the blob data is not found, fail now.
-        if (!m_blobData) {
-            didFail(Error::NotFoundError);
-            return;
-        }
-
-        // Parse the "Range" header we care about.
-        String range = m_firstRequest.httpHeaderField(HTTPHeaderName::Range);
-        if (!range.isEmpty() && !parseRange(range, m_rangeOffset, m_rangeEnd, m_rangeSuffixLength)) {
-            didReceiveResponse(Error::RangeError);
-            return;
-        }
-
-        getSizeForNext();
-    });
-}
-
-void NetworkDataTaskBlob::suspend()
-{
-    // FIXME: can this happen?
-}
-
-void NetworkDataTaskBlob::cancel()
-{
-    if (m_state == State::Canceling || m_state == State::Completed)
-        return;
-
-    m_state = State::Canceling;
-
-    if (m_fileOpened) {
-        m_fileOpened = false;
-        m_stream->close();
-    }
-
-    if (isDownload())
-        cleanDownloadFiles();
-}
-
-void NetworkDataTaskBlob::invalidateAndCancel()
-{
-    cancel();
-    clearStream();
-}
-
-void NetworkDataTaskBlob::getSizeForNext()
-{
-    ASSERT(isMainThread());
-
-    // Do we finish validating and counting size for all items?
-    if (m_sizeItemCount >= m_blobData->items().size()) {
-        seek();
-        didReceiveResponse();
-        return;
-    }
-
-    const BlobDataItem& item = m_blobData->items().at(m_sizeItemCount);
-    switch (item.type()) {
-    case BlobDataItem::Type::Data:
-        didGetSize(item.length());
-        break;
-    case BlobDataItem::Type::File:
-        // Files know their sizes, but asking the stream to verify that the file wasn't modified.
-        m_stream->getSize(item.file()->path(), item.file()->expectedModificationTime());
-        break;
-    default:
-        ASSERT_NOT_REACHED();
-    }
-}
-
-void NetworkDataTaskBlob::didGetSize(long long size)
-{
-    ASSERT(isMainThread());
-
-    if (m_state == State::Canceling || m_state == State::Completed || (!m_client && !isDownload())) {
-        clearStream();
-        return;
-    }
-
-    // If the size is -1, it means the file has been moved or changed. Fail now.
-    if (size == -1) {
-        didFail(Error::NotFoundError);
-        return;
-    }
-
-    // The size passed back is the size of the whole file. If the underlying item is a sliced file, we need to use the slice length.
-    const BlobDataItem& item = m_blobData->items().at(m_sizeItemCount);
-    size = item.length();
-
-    // Cache the size.
-    m_itemLengthList.append(size);
-
-    // Count the size.
-    m_totalSize += size;
-    m_totalRemainingSize += size;
-    m_sizeItemCount++;
-
-    // Continue with the next item.
-    getSizeForNext();
-}
-
-void NetworkDataTaskBlob::seek()
-{
-    ASSERT(isMainThread());
-
-    // Convert from the suffix length to the range.
-    if (m_rangeSuffixLength != kPositionNotSpecified) {
-        m_rangeOffset = m_totalRemainingSize - m_rangeSuffixLength;
-        m_rangeEnd = m_rangeOffset + m_rangeSuffixLength - 1;
-    }
-
-    // Bail out if the range is not provided.
-    if (m_rangeOffset == kPositionNotSpecified)
-        return;
-
-    // Skip the initial items that are not in the range.
-    long long offset = m_rangeOffset;
-    for (m_readItemCount = 0; m_readItemCount < m_blobData->items().size() && offset >= m_itemLengthList[m_readItemCount]; ++m_readItemCount)
-        offset -= m_itemLengthList[m_readItemCount];
-
-    // Set the offset that need to jump to for the first item in the range.
-    m_currentItemReadSize = offset;
-
-    // Adjust the total remaining size in order not to go beyond the range.
-    if (m_rangeEnd != kPositionNotSpecified) {
-        long long rangeSize = m_rangeEnd - m_rangeOffset + 1;
-        if (m_totalRemainingSize > rangeSize)
-            m_totalRemainingSize = rangeSize;
-    } else
-        m_totalRemainingSize -= m_rangeOffset;
-}
-
-void NetworkDataTaskBlob::didReceiveResponse(Error errorCode)
-{
-    LOG(NetworkSession, "%p - NetworkDataTaskBlob::didReceiveResponse(%u)", this, static_cast<unsigned>(errorCode));
-
-    Ref<NetworkDataTaskBlob> protectedThis(*this);
-    ResourceResponse response(m_firstRequest.url(), errorCode != Error::NoError ? "text/plain" : m_blobData->contentType(), errorCode != Error::NoError ? 0 : m_totalRemainingSize, String());
-    switch (errorCode) {
-    case Error::NoError: {
-        bool isRangeRequest = m_rangeOffset != kPositionNotSpecified;
-        response.setHTTPStatusCode(isRangeRequest ? httpPartialContent : httpOK);
-        response.setHTTPStatusText(isRangeRequest ? httpPartialContentText : httpOKText);
-
-        response.setHTTPHeaderField(HTTPHeaderName::ContentType, m_blobData->contentType());
-        response.setHTTPHeaderField(HTTPHeaderName::ContentLength, String::number(m_totalRemainingSize));
-
-        if (isRangeRequest)
-            response.setHTTPHeaderField(HTTPHeaderName::ContentRange, ParsedContentRange(m_rangeOffset, m_rangeEnd, m_totalSize).headerValue());
-        // FIXME: If a resource identified with a blob: URL is a File object, user agents must use that file's name attribute,
-        // 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".
-        break;
-    }
-    case Error::RangeError:
-        response.setHTTPStatusCode(httpRequestedRangeNotSatisfiable);
-        response.setHTTPStatusText(httpRequestedRangeNotSatisfiableText);
-        break;
-    case Error::SecurityError:
-        response.setHTTPStatusCode(httpNotAllowed);
-        response.setHTTPStatusText(httpNotAllowedText);
-        break;
-    default:
-        response.setHTTPStatusCode(httpInternalError);
-        response.setHTTPStatusText(httpInternalErrorText);
-        break;
-    }
-
-    m_client->didReceiveResponseNetworkSession(WTFMove(response), [this, protectedThis = WTFMove(protectedThis), errorCode](PolicyAction policyAction) {
-        LOG(NetworkSession, "%p - NetworkDataTaskBlob::didReceiveResponse completionHandler (%u)", this, static_cast<unsigned>(policyAction));
-
-        if (m_state == State::Canceling || m_state == State::Completed) {
-            clearStream();
-            return;
-        }
-
-        if (errorCode != Error::NoError) {
-            didFinish();
-            return;
-        }
-
-        switch (policyAction) {
-        case PolicyAction::PolicyUse:
-            m_buffer.resize(bufferSize);
-            read();
-            break;
-        case PolicyAction::PolicyIgnore:
-            break;
-        case PolicyAction::PolicyDownload:
-            download();
-            break;
-        }
-    });
-}
-
-void NetworkDataTaskBlob::read()
-{
-    ASSERT(isMainThread());
-
-    // If there is no more remaining data to read, we are done.
-    if (!m_totalRemainingSize || m_readItemCount >= m_blobData->items().size()) {
-        didFinish();
-        return;
-    }
-
-    const BlobDataItem& item = m_blobData->items().at(m_readItemCount);
-    if (item.type() == BlobDataItem::Type::Data)
-        readData(item);
-    else if (item.type() == BlobDataItem::Type::File)
-        readFile(item);
-    else
-        ASSERT_NOT_REACHED();
-}
-
-void NetworkDataTaskBlob::readData(const BlobDataItem& item)
-{
-    ASSERT(item.data().data());
-
-    long long bytesToRead = item.length() - m_currentItemReadSize;
-    if (bytesToRead > m_totalRemainingSize)
-        bytesToRead = m_totalRemainingSize;
-    consumeData(reinterpret_cast<const char*>(item.data().data()->data()) + item.offset() + m_currentItemReadSize, static_cast<int>(bytesToRead));
-    m_currentItemReadSize = 0;
-}
-
-void NetworkDataTaskBlob::readFile(const BlobDataItem& item)
-{
-    ASSERT(m_client);
-    ASSERT(m_stream);
-
-    if (m_fileOpened) {
-        m_stream->read(m_buffer.data(), m_buffer.size());
-        return;
-    }
-
-    long long bytesToRead = m_itemLengthList[m_readItemCount] - m_currentItemReadSize;
-    if (bytesToRead > m_totalRemainingSize)
-        bytesToRead = static_cast<int>(m_totalRemainingSize);
-    m_stream->openForRead(item.file()->path(), item.offset() + m_currentItemReadSize, bytesToRead);
-    m_fileOpened = true;
-    m_currentItemReadSize = 0;
-}
-
-void NetworkDataTaskBlob::didOpen(bool success)
-{
-    if (m_state == State::Canceling || m_state == State::Completed || (!m_client && !isDownload())) {
-        clearStream();
-        return;
-    }
-
-    if (!success) {
-        didFail(Error::NotReadableError);
-        return;
-    }
-
-    Ref<NetworkDataTaskBlob> protectedThis(*this);
-    read();
-}
-
-void NetworkDataTaskBlob::didRead(int bytesRead)
-{
-    if (m_state == State::Canceling || m_state == State::Completed || (!m_client && !isDownload())) {
-        clearStream();
-        return;
-    }
-
-    if (bytesRead < 0) {
-        didFail(Error::NotReadableError);
-        return;
-    }
-
-    Ref<NetworkDataTaskBlob> protectedThis(*this);
-    consumeData(m_buffer.data(), bytesRead);
-}
-
-void NetworkDataTaskBlob::consumeData(const char* data, int bytesRead)
-{
-    m_totalRemainingSize -= bytesRead;
-
-    if (bytesRead) {
-        if (m_downloadFile != invalidPlatformFileHandle) {
-            if (!writeDownload(data, bytesRead))
-                return;
-        } else {
-            ASSERT(m_client);
-            m_client->didReceiveData(SharedBuffer::create(data, bytesRead));
-        }
-    }
-
-    if (m_fileOpened) {
-        // When the current item is a file item, the reading is completed only if bytesRead is 0.
-        if (!bytesRead) {
-            // Close the file.
-            m_fileOpened = false;
-            m_stream->close();
-
-            // Move to the next item.
-            m_readItemCount++;
-        }
-    } else {
-        // Otherwise, we read the current text item as a whole and move to the next item.
-        m_readItemCount++;
-    }
-
-    read();
-}
-
-void NetworkDataTaskBlob::setPendingDownloadLocation(const String& filename, const SandboxExtension::Handle& sandboxExtensionHandle, bool allowOverwrite)
-{
-    NetworkDataTask::setPendingDownloadLocation(filename, sandboxExtensionHandle, allowOverwrite);
-
-    ASSERT(!m_sandboxExtension);
-    m_sandboxExtension = SandboxExtension::create(sandboxExtensionHandle);
-    if (m_sandboxExtension)
-        m_sandboxExtension->consume();
-
-    if (allowOverwrite && fileExists(m_pendingDownloadLocation))
-        deleteFile(m_pendingDownloadLocation);
-}
-
-String NetworkDataTaskBlob::suggestedFilename() const
-{
-    if (!m_suggestedFilename.isEmpty())
-        return m_suggestedFilename;
-
-    return ASCIILiteral("unknown");
-}
-
-void NetworkDataTaskBlob::download()
-{
-    ASSERT(isDownload());
-    ASSERT(m_pendingDownloadLocation);
-
-    LOG(NetworkSession, "%p - NetworkDataTaskBlob::download to %s", this, m_pendingDownloadLocation.utf8().data());
-
-    m_downloadFile = openFile(m_pendingDownloadLocation, OpenForWrite);
-    if (m_downloadFile == invalidPlatformFileHandle) {
-        didFailDownload(cancelledError(m_firstRequest));
-        return;
-    }
-
-    auto& downloadManager = NetworkProcess::singleton().downloadManager();
-    auto download = std::make_unique<Download>(downloadManager, m_pendingDownloadID, *this, m_session->sessionID(), suggestedFilename());
-    auto* downloadPtr = download.get();
-    downloadManager.dataTaskBecameDownloadTask(m_pendingDownloadID, WTFMove(download));
-    downloadPtr->didCreateDestination(m_pendingDownloadLocation);
-
-    ASSERT(m_client);
-    m_client->didBecomeDownload();
-
-    m_buffer.resize(bufferSize);
-    read();
-}
-
-bool NetworkDataTaskBlob::writeDownload(const char* data, int bytesRead)
-{
-    ASSERT(isDownload());
-    int bytesWritten = writeToFile(m_downloadFile, data, bytesRead);
-    if (bytesWritten == -1) {
-        didFailDownload(cancelledError(m_firstRequest));
-        return false;
-    }
-
-    ASSERT(bytesWritten == bytesRead);
-    auto* download = NetworkProcess::singleton().downloadManager().download(m_pendingDownloadID);
-    ASSERT(download);
-    download->didReceiveData(bytesWritten);
-    return true;
-}
-
-void NetworkDataTaskBlob::cleanDownloadFiles()
-{
-    if (m_downloadFile != invalidPlatformFileHandle) {
-        closeFile(m_downloadFile);
-        m_downloadFile = invalidPlatformFileHandle;
-    }
-    deleteFile(m_pendingDownloadLocation);
-}
-
-void NetworkDataTaskBlob::didFailDownload(const ResourceError& error)
-{
-    LOG(NetworkSession, "%p - NetworkDataTaskBlob::didFailDownload", this);
-
-    clearStream();
-    cleanDownloadFiles();
-
-    if (m_sandboxExtension) {
-        m_sandboxExtension->revoke();
-        m_sandboxExtension = nullptr;
-    }
-
-    if (m_client)
-        m_client->didCompleteWithError(error);
-    else {
-        auto* download = NetworkProcess::singleton().downloadManager().download(m_pendingDownloadID);
-        ASSERT(download);
-        download->didFail(error, IPC::DataReference());
-    }
-}
-
-void NetworkDataTaskBlob::didFinishDownload()
-{
-    LOG(NetworkSession, "%p - NetworkDataTaskBlob::didFinishDownload", this);
-
-    ASSERT(isDownload());
-    closeFile(m_downloadFile);
-    m_downloadFile = invalidPlatformFileHandle;
-
-    if (m_sandboxExtension) {
-        m_sandboxExtension->revoke();
-        m_sandboxExtension = nullptr;
-    }
-
-    clearStream();
-    auto* download = NetworkProcess::singleton().downloadManager().download(m_pendingDownloadID);
-    ASSERT(download);
-    download->didFinish();
-}
-
-void NetworkDataTaskBlob::didFail(Error errorCode)
-{
-    ASSERT(!m_sandboxExtension);
-
-    Ref<NetworkDataTaskBlob> protectedThis(*this);
-    if (isDownload()) {
-        didFailDownload(ResourceError(webKitBlobResourceDomain, static_cast<int>(errorCode), m_firstRequest.url(), String()));
-        return;
-    }
-
-    LOG(NetworkSession, "%p - NetworkDataTaskBlob::didFail", this);
-
-    clearStream();
-    ASSERT(m_client);
-    m_client->didCompleteWithError(ResourceError(webKitBlobResourceDomain, static_cast<int>(errorCode), m_firstRequest.url(), String()));
-}
-
-void NetworkDataTaskBlob::didFinish()
-{
-    if (m_downloadFile != invalidPlatformFileHandle) {
-        didFinishDownload();
-        return;
-    }
-
-    ASSERT(!m_sandboxExtension);
-
-    LOG(NetworkSession, "%p - NetworkDataTaskBlob::didFinish", this);
-
-    clearStream();
-    ASSERT(m_client);
-    m_client->didCompleteWithError({ });
-}
-
-} // namespace WebKit
-
-#endif // USE(NETWORK_SESSION)

Deleted: trunk/Source/WebKit2/NetworkProcess/NetworkDataTaskBlob.h (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/NetworkDataTaskBlob.h	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkDataTaskBlob.h	2016-11-03 21:06:31 UTC (rev 208344)
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- * Copyright (C) 2016 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if USE(NETWORK_SESSION)
-
-#include "NetworkDataTask.h"
-#include <WebCore/FileStreamClient.h>
-#include <WebCore/FileSystem.h>
-
-namespace WebCore {
-class AsyncFileStream;
-class BlobData;
-class BlobDataItem;
-}
-
-namespace WebKit {
-
-class NetworkDataTaskBlob final : public NetworkDataTask, public WebCore::FileStreamClient {
-public:
-    static Ref<NetworkDataTask> create(NetworkSession& session, NetworkDataTaskClient& client, const WebCore::ResourceRequest& request, WebCore::ContentSniffingPolicy shouldContentSniff)
-    {
-        return adoptRef(*new NetworkDataTaskBlob(session, client, request, shouldContentSniff));
-    }
-
-    ~NetworkDataTaskBlob();
-
-private:
-    NetworkDataTaskBlob(NetworkSession&, NetworkDataTaskClient&, const WebCore::ResourceRequest&, WebCore::ContentSniffingPolicy);
-
-    void suspend() override;
-    void cancel() override;
-    void resume() override;
-    void invalidateAndCancel() override;
-    NetworkDataTask::State state() const override { return m_state; }
-
-    void setPendingDownloadLocation(const String&, const SandboxExtension::Handle&, bool /*allowOverwrite*/) override;
-    String suggestedFilename() const override;
-
-    // FileStreamClient methods.
-    void didGetSize(long long) override;
-    void didOpen(bool) override;
-    void didRead(int) override;
-
-    enum class Error {
-        NoError = 0,
-        NotFoundError = 1,
-        SecurityError = 2,
-        RangeError = 3,
-        NotReadableError = 4,
-        MethodNotAllowed = 5
-    };
-
-    void clearStream();
-    void getSizeForNext();
-    void didReceiveResponse(Error = Error::NoError);
-    void seek();
-    void consumeData(const char* data, int bytesRead);
-    void read();
-    void readData(const WebCore::BlobDataItem&);
-    void readFile(const WebCore::BlobDataItem&);
-    void download();
-    bool writeDownload(const char* data, int bytesRead);
-    void cleanDownloadFiles();
-    void didFailDownload(const WebCore::ResourceError&);
-    void didFinishDownload();
-    void didFail(Error);
-    void didFinish();
-
-    enum { kPositionNotSpecified = -1 };
-
-    RefPtr<WebCore::BlobData> m_blobData;
-    std::unique_ptr<WebCore::AsyncFileStream> m_stream; // For asynchronous loading.
-    Vector<char> m_buffer;
-    Vector<long long> m_itemLengthList;
-    State m_state { State::Suspended };
-    long long m_rangeOffset { kPositionNotSpecified };
-    long long m_rangeEnd { kPositionNotSpecified };
-    long long m_rangeSuffixLength { kPositionNotSpecified };
-    long long m_totalSize { 0 };
-    long long m_totalRemainingSize { 0 };
-    long long m_currentItemReadSize { 0 };
-    unsigned m_sizeItemCount { 0 };
-    unsigned m_readItemCount { 0 };
-    bool m_fileOpened { false };
-    WebCore::PlatformFileHandle m_downloadFile { WebCore::invalidPlatformFileHandle };
-    RefPtr<SandboxExtension> m_sandboxExtension;
-};
-
-} // namespace WebKit
-
-#endif // USE(NETWORK_SESSION)

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp	2016-11-03 21:06:31 UTC (rev 208344)
@@ -67,6 +67,10 @@
     , m_parameters(WTFMove(parameters))
     , m_currentRequest(m_parameters.request)
 {
+    if (m_parameters.request.url().protocolIsBlob()) {
+        m_handle = ResourceHandle::create(nullptr, m_parameters.request, this, m_parameters.defersLoading, m_parameters.contentSniffingPolicy == SniffContent);
+        return;
+    }
     m_task = NetworkDataTask::create(networkSession, *this, m_parameters.request, m_parameters.allowStoredCredentials, m_parameters.contentSniffingPolicy, m_parameters.shouldClearReferrerOnHTTPSToHTTPRedirect);
     if (!m_parameters.defersLoading)
         m_task->resume();
@@ -97,14 +101,12 @@
 #endif
     if (m_task)
         m_task->clearClient();
-#else
-#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+#elif USE(PROTECTION_SPACE_AUTH_CALLBACK)
     if (m_handle && m_waitingForContinueCanAuthenticateAgainstProtectionSpace)
         m_handle->continueCanAuthenticateAgainstProtectionSpace(false);
 #endif
     if (m_handle)
         m_handle->clearClient();
-#endif
 }
 
 void NetworkLoad::setDefersLoading(bool defers)
@@ -116,10 +118,9 @@
         else
             m_task->resume();
     }
-#else
+#endif
     if (m_handle)
         m_handle->setDefersLoading(defers);
-#endif
 }
 
 void NetworkLoad::cancel()
@@ -127,10 +128,9 @@
 #if USE(NETWORK_SESSION)
     if (m_task)
         m_task->cancel();
-#else
+#endif
     if (m_handle)
         m_handle->cancel();
-#endif
 }
 
 void NetworkLoad::continueWillSendRequest(WebCore::ResourceRequest&& newRequest)
@@ -143,21 +143,27 @@
 #endif
 
 #if USE(NETWORK_SESSION)
-    auto redirectCompletionHandler = std::exchange(m_redirectCompletionHandler, nullptr);
-    if (m_currentRequest.isNull())
-        didCompleteWithError(cancelledError(m_currentRequest));
+    auto redirectCompletionHandler = std::exchange(m_redirectCompletionHandler, nullptr);    
     ASSERT(redirectCompletionHandler);
-    if (redirectCompletionHandler)
-        redirectCompletionHandler(m_currentRequest);
-#else
+#endif
+    
     if (m_currentRequest.isNull()) {
         if (m_handle)
             m_handle->cancel();
         didFail(m_handle.get(), cancelledError(m_currentRequest));
+#if USE(NETWORK_SESSION)
+        if (redirectCompletionHandler)
+            redirectCompletionHandler({ });
+#endif
+        return;
     } else if (m_handle) {
         auto currentRequestCopy = m_currentRequest;
         m_handle->continueWillSendRequest(WTFMove(currentRequestCopy));
     }
+
+#if USE(NETWORK_SESSION)
+    if (redirectCompletionHandler)
+        redirectCompletionHandler(m_currentRequest);
 #endif
 }
 
@@ -165,13 +171,12 @@
 {
 #if USE(NETWORK_SESSION)
     if (m_responseCompletionHandler) {
-        auto responseCompletionHandler = std::exchange(m_responseCompletionHandler, nullptr);
-        responseCompletionHandler(PolicyUse);
+        m_responseCompletionHandler(PolicyUse);
+        m_responseCompletionHandler = nullptr;
     }
-#else
+#endif
     if (m_handle)
         m_handle->continueDidReceiveResponse();
-#endif
 }
 
 NetworkLoadClient::ShouldContinueDidReceiveResponse NetworkLoad::sharedDidReceiveResponse(ResourceResponse&& response)
@@ -280,23 +285,6 @@
         NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(m_parameters.webPageID, m_parameters.webFrameID, *m_challenge, WTFMove(completionHandler));
 }
 
-#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-void NetworkLoad::continueCanAuthenticateAgainstProtectionSpace(bool result)
-{
-    ASSERT(m_challengeCompletionHandler);
-    auto completionHandler = std::exchange(m_challengeCompletionHandler, nullptr);
-    if (!result) {
-        if (m_task && m_task->allowsSpecificHTTPSCertificateForHost(*m_challenge))
-            completionHandler(AuthenticationChallengeDisposition::UseCredential, serverTrustCredential(*m_challenge));
-        else
-            completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpace, { });
-        return;
-    }
-
-    completeAuthenticationChallenge(WTFMove(completionHandler));
-}
-#endif
-
 void NetworkLoad::didReceiveResponseNetworkSession(ResourceResponse&& response, ResponseCompletionHandler&& completionHandler)
 {
     ASSERT(isMainThread());
@@ -374,9 +362,9 @@
 {
     m_client.didFailLoading(cannotShowURLError(m_currentRequest));
 }
+    
+#endif
 
-#else
-
 void NetworkLoad::didReceiveResponseAsync(ResourceHandle* handle, ResourceResponse&& receivedResponse)
 {
     ASSERT_UNUSED(handle, handle == m_handle);
@@ -430,13 +418,32 @@
         return;
     }
 
+#if !USE(NETWORK_SESSION)
     m_waitingForContinueCanAuthenticateAgainstProtectionSpace = true;
+#endif
     m_client.canAuthenticateAgainstProtectionSpaceAsync(protectionSpace);
 }
+#endif
 
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
 void NetworkLoad::continueCanAuthenticateAgainstProtectionSpace(bool result)
 {
+#if USE(NETWORK_SESSION)
+    ASSERT_WITH_MESSAGE(!m_handle, "Blobs should never give authentication challenges");
+    ASSERT(m_challengeCompletionHandler);
+    auto completionHandler = std::exchange(m_challengeCompletionHandler, nullptr);
+    if (!result) {
+        if (m_task && m_task->allowsSpecificHTTPSCertificateForHost(*m_challenge))
+            completionHandler(AuthenticationChallengeDisposition::UseCredential, serverTrustCredential(*m_challenge));
+        else
+            completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpace, { });
+        return;
+    }
+
+    completeAuthenticationChallenge(WTFMove(completionHandler));
+#else
     m_waitingForContinueCanAuthenticateAgainstProtectionSpace = false;
+#endif
     if (m_handle)
         m_handle->continueCanAuthenticateAgainstProtectionSpace(result);
 }
@@ -508,6 +515,5 @@
     m_handle->cancel();
     didFail(m_handle.get(), cancelledError(m_currentRequest));
 }
-#endif // USE(NETWORK_SESSION)
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkLoad.h (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/NetworkLoad.h	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkLoad.h	2016-11-03 21:06:31 UTC (rev 208344)
@@ -40,11 +40,9 @@
 
 namespace WebKit {
 
-class NetworkLoad final :
+class NetworkLoad final : private WebCore::ResourceHandleClient
 #if USE(NETWORK_SESSION)
-    private NetworkDataTaskClient
-#else
-    private WebCore::ResourceHandleClient
+    , private NetworkDataTaskClient
 #endif
 {
     WTF_MAKE_FAST_ALLOCATED;
@@ -71,8 +69,7 @@
     void setSuggestedFilename(const String&);
     void setPendingDownload(PendingDownload&);
     DownloadID pendingDownloadID() { return m_task->pendingDownloadID(); }
-#else
-    WebCore::ResourceHandle* handle() const { return m_handle.get(); }
+#endif
 
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     void canAuthenticateAgainstProtectionSpaceAsync(WebCore::ResourceHandle*, const WebCore::ProtectionSpace&) override;
@@ -88,17 +85,17 @@
     void willCacheResponseAsync(WebCore::ResourceHandle*, NSCachedURLResponse *) override;
 #endif
 #endif
-#endif // USE(NETWORK_SESSION)
 
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     void continueCanAuthenticateAgainstProtectionSpace(bool);
 #endif
 
+    WebCore::ResourceHandle* handle() const { return m_handle.get(); }
+
 private:
     NetworkLoadClient::ShouldContinueDidReceiveResponse sharedDidReceiveResponse(WebCore::ResourceResponse&&);
     void sharedWillSendRedirectedRequest(WebCore::ResourceRequest&&, WebCore::ResourceResponse&&);
 
-#if !USE(NETWORK_SESSION)
     // ResourceHandleClient
     void willSendRequestAsync(WebCore::ResourceHandle*, WebCore::ResourceRequest&&, WebCore::ResourceResponse&& redirectResponse) final;
     void didSendData(WebCore::ResourceHandle*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) final;
@@ -114,7 +111,8 @@
     void receivedCancellation(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) final;
     bool usesAsyncCallbacks() final { return true; }
     bool loadingSynchronousXHR() final { return m_client.isSynchronous(); }
-#else
+
+#if USE(NETWORK_SESSION)
     // NetworkDataTaskClient
     void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler&&) final;
     void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&) final;
@@ -148,8 +146,8 @@
 #else
     bool m_waitingForContinueCanAuthenticateAgainstProtectionSpace { false };
     RefPtr<RemoteNetworkingContext> m_networkingContext;
+#endif
     RefPtr<WebCore::ResourceHandle> m_handle;
-#endif
 
     WebCore::ResourceRequest m_currentRequest; // Updated on redirects.
 };

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkSession.cpp (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/NetworkSession.cpp	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkSession.cpp	2016-11-03 21:06:31 UTC (rev 208344)
@@ -28,7 +28,6 @@
 
 #if USE(NETWORK_SESSION)
 
-#include "NetworkDataTask.h"
 #include <WebCore/NetworkStorageSession.h>
 #include <wtf/MainThread.h>
 
@@ -82,12 +81,6 @@
 {
 }
 
-void NetworkSession::invalidateAndCancel()
-{
-    for (auto* task : m_dataTaskSet)
-        task->invalidateAndCancel();
-}
-
 } // namespace WebKit
 
 #endif // USE(NETWORK_SESSION)

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkSession.h (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/NetworkSession.h	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkSession.h	2016-11-03 21:06:31 UTC (rev 208344)
@@ -28,7 +28,6 @@
 #if USE(NETWORK_SESSION)
 
 #include <WebCore/SessionID.h>
-#include <wtf/HashSet.h>
 #include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
 
@@ -39,7 +38,6 @@
 namespace WebKit {
 
 class CustomProtocolManager;
-class NetworkDataTask;
 
 class NetworkSession : public RefCounted<NetworkSession> {
 public:
@@ -47,21 +45,16 @@
     static NetworkSession& defaultSession();
     virtual ~NetworkSession();
 
-    virtual void invalidateAndCancel();
+    virtual void invalidateAndCancel() = 0;
     virtual void clearCredentials() { };
 
     WebCore::SessionID sessionID() const { return m_sessionID; }
     WebCore::NetworkStorageSession& networkStorageSession() const;
 
-    void registerNetworkDataTask(NetworkDataTask& task) { m_dataTaskSet.add(&task); }
-    void unregisterNetworkDataTask(NetworkDataTask& task) { m_dataTaskSet.remove(&task); }
-
 protected:
     NetworkSession(WebCore::SessionID);
 
     WebCore::SessionID m_sessionID;
-
-    HashSet<NetworkDataTask*> m_dataTaskSet;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.h (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.h	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.h	2016-11-03 21:06:31 UTC (rev 208344)
@@ -61,7 +61,6 @@
     void suspend() override;
     void cancel() override;
     void resume() override;
-    void invalidateAndCancel() override { }
     NetworkDataTask::State state() const override;
 
     void setPendingDownloadLocation(const String&, const SandboxExtension::Handle&, bool /*allowOverwrite*/) override;

Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2016-11-03 21:06:31 UTC (rev 208344)
@@ -466,8 +466,6 @@
 
 void NetworkSessionCocoa::invalidateAndCancel()
 {
-    NetworkSession::invalidateAndCancel();
-
     [m_sessionWithCredentialStorage invalidateAndCancel];
     [m_sessionWithoutCredentialStorage invalidateAndCancel];
 }

Modified: trunk/Source/WebKit2/NetworkProcess/mac/NetworkLoadMac.mm (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/mac/NetworkLoadMac.mm	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/mac/NetworkLoadMac.mm	2016-11-03 21:06:31 UTC (rev 208344)
@@ -26,8 +26,6 @@
 #import "config.h"
 #import "NetworkLoad.h"
 
-#if !USE(NETWORK_SESSION)
-
 #import <WebCore/CFNetworkSPI.h>
 #import <WebCore/ResourceHandle.h>
 
@@ -56,5 +54,3 @@
 #endif // !USE(CFURLCONNECTION)
 
 } // namespace WebKit
-
-#endif // !USE(NETWORK_SESSION)

Modified: trunk/Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.cpp (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.cpp	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.cpp	2016-11-03 21:06:31 UTC (rev 208344)
@@ -52,7 +52,7 @@
     , m_shouldContentSniff(shouldContentSniff)
     , m_timeoutSource(RunLoop::main(), this, &NetworkDataTaskSoup::timeoutFired)
 {
-    m_session->registerNetworkDataTask(*this);
+    static_cast<NetworkSessionSoup&>(m_session.get()).registerNetworkDataTask(*this);
     if (m_scheduledFailureType != NoFailure)
         return;
 
@@ -80,7 +80,7 @@
 NetworkDataTaskSoup::~NetworkDataTaskSoup()
 {
     clearRequest();
-    m_session->unregisterNetworkDataTask(*this);
+    static_cast<NetworkSessionSoup&>(m_session.get()).unregisterNetworkDataTask(*this);
 }
 
 String NetworkDataTaskSoup::suggestedFilename() const
@@ -863,7 +863,7 @@
     m_downloadOutputStream = adoptGRef(G_OUTPUT_STREAM(outputStream.leakRef()));
 
     auto& downloadManager = NetworkProcess::singleton().downloadManager();
-    auto download = std::make_unique<Download>(downloadManager, m_pendingDownloadID, *this, m_session->sessionID(), suggestedFilename());
+    auto download = std::make_unique<Download>(downloadManager, m_pendingDownloadID, this, m_session->sessionID(), suggestedFilename());
     auto* downloadPtr = download.get();
     downloadManager.dataTaskBecameDownloadTask(m_pendingDownloadID, WTFMove(download));
     downloadPtr->didCreateDestination(m_pendingDownloadLocation);

Modified: trunk/Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.h (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.h	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.h	2016-11-03 21:06:31 UTC (rev 208344)
@@ -42,6 +42,8 @@
 
     ~NetworkDataTaskSoup();
 
+    void invalidateAndCancel();
+
 private:
     NetworkDataTaskSoup(NetworkSession&, NetworkDataTaskClient&, const WebCore::ResourceRequest&, WebCore::StoredCredentials, WebCore::ContentSniffingPolicy, bool shouldClearReferrerOnHTTPSToHTTPRedirect);
 
@@ -48,7 +50,6 @@
     void suspend() override;
     void cancel() override;
     void resume() override;
-    void invalidateAndCancel() override;
     NetworkDataTask::State state() const override;
 
     void setPendingDownloadLocation(const String&, const SandboxExtension::Handle&, bool /*allowOverwrite*/) override;

Modified: trunk/Source/WebKit2/NetworkProcess/soup/NetworkSessionSoup.cpp (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/soup/NetworkSessionSoup.cpp	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/soup/NetworkSessionSoup.cpp	2016-11-03 21:06:31 UTC (rev 208344)
@@ -26,8 +26,10 @@
 #include "config.h"
 #include "NetworkSessionSoup.h"
 
+#include "NetworkDataTaskSoup.h"
 #include <WebCore/NetworkStorageSession.h>
 #include <WebCore/SoupNetworkSession.h>
+#include <wtf/MainThread.h>
 
 using namespace WebCore;
 
@@ -47,4 +49,10 @@
     return networkStorageSession().soupNetworkSession().soupSession();
 }
 
+void NetworkSessionSoup::invalidateAndCancel()
+{
+    for (auto* task : m_dataTaskSet)
+        task->invalidateAndCancel();
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/NetworkProcess/soup/NetworkSessionSoup.h (208343 => 208344)


--- trunk/Source/WebKit2/NetworkProcess/soup/NetworkSessionSoup.h	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/NetworkProcess/soup/NetworkSessionSoup.h	2016-11-03 21:06:31 UTC (rev 208344)
@@ -26,11 +26,14 @@
 #pragma once
 
 #include "NetworkSession.h"
+#include <wtf/HashSet.h>
 
 typedef struct _SoupSession SoupSession;
 
 namespace WebKit {
 
+class NetworkDataTaskSoup;
+
 class NetworkSessionSoup final : public NetworkSession {
 public:
     static Ref<NetworkSession> create(WebCore::SessionID sessionID)
@@ -41,8 +44,15 @@
 
     SoupSession* soupSession() const;
 
+    void registerNetworkDataTask(NetworkDataTaskSoup& task) { m_dataTaskSet.add(&task); }
+    void unregisterNetworkDataTask(NetworkDataTaskSoup& task) { m_dataTaskSet.remove(&task); }
+
 private:
     NetworkSessionSoup(WebCore::SessionID);
+
+    void invalidateAndCancel() override;
+
+    HashSet<NetworkDataTaskSoup*> m_dataTaskSet;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/PlatformEfl.cmake (208343 => 208344)


--- trunk/Source/WebKit2/PlatformEfl.cmake	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/PlatformEfl.cmake	2016-11-03 21:06:31 UTC (rev 208344)
@@ -6,6 +6,8 @@
 
     NetworkProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp
 
+    NetworkProcess/Downloads/soup/DownloadSoup.cpp
+
     NetworkProcess/cache/NetworkCacheCodersSoup.cpp
     NetworkProcess/cache/NetworkCacheDataSoup.cpp
     NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp

Modified: trunk/Source/WebKit2/PlatformGTK.cmake (208343 => 208344)


--- trunk/Source/WebKit2/PlatformGTK.cmake	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/PlatformGTK.cmake	2016-11-03 21:06:31 UTC (rev 208344)
@@ -33,6 +33,8 @@
 
     NetworkProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp
 
+    NetworkProcess/Downloads/soup/DownloadSoup.cpp
+
     NetworkProcess/cache/NetworkCacheCodersSoup.cpp
     NetworkProcess/cache/NetworkCacheDataSoup.cpp
     NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (208343 => 208344)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2016-11-03 20:53:27 UTC (rev 208343)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2016-11-03 21:06:31 UTC (rev 208344)
@@ -1043,8 +1043,6 @@
 		532159541DBAE71D0054AA3C /* NetworkDataTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 532159511DBAE6FC0054AA3C /* NetworkDataTask.cpp */; };
 		532159551DBAE7290054AA3C /* NetworkSessionCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 532159501DBAE6D70054AA3C /* NetworkSessionCocoa.h */; };
 		532159561DBAE72D0054AA3C /* NetworkDataTaskCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 5321594F1DBAE6D70054AA3C /* NetworkDataTaskCocoa.h */; };
-		53BA47D01DC2EF5E004DF4AD /* NetworkDataTaskBlob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 539EB5461DC2EE40009D48CF /* NetworkDataTaskBlob.cpp */; };
-		53BA47D11DC2EF5E004DF4AD /* NetworkDataTaskBlob.h in Headers */ = {isa = PBXBuildFile; fileRef = 539EB5471DC2EE40009D48CF /* NetworkDataTaskBlob.h */; };
 		5C052F261C6D3BD30076E919 /* AuthenticationManagerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C052F241C6D3AB60076E919 /* AuthenticationManagerCocoa.mm */; };
 		5C1426EC1C23F80900D41183 /* NetworkProcessCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1426E21C23F80500D41183 /* NetworkProcessCreationParameters.cpp */; };
 		5C1426ED1C23F80900D41183 /* NetworkProcessCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1426E31C23F80500D41183 /* NetworkProcessCreationParameters.h */; };
@@ -3133,8 +3131,6 @@
 		532159501DBAE6D70054AA3C /* NetworkSessionCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkSessionCocoa.h; path = NetworkProcess/cocoa/NetworkSessionCocoa.h; sourceTree = "<group>"; };
 		532159511DBAE6FC0054AA3C /* NetworkDataTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkDataTask.cpp; path = NetworkProcess/NetworkDataTask.cpp; sourceTree = "<group>"; };
 		532159521DBAE6FC0054AA3C /* NetworkSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkSession.cpp; path = NetworkProcess/NetworkSession.cpp; sourceTree = "<group>"; };
-		539EB5461DC2EE40009D48CF /* NetworkDataTaskBlob.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkDataTaskBlob.cpp; path = NetworkProcess/NetworkDataTaskBlob.cpp; sourceTree = "<group>"; };
-		539EB5471DC2EE40009D48CF /* NetworkDataTaskBlob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkDataTaskBlob.h; path = NetworkProcess/NetworkDataTaskBlob.h; sourceTree = "<group>"; };
 		579D18B71CCFE34B00B1974C /* PhotosSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PhotosSPI.h; sourceTree = "<group>"; };
 		5C052F241C6D3AB60076E919 /* AuthenticationManagerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AuthenticationManagerCocoa.mm; path = Authentication/cocoa/AuthenticationManagerCocoa.mm; sourceTree = "<group>"; };
 		5C1426E21C23F80500D41183 /* NetworkProcessCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkProcessCreationParameters.cpp; path = NetworkProcess/NetworkProcessCreationParameters.cpp; sourceTree = "<group>"; };
@@ -5469,8 +5465,6 @@
 				5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */,
 				839901FF1BE9A01B000F3653 /* NetworkLoad.cpp */,
 				839901FE1BE9A01B000F3653 /* NetworkLoad.h */,
-				539EB5461DC2EE40009D48CF /* NetworkDataTaskBlob.cpp */,
-				539EB5471DC2EE40009D48CF /* NetworkDataTaskBlob.h */,
 				83D454D61BE9D3C4006C93BD /* NetworkLoadClient.h */,
 				839149631BEA838500D2D953 /* NetworkLoadParameters.h */,
 				510CC7DF16138E2900D03ED3 /* NetworkProcess.cpp */,
@@ -7833,7 +7827,6 @@
 				1A0EC6C0124BBD9B007EF4A5 /* PluginProcessMessages.h in Headers */,
 				1A0EC75E124BC7B2007EF4A5 /* PluginProcessProxy.h in Headers */,
 				1A043B5E124D5E9D00FFBFB5 /* PluginProcessProxyMessages.h in Headers */,
-				53BA47D11DC2EF5E004DF4AD /* NetworkDataTaskBlob.h in Headers */,
 				1A043DC1124FF87500FFBFB5 /* PluginProxy.h in Headers */,
 				1A8EFA711252B84100F7067F /* PluginProxyMessages.h in Headers */,
 				1A4A9F3312B844E2008FE984 /* PluginQuirks.h in Headers */,
@@ -9327,7 +9320,6 @@
 				1A2D92211281DC1B001EB962 /* PluginProxyMac.mm in Sources */,
 				1A8EFA701252B84100F7067F /* PluginProxyMessageReceiver.cpp in Sources */,
 				7CD622771739D863005BD7FF /* PluginSandboxProfile.mm in Sources */,
-				53BA47D01DC2EF5E004DF4AD /* NetworkDataTaskBlob.cpp in Sources */,
 				BC82844D16B5081C00A278FE /* PluginServiceEntryPoint.mm in Sources */,
 				1A6FB7AE11E64B6800DB1371 /* PluginView.cpp in Sources */,
 				E18C92F412DB9E7100CF2AEB /* PrintInfo.cpp in Sources */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to