NetworkSession: Add NetworkDataTask implementation for blobs
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Nov 2016 18:08:05 +0000 (18:08 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Nov 2016 18:08:05 +0000 (18:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=163939

Source/WebCore:

Patch by Keith Rollin <krollin@apple.com> on 2016-11-04
Reviewed by Alex Christensen.

* WebCore.xcodeproj/project.pbxproj: Mark HTTPParsers.h and AsyncFileStream.h as private.
* fileapi/AsyncFileStream.h: Add WEBCORE_EXPORT to AsyncFileStream class.
* platform/network/BlobData.h: Add WEBCORE_EXPORT to length().
* platform/network/HTTPParsers.h: Add WEBCORE_EXPORT to parseRange().
* platform/network/ResourceResponseBase.h: Add WEBCORE_EXPORT to setHTTPHeaderField().

Source/WebCore/platform/gtk/po:

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2016-11-04
Reviewed by Alex Christensen.

* POTFILES.in: Remove DownloadSoup.cpp

Source/WebKit2:

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2016-11-04
Reviewed by Alex Christensen.

Add NetworkDataTaskBlob to handle blobs when using NetworkSession instead of using ResourceHandle. This patch
adds more USE(NETWORK_SESSION) ifdefs to not use ResourceHandle in Downloads and NetworkLoad when NetworkSession
is enabled.

* CMakeLists.txt: Add new files to compilation.
* NetworkProcess/Downloads/BlobDownloadClient.cpp:
* NetworkProcess/Downloads/BlobDownloadClient.h:
* NetworkProcess/Downloads/Download.cpp:
(WebKit::Download::Download): Split the constructor again and remove the PlatformDownloadTaskRef
definitions. Now Cocoa specific constructor receives a NSURLSessionDownloadTask and the general constructor
reveices a NetworkDataTask and is used by Soup backend and blobs.
(WebKit::Download::~Download):
(WebKit::Download::start):
(WebKit::Download::startWithHandle):
(WebKit::Download::cancel):
(WebKit::Download::didReceiveAuthenticationChallenge):
(WebKit::Download::didReceiveData):
(WebKit::Download::didFinish):
(WebKit::Download::platformCancelNetworkLoad): Rename cancelNetworkLoad() as platformCancelNetworkLoad() since
this is now used only by Cocoa platform to cancel the NSURLSessionDownloadTask.
* NetworkProcess/Downloads/Download.h:
(WebKit::Download::Download):
(WebKit::Download::suggestedName):
(WebKit::Download::request):
* NetworkProcess/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::startDownload): Remove blobs specific code when using NetworkSession.
(WebKit::DownloadManager::continueDecidePendingDownloadDestination):
* NetworkProcess/Downloads/DownloadManager.h:
* NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
(WebKit::Download::platformCancelNetworkLoad):
* NetworkProcess/Downloads/soup/DownloadSoup.cpp: Removed.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload): Remove blobs specific code when
using NetworkSession.
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::create): If request is a blob, create a NetworkDataTaskBlob.
* NetworkProcess/NetworkDataTask.h: Add invalidateAndCancel pure virtual method.
* NetworkProcess/NetworkDataTaskBlob.cpp: Added.
(WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob):
(WebKit::NetworkDataTaskBlob::~NetworkDataTaskBlob):
(WebKit::NetworkDataTaskBlob::clearStream):
(WebKit::NetworkDataTaskBlob::resume):
(WebKit::NetworkDataTaskBlob::suspend):
(WebKit::NetworkDataTaskBlob::cancel):
(WebKit::NetworkDataTaskBlob::invalidateAndCancel):
(WebKit::NetworkDataTaskBlob::getSizeForNext):
(WebKit::NetworkDataTaskBlob::didGetSize):
(WebKit::NetworkDataTaskBlob::seek):
(WebKit::NetworkDataTaskBlob::didReceiveResponse):
(WebKit::NetworkDataTaskBlob::read):
(WebKit::NetworkDataTaskBlob::readData):
(WebKit::NetworkDataTaskBlob::readFile):
(WebKit::NetworkDataTaskBlob::didOpen):
(WebKit::NetworkDataTaskBlob::didRead):
(WebKit::NetworkDataTaskBlob::consumeData):
(WebKit::NetworkDataTaskBlob::setPendingDownloadLocation):
(WebKit::NetworkDataTaskBlob::suggestedFilename):
(WebKit::NetworkDataTaskBlob::download):
(WebKit::NetworkDataTaskBlob::writeDownload):
(WebKit::NetworkDataTaskBlob::cleanDownloadFiles):
(WebKit::NetworkDataTaskBlob::didFailDownload):
(WebKit::NetworkDataTaskBlob::didFinishDownload):
(WebKit::NetworkDataTaskBlob::didFail):
(WebKit::NetworkDataTaskBlob::didFinish):
* NetworkProcess/NetworkDataTaskBlob.h: Added.
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::NetworkLoad): Remove blobs specific code when using NetworkSession.
(WebKit::NetworkLoad::~NetworkLoad):
(WebKit::NetworkLoad::setDefersLoading):
(WebKit::NetworkLoad::cancel):
(WebKit::NetworkLoad::continueWillSendRequest):
(WebKit::NetworkLoad::continueDidReceiveResponse):
(WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace):
(WebKit::NetworkLoad::canAuthenticateAgainstProtectionSpaceAsync):
* NetworkProcess/NetworkLoad.h:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::invalidateAndCancel): Moved from NetworkSessionSoup, since this is now used also by blobs.
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::registerNetworkDataTask): Ditto.
(WebKit::NetworkSession::unregisterNetworkDataTask): Ditto.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h: Add invalidateAndCancel() implementation that does nothing
because in Cocoa all tasks are invalidated and canceled by the network session.
* NetworkProcess/mac/NetworkLoadMac.mm:
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup):
(WebKit::NetworkDataTaskSoup::~NetworkDataTaskSoup):
(WebKit::NetworkDataTaskSoup::download):
* NetworkProcess/soup/NetworkDataTaskSoup.h:
* NetworkProcess/soup/NetworkSessionSoup.cpp:
* NetworkProcess/soup/NetworkSessionSoup.h:
* PlatformEfl.cmake: Remove DownloadSoup.cpp from compilation.
* PlatformGTK.cmake: Ditto.
* WebKit2.xcodeproj/project.pbxproj: Add new files to compilation.

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

39 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/fileapi/AsyncFileStream.h
Source/WebCore/platform/gtk/po/ChangeLog
Source/WebCore/platform/gtk/po/POTFILES.in
Source/WebCore/platform/network/BlobData.h
Source/WebCore/platform/network/HTTPParsers.h
Source/WebCore/platform/network/ResourceResponseBase.h
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.cpp
Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.h
Source/WebKit2/NetworkProcess/Downloads/Download.cpp
Source/WebKit2/NetworkProcess/Downloads/Download.h
Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp
Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h
Source/WebKit2/NetworkProcess/Downloads/cocoa/DownloadCocoa.mm
Source/WebKit2/NetworkProcess/Downloads/ios/DownloadIOS.mm
Source/WebKit2/NetworkProcess/Downloads/mac/DownloadMac.mm
Source/WebKit2/NetworkProcess/Downloads/soup/DownloadSoup.cpp [deleted file]
Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit2/NetworkProcess/NetworkDataTask.cpp
Source/WebKit2/NetworkProcess/NetworkDataTask.h
Source/WebKit2/NetworkProcess/NetworkDataTaskBlob.cpp [new file with mode: 0644]
Source/WebKit2/NetworkProcess/NetworkDataTaskBlob.h [new file with mode: 0644]
Source/WebKit2/NetworkProcess/NetworkLoad.cpp
Source/WebKit2/NetworkProcess/NetworkLoad.h
Source/WebKit2/NetworkProcess/NetworkSession.cpp
Source/WebKit2/NetworkProcess/NetworkSession.h
Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.h
Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm
Source/WebKit2/NetworkProcess/mac/NetworkLoadMac.mm
Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.cpp
Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.h
Source/WebKit2/NetworkProcess/soup/NetworkSessionSoup.cpp
Source/WebKit2/NetworkProcess/soup/NetworkSessionSoup.h
Source/WebKit2/PlatformEfl.cmake
Source/WebKit2/PlatformGTK.cmake
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

index c95f22c..1106416 100644 (file)
@@ -1,3 +1,16 @@
+2016-11-04  Keith Rollin  <krollin@apple.com>
+
+        NetworkSession: Add NetworkDataTask implementation for blobs
+        https://bugs.webkit.org/show_bug.cgi?id=163939
+
+        Reviewed by Alex Christensen.
+
+        * WebCore.xcodeproj/project.pbxproj: Mark HTTPParsers.h and AsyncFileStream.h as private.
+        * fileapi/AsyncFileStream.h: Add WEBCORE_EXPORT to AsyncFileStream class.
+        * platform/network/BlobData.h: Add WEBCORE_EXPORT to length().
+        * platform/network/HTTPParsers.h: Add WEBCORE_EXPORT to parseRange().
+        * platform/network/ResourceResponseBase.h: Add WEBCORE_EXPORT to setHTTPHeaderField().
+
 2016-11-04  Brady Eidson  <beidson@apple.com>
 
         IndexedDB 2.0: Use IDB-specific exceptions in places where the generic exceptions are currently used.
index 4aa8205..dcab62e 100644 (file)
                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 */; };
+               514C76730CE923A1007EF3CD /* HTTPParsers.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C765E0CE923A1007EF3CD /* HTTPParsers.h */; settings = {ATTRIBUTES = (Private, ); }; };
                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 */; };
                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 = (); }; };
+               E1CDE9221501916900862CC5 /* AsyncFileStream.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CDE9211501916900862CC5 /* AsyncFileStream.h */; settings = {ATTRIBUTES = (Private, ); }; };
                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, ); }; };
index 35e85a7..f848bfb 100644 (file)
@@ -42,7 +42,7 @@ class FileStreamClient;
 class FileStream;
 class URL;
 
-class AsyncFileStream {
+class WEBCORE_EXPORT AsyncFileStream {
 public:
     explicit AsyncFileStream(FileStreamClient&);
     ~AsyncFileStream();
index e4ac802..b146b06 100644 (file)
@@ -1,3 +1,12 @@
+2016-11-04  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        NetworkSession: Add NetworkDataTask implementation for blobs
+        https://bugs.webkit.org/show_bug.cgi?id=163939
+
+        Reviewed by Alex Christensen.
+
+        * POTFILES.in: Remove DownloadSoup.cpp
+
 2016-11-03  Alex Christensen  <achristensen@webkit.org>
 
         Unreviewed, rolling out r208298.
index 7fa2825..b65fb8d 100644 (file)
@@ -1,7 +1,6 @@
 # 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
index b1fcd9c..932d5ab 100644 (file)
@@ -59,7 +59,7 @@ public:
     BlobDataFileReference* file() const { return m_file.get(); }
 
     long long offset() const { return m_offset; }
-    long long length() const; // Computes file length if it's not known yet.
+    WEBCORE_EXPORT long long length() const; // Computes file length if it's not known yet.
 
 private:
     friend class BlobData;
index 1f4a566..7f6b426 100644 (file)
@@ -81,7 +81,7 @@ AtomicString extractReasonPhraseFromHTTPStatusLine(const String&);
 XFrameOptionsDisposition parseXFrameOptionsHeader(const String&);
 
 // -1 could be set to one of the return parameters to indicate the value is not specified.
-bool parseRange(const String&, long long& rangeOffset, long long& rangeEnd, long long& rangeSuffixLength);
+WEBCORE_EXPORT bool parseRange(const String&, long long& rangeOffset, long long& rangeEnd, long long& rangeSuffixLength);
 
 #if ENABLE(NOSNIFF)
 ContentTypeOptionsDisposition parseContentTypeOptionsHeader(const String& header);
index 7d68951..d896615 100644 (file)
@@ -99,7 +99,7 @@ public:
     String httpHeaderField(const String& name) const;
     WEBCORE_EXPORT String httpHeaderField(HTTPHeaderName) const;
     WEBCORE_EXPORT void setHTTPHeaderField(const String& name, const String& value);
-    void setHTTPHeaderField(HTTPHeaderName, const String& value);
+    WEBCORE_EXPORT void setHTTPHeaderField(HTTPHeaderName, const String& value);
 
     void addHTTPHeaderField(HTTPHeaderName, const String& value);
     void addHTTPHeaderField(const String& name, const String& value);
index f156ca4..872668e 100644 (file)
@@ -181,6 +181,7 @@ endif ()
 set(NetworkProcess_COMMON_SOURCES
     NetworkProcess/NetworkConnectionToWebProcess.cpp
     NetworkProcess/NetworkDataTask.cpp
+    NetworkProcess/NetworkDataTaskBlob.cpp
     NetworkProcess/NetworkLoad.cpp
     NetworkProcess/NetworkProcess.cpp
     NetworkProcess/NetworkProcessPlatformStrategies.cpp
index 0762274..1aaffa2 100644 (file)
@@ -1,3 +1,104 @@
+2016-11-04  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        NetworkSession: Add NetworkDataTask implementation for blobs
+        https://bugs.webkit.org/show_bug.cgi?id=163939
+
+        Reviewed by Alex Christensen.
+
+        Add NetworkDataTaskBlob to handle blobs when using NetworkSession instead of using ResourceHandle. This patch
+        adds more USE(NETWORK_SESSION) ifdefs to not use ResourceHandle in Downloads and NetworkLoad when NetworkSession
+        is enabled.
+
+        * CMakeLists.txt: Add new files to compilation.
+        * NetworkProcess/Downloads/BlobDownloadClient.cpp:
+        * NetworkProcess/Downloads/BlobDownloadClient.h:
+        * NetworkProcess/Downloads/Download.cpp:
+        (WebKit::Download::Download): Split the constructor again and remove the PlatformDownloadTaskRef
+        definitions. Now Cocoa specific constructor receives a NSURLSessionDownloadTask and the general constructor
+        reveices a NetworkDataTask and is used by Soup backend and blobs.
+        (WebKit::Download::~Download):
+        (WebKit::Download::start):
+        (WebKit::Download::startWithHandle):
+        (WebKit::Download::cancel):
+        (WebKit::Download::didReceiveAuthenticationChallenge):
+        (WebKit::Download::didReceiveData):
+        (WebKit::Download::didFinish):
+        (WebKit::Download::platformCancelNetworkLoad): Rename cancelNetworkLoad() as platformCancelNetworkLoad() since
+        this is now used only by Cocoa platform to cancel the NSURLSessionDownloadTask.
+        * NetworkProcess/Downloads/Download.h:
+        (WebKit::Download::Download):
+        (WebKit::Download::suggestedName):
+        (WebKit::Download::request):
+        * NetworkProcess/Downloads/DownloadManager.cpp:
+        (WebKit::DownloadManager::startDownload): Remove blobs specific code when using NetworkSession.
+        (WebKit::DownloadManager::continueDecidePendingDownloadDestination):
+        * NetworkProcess/Downloads/DownloadManager.h:
+        * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
+        (WebKit::Download::platformCancelNetworkLoad):
+        * NetworkProcess/Downloads/soup/DownloadSoup.cpp: Removed.
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload): Remove blobs specific code when
+        using NetworkSession.
+        * NetworkProcess/NetworkDataTask.cpp:
+        (WebKit::NetworkDataTask::create): If request is a blob, create a NetworkDataTaskBlob.
+        * NetworkProcess/NetworkDataTask.h: Add invalidateAndCancel pure virtual method.
+        * NetworkProcess/NetworkDataTaskBlob.cpp: Added.
+        (WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob):
+        (WebKit::NetworkDataTaskBlob::~NetworkDataTaskBlob):
+        (WebKit::NetworkDataTaskBlob::clearStream):
+        (WebKit::NetworkDataTaskBlob::resume):
+        (WebKit::NetworkDataTaskBlob::suspend):
+        (WebKit::NetworkDataTaskBlob::cancel):
+        (WebKit::NetworkDataTaskBlob::invalidateAndCancel):
+        (WebKit::NetworkDataTaskBlob::getSizeForNext):
+        (WebKit::NetworkDataTaskBlob::didGetSize):
+        (WebKit::NetworkDataTaskBlob::seek):
+        (WebKit::NetworkDataTaskBlob::didReceiveResponse):
+        (WebKit::NetworkDataTaskBlob::read):
+        (WebKit::NetworkDataTaskBlob::readData):
+        (WebKit::NetworkDataTaskBlob::readFile):
+        (WebKit::NetworkDataTaskBlob::didOpen):
+        (WebKit::NetworkDataTaskBlob::didRead):
+        (WebKit::NetworkDataTaskBlob::consumeData):
+        (WebKit::NetworkDataTaskBlob::setPendingDownloadLocation):
+        (WebKit::NetworkDataTaskBlob::suggestedFilename):
+        (WebKit::NetworkDataTaskBlob::download):
+        (WebKit::NetworkDataTaskBlob::writeDownload):
+        (WebKit::NetworkDataTaskBlob::cleanDownloadFiles):
+        (WebKit::NetworkDataTaskBlob::didFailDownload):
+        (WebKit::NetworkDataTaskBlob::didFinishDownload):
+        (WebKit::NetworkDataTaskBlob::didFail):
+        (WebKit::NetworkDataTaskBlob::didFinish):
+        * NetworkProcess/NetworkDataTaskBlob.h: Added.
+        * NetworkProcess/NetworkLoad.cpp:
+        (WebKit::NetworkLoad::NetworkLoad): Remove blobs specific code when using NetworkSession.
+        (WebKit::NetworkLoad::~NetworkLoad):
+        (WebKit::NetworkLoad::setDefersLoading):
+        (WebKit::NetworkLoad::cancel):
+        (WebKit::NetworkLoad::continueWillSendRequest):
+        (WebKit::NetworkLoad::continueDidReceiveResponse):
+        (WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace):
+        (WebKit::NetworkLoad::canAuthenticateAgainstProtectionSpaceAsync):
+        * NetworkProcess/NetworkLoad.h:
+        * NetworkProcess/NetworkSession.cpp:
+        (WebKit::NetworkSession::invalidateAndCancel): Moved from NetworkSessionSoup, since this is now used also by blobs.
+        * NetworkProcess/NetworkSession.h:
+        (WebKit::NetworkSession::registerNetworkDataTask): Ditto.
+        (WebKit::NetworkSession::unregisterNetworkDataTask): Ditto.
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: Add invalidateAndCancel() implementation that does nothing
+        because in Cocoa all tasks are invalidated and canceled by the network session.
+        * NetworkProcess/mac/NetworkLoadMac.mm:
+        * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
+        (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup):
+        (WebKit::NetworkDataTaskSoup::~NetworkDataTaskSoup):
+        (WebKit::NetworkDataTaskSoup::download):
+        * NetworkProcess/soup/NetworkDataTaskSoup.h:
+        * NetworkProcess/soup/NetworkSessionSoup.cpp:
+        * NetworkProcess/soup/NetworkSessionSoup.h:
+        * PlatformEfl.cmake: Remove DownloadSoup.cpp from compilation.
+        * PlatformGTK.cmake: Ditto.
+        * WebKit2.xcodeproj/project.pbxproj: Add new files to compilation.
+
 2016-11-03  Simon Fraser  <simon.fraser@apple.com>
 
         Give all the geometry classes a single-argument scale() function for consistency
index 721b64b..c304376 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "BlobDownloadClient.h"
 
+#if !USE(NETWORK_SESSION)
+
 #include "DataReference.h"
 #include "Download.h"
 #include "WebErrors.h"
@@ -97,3 +99,5 @@ void BlobDownloadClient::didFail(ResourceHandle*, const ResourceError& error)
 }
 
 }
+
+#endif // !USE(NETWORK_SESSION)
index dcb889d..4a3e63e 100644 (file)
@@ -25,6 +25,8 @@
 
 #pragma once
 
+#if !USE(NETWORK_SESSION)
+
 #include <WebCore/FileSystem.h>
 #include <WebCore/ResourceHandleClient.h>
 #include <wtf/RefPtr.h>
@@ -55,3 +57,5 @@ private:
 };
 
 }
+
+#endif // !USE(NETWORK_SESSION)
index 64948e2..0237724 100644 (file)
@@ -45,10 +45,10 @@ using namespace WebCore;
 namespace WebKit {
 
 #if USE(NETWORK_SESSION)
-Download::Download(DownloadManager& downloadManager, DownloadID downloadID, PlatformDownloadTaskRef download, const WebCore::SessionID& sessionID, const String& suggestedName)
+Download::Download(DownloadManager& downloadManager, DownloadID downloadID, NetworkDataTask& download, const SessionID& sessionID, const String& suggestedName)
     : m_downloadManager(downloadManager)
     , m_downloadID(downloadID)
-    , m_download(download)
+    , m_download(&download)
     , m_sessionID(sessionID)
     , m_suggestedName(suggestedName)
 {
@@ -56,8 +56,20 @@ Download::Download(DownloadManager& downloadManager, DownloadID downloadID, Plat
 
     m_downloadManager.didCreateDownload();
 }
-#endif
+#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());
 
+    m_downloadManager.didCreateDownload();
+}
+#endif
+#else
 Download::Download(DownloadManager& downloadManager, DownloadID downloadID, const ResourceRequest& request, const String& suggestedName)
     : m_downloadManager(downloadManager)
     , m_downloadID(downloadID)
@@ -68,9 +80,11 @@ Download::Download(DownloadManager& downloadManager, DownloadID downloadID, cons
 
     m_downloadManager.didCreateDownload();
 }
+#endif // USE(NETWORK_SESSION)
 
 Download::~Download()
 {
+#if !USE(NETWORK_SESSION)
     if (m_resourceHandle) {
         m_resourceHandle->clearClient();
         m_resourceHandle->cancel();
@@ -79,10 +93,12 @@ Download::~Download()
     m_downloadClient = nullptr;
 
     platformInvalidate();
+#endif
 
     m_downloadManager.didDestroyDownload();
 }
 
+#if !USE(NETWORK_SESSION)
 void Download::start()
 {
     if (m_request.url().protocolIsBlob()) {
@@ -92,11 +108,7 @@ void Download::start()
         return;
     }
 
-#if USE(NETWORK_SESSION)
-    ASSERT_NOT_REACHED();
-#else
     startNetworkLoad();
-#endif
 }
 
 void Download::startWithHandle(ResourceHandle* handle, const ResourceResponse& response)
@@ -108,37 +120,39 @@ void Download::startWithHandle(ResourceHandle* handle, const ResourceResponse& r
         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();
         static_cast<BlobDownloadClient*>(m_downloadClient.get())->didCancel();
         return;
     }
-    cancelNetworkLoad();
+#endif
+    platformCancelNetworkLoad();
 }
 
+#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)
 {
@@ -147,16 +161,6 @@ void Download::didReceiveResponse(const ResourceResponse& response)
     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;
@@ -166,8 +170,6 @@ bool Download::shouldDecodeSourceDataOfMIMEType(const String& mimeType)
     return result;
 }
 
-#if !USE(NETWORK_SESSION)
-
 String Download::decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite)
 {
     String destination;
@@ -182,8 +184,6 @@ String Download::decideDestinationWithSuggestedFilename(const String& filename,
     return destination;
 }
 
-#endif
-
 void Download::decideDestinationWithSuggestedFilenameAsync(const String& suggestedFilename)
 {
     send(Messages::DownloadProxy::DecideDestinationWithSuggestedFilenameAsync(downloadID(), suggestedFilename));
@@ -209,17 +209,30 @@ void Download::continueDidReceiveResponse()
 {
     m_resourceHandle->continueDidReceiveResponse();
 }
+#endif
 
 void Download::didCreateDestination(const String& path)
 {
     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());
 
@@ -277,4 +290,10 @@ bool Download::isAlwaysOnLoggingAllowed() const
 #endif
 }
 
+#if !PLATFORM(COCOA)
+void Download::platformCancelNetworkLoad()
+{
+}
+#endif
+
 } // namespace WebKit
index c3fbf09..25cbb91 100644 (file)
 #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)
@@ -73,6 +67,7 @@ class ResourceResponse;
 namespace WebKit {
 
 class DownloadManager;
+class NetworkDataTask;
 class NetworkSession;
 class WebPage;
 
@@ -80,39 +75,43 @@ class Download : public IPC::MessageSender {
     WTF_MAKE_NONCOPYABLE(Download); WTF_MAKE_FAST_ALLOCATED;
 public:
 #if USE(NETWORK_SESSION)
-    Download(DownloadManager&, DownloadID, PlatformDownloadTaskRef, const WebCore::SessionID& sessionID, const String& suggestedFilename = { });
+    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 = { });
 #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);
 
@@ -124,37 +123,35 @@ private:
 #if !USE(NETWORK_SESSION)
     void startNetworkLoad();
     void startNetworkLoadWithHandle(WebCore::ResourceHandle*, const WebCore::ResourceResponse&);
-#endif
-    void cancelNetworkLoad();
-
     void platformInvalidate();
+#endif
+    void platformCancelNetworkLoad();
 
     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 };
 };
index b2fdfaa..b406de7 100644 (file)
@@ -47,23 +47,21 @@ DownloadManager::DownloadManager(Client& client)
 void DownloadManager::startDownload(SessionID sessionID, DownloadID downloadID, const ResourceRequest& request, const String& suggestedName)
 {
 #if USE(NETWORK_SESSION)
-    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));
+    auto* networkSession = SessionTracker::networkSession(sessionID);
+    if (!networkSession)
         return;
-    }
-#endif
+    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
     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)
@@ -99,8 +97,7 @@ void DownloadManager::willDecidePendingDownloadDestination(NetworkDataTask& netw
     auto addResult = m_downloadsWaitingForDestination.set(downloadID, std::make_pair<RefPtr<NetworkDataTask>, ResponseCompletionHandler>(&networkDataTask, WTFMove(completionHandler)));
     ASSERT_UNUSED(addResult, addResult.isNewEntry);
 }
-#endif
-
+#else
 void DownloadManager::convertHandleToDownload(DownloadID downloadID, ResourceHandle* handle, const ResourceRequest& request, const ResourceResponse& response)
 {
     auto download = std::make_unique<Download>(*this, downloadID, request);
@@ -109,6 +106,7 @@ void DownloadManager::convertHandleToDownload(DownloadID downloadID, ResourceHan
     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)
 {
@@ -134,11 +132,11 @@ void DownloadManager::continueDecidePendingDownloadDestination(DownloadID downlo
 
         ASSERT(!m_downloadsAfterDestinationDecided.contains(downloadID));
         m_downloadsAfterDestinationDecided.set(downloadID, networkDataTask);
-        return;
     }
-#endif
+#else
     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)
index 071ea9e..9063f84 100644 (file)
@@ -80,8 +80,9 @@ public:
 #endif
     void continueWillSendRequest(DownloadID, WebCore::ResourceRequest&&);
     void willDecidePendingDownloadDestination(NetworkDataTask&, ResponseCompletionHandler&&);
-#endif
+#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&);
index d3209ad..868e119 100644 (file)
@@ -38,10 +38,10 @@ void Download::resume(const IPC::DataReference& resumeData, const String& path,
     notImplemented();
 }
     
-void Download::cancelNetworkLoad()
+void Download::platformCancelNetworkLoad()
 {
-    ASSERT(m_download);
-    [m_download cancelByProducingResumeData: ^(NSData * _Nullable resumeData)
+    ASSERT(m_downloadTask);
+    [m_downloadTask cancelByProducingResumeData: ^(NSData * _Nullable resumeData)
     {
         if (resumeData && resumeData.bytes && resumeData.length)
             didCancel(IPC::DataReference(reinterpret_cast<const uint8_t*>(resumeData.bytes), resumeData.length));
@@ -50,15 +50,6 @@ void Download::cancelNetworkLoad()
     }];
 }
 
-void Download::platformInvalidate()
-{
-    notImplemented();
-}
-
-void Download::platformDidFinish()
-{
-}
-    
 }
 
 #endif // USE(NETWORK_SESSION)
index f338abc..5024ad4 100644 (file)
@@ -142,7 +142,7 @@ void Download::startNetworkLoadWithHandle(ResourceHandle* handle, const Resource
 #pragma clang diagnostic pop
 }
 
-void Download::cancelNetworkLoad()
+void Download::platformCancelNetworkLoad()
 {
     notImplemented();
 }
index bb3ff2b..99e3882 100644 (file)
@@ -109,7 +109,7 @@ void Download::resume(const IPC::DataReference& resumeData, const String& path,
     [m_nsURLDownload setDeletesFileUponFailure:NO];
 }
 
-void Download::cancelNetworkLoad()
+void Download::platformCancelNetworkLoad()
 {
     [m_nsURLDownload cancel];
 
diff --git a/Source/WebKit2/NetworkProcess/Downloads/soup/DownloadSoup.cpp b/Source/WebKit2/NetworkProcess/Downloads/soup/DownloadSoup.cpp
deleted file mode 100644 (file)
index 82e8c5c..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Brent Fulgham <bfulgham@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
index 24e3f49..42183d9 100644 (file)
@@ -207,18 +207,16 @@ void NetworkConnectionToWebProcess::convertMainResourceLoadToDownload(SessionID
     }
 
 #if USE(NETWORK_SESSION)
-    if (!request.url().protocolIsBlob()) {
-        loader->networkLoad()->convertTaskToDownload(downloadID, request, response);
-        loader->didConvertToDownload();
-        return;
-    }
-#endif
+    loader->networkLoad()->convertTaskToDownload(downloadID, request, response);
+    loader->didConvertToDownload();
+#else
     networkProcess.downloadManager().convertHandleToDownload(downloadID, loader->networkLoad()->handle(), request, response);
 
     // Unblock the URL connection operation queue.
     loader->networkLoad()->handle()->continueDidReceiveResponse();
 
     loader->didConvertToDownload();
+#endif
 }
 
 void NetworkConnectionToWebProcess::cookiesForDOM(SessionID sessionID, const URL& firstParty, const URL& url, String& result)
index 54da4fb..dbb065d 100644 (file)
@@ -28,6 +28,7 @@
 
 #if USE(NETWORK_SESSION)
 
+#include "NetworkDataTaskBlob.h"
 #include "NetworkSession.h"
 #include <wtf/MainThread.h>
 
@@ -44,6 +45,9 @@ namespace WebKit {
 
 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
index 4dc1290..6da41c2 100644 (file)
@@ -80,6 +80,7 @@ public:
     virtual void suspend() = 0;
     virtual void cancel() = 0;
     virtual void resume() = 0;
+    virtual void invalidateAndCancel() = 0;
 
     enum class State {
         Running,
diff --git a/Source/WebKit2/NetworkProcess/NetworkDataTaskBlob.cpp b/Source/WebKit2/NetworkProcess/NetworkDataTaskBlob.cpp
new file mode 100644 (file)
index 0000000..a296d65
--- /dev/null
@@ -0,0 +1,582 @@
+/*
+ * 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)
diff --git a/Source/WebKit2/NetworkProcess/NetworkDataTaskBlob.h b/Source/WebKit2/NetworkProcess/NetworkDataTaskBlob.h
new file mode 100644 (file)
index 0000000..8a26363
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * 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)
index 9031562..1267505 100644 (file)
@@ -67,10 +67,6 @@ NetworkLoad::NetworkLoad(NetworkLoadClient& client, NetworkLoadParameters&& para
     , 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();
@@ -101,12 +97,14 @@ NetworkLoad::~NetworkLoad()
 #endif
     if (m_task)
         m_task->clearClient();
-#elif USE(PROTECTION_SPACE_AUTH_CALLBACK)
+#else
+#if 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)
@@ -118,9 +116,10 @@ void NetworkLoad::setDefersLoading(bool defers)
         else
             m_task->resume();
     }
-#endif
+#else
     if (m_handle)
         m_handle->setDefersLoading(defers);
+#endif
 }
 
 void NetworkLoad::cancel()
@@ -128,9 +127,10 @@ void NetworkLoad::cancel()
 #if USE(NETWORK_SESSION)
     if (m_task)
         m_task->cancel();
-#endif
+#else
     if (m_handle)
         m_handle->cancel();
+#endif
 }
 
 void NetworkLoad::continueWillSendRequest(WebCore::ResourceRequest&& newRequest)
@@ -143,27 +143,26 @@ void NetworkLoad::continueWillSendRequest(WebCore::ResourceRequest&& newRequest)
 #endif
 
 #if USE(NETWORK_SESSION)
-    auto redirectCompletionHandler = std::exchange(m_redirectCompletionHandler, nullptr);    
+    auto redirectCompletionHandler = std::exchange(m_redirectCompletionHandler, nullptr);
     ASSERT(redirectCompletionHandler);
-#endif
-    
     if (m_currentRequest.isNull()) {
-        if (m_handle)
-            m_handle->cancel();
-        didFail(m_handle.get(), cancelledError(m_currentRequest));
-#if USE(NETWORK_SESSION)
+        didCompleteWithError(cancelledError(m_currentRequest));
         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);
+#else
+    if (m_currentRequest.isNull()) {
+        if (m_handle)
+            m_handle->cancel();
+        didFail(m_handle.get(), cancelledError(m_currentRequest));
+    } else if (m_handle) {
+        auto currentRequestCopy = m_currentRequest;
+        m_handle->continueWillSendRequest(WTFMove(currentRequestCopy));
+    }
 #endif
 }
 
@@ -171,12 +170,13 @@ void NetworkLoad::continueDidReceiveResponse()
 {
 #if USE(NETWORK_SESSION)
     if (m_responseCompletionHandler) {
-        m_responseCompletionHandler(PolicyUse);
-        m_responseCompletionHandler = nullptr;
+        auto responseCompletionHandler = std::exchange(m_responseCompletionHandler, nullptr);
+        responseCompletionHandler(PolicyUse);
     }
-#endif
+#else
     if (m_handle)
         m_handle->continueDidReceiveResponse();
+#endif
 }
 
 NetworkLoadClient::ShouldContinueDidReceiveResponse NetworkLoad::sharedDidReceiveResponse(ResourceResponse&& response)
@@ -285,6 +285,23 @@ void NetworkLoad::completeAuthenticationChallenge(ChallengeCompletionHandler&& c
         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());
@@ -362,8 +379,8 @@ void NetworkLoad::cannotShowURL()
 {
     m_client.didFailLoading(cannotShowURLError(m_currentRequest));
 }
-    
-#endif
+
+#else
 
 void NetworkLoad::didReceiveResponseAsync(ResourceHandle* handle, ResourceResponse&& receivedResponse)
 {
@@ -418,32 +435,13 @@ void NetworkLoad::canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle* han
         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);
 }
@@ -515,5 +513,6 @@ void NetworkLoad::receivedCancellation(ResourceHandle* handle, const Authenticat
     m_handle->cancel();
     didFail(m_handle.get(), cancelledError(m_currentRequest));
 }
+#endif // USE(NETWORK_SESSION)
 
 } // namespace WebKit
index 27d4317..3f61301 100644 (file)
 
 namespace WebKit {
 
-class NetworkLoad final : private WebCore::ResourceHandleClient
+class NetworkLoad final :
 #if USE(NETWORK_SESSION)
-    , private NetworkDataTaskClient
+    private NetworkDataTaskClient
+#else
+    private WebCore::ResourceHandleClient
 #endif
 {
     WTF_MAKE_FAST_ALLOCATED;
@@ -69,7 +71,8 @@ public:
     void setSuggestedFilename(const String&);
     void setPendingDownload(PendingDownload&);
     DownloadID pendingDownloadID() { return m_task->pendingDownloadID(); }
-#endif
+#else
+    WebCore::ResourceHandle* handle() const { return m_handle.get(); }
 
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     void canAuthenticateAgainstProtectionSpaceAsync(WebCore::ResourceHandle*, const WebCore::ProtectionSpace&) override;
@@ -85,17 +88,17 @@ public:
     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;
@@ -111,8 +114,7 @@ private:
     void receivedCancellation(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) final;
     bool usesAsyncCallbacks() final { return true; }
     bool loadingSynchronousXHR() final { return m_client.isSynchronous(); }
-
-#if USE(NETWORK_SESSION)
+#else
     // NetworkDataTaskClient
     void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler&&) final;
     void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&) final;
@@ -146,8 +148,8 @@ private:
 #else
     bool m_waitingForContinueCanAuthenticateAgainstProtectionSpace { false };
     RefPtr<RemoteNetworkingContext> m_networkingContext;
-#endif
     RefPtr<WebCore::ResourceHandle> m_handle;
+#endif
 
     WebCore::ResourceRequest m_currentRequest; // Updated on redirects.
 };
index 1f81819..1e5e011 100644 (file)
@@ -28,6 +28,7 @@
 
 #if USE(NETWORK_SESSION)
 
+#include "NetworkDataTask.h"
 #include <WebCore/NetworkStorageSession.h>
 #include <wtf/MainThread.h>
 
@@ -81,6 +82,12 @@ NetworkSession::~NetworkSession()
 {
 }
 
+void NetworkSession::invalidateAndCancel()
+{
+    for (auto* task : m_dataTaskSet)
+        task->invalidateAndCancel();
+}
+
 } // namespace WebKit
 
 #endif // USE(NETWORK_SESSION)
index 99d0981..d5b016f 100644 (file)
@@ -28,6 +28,7 @@
 #if USE(NETWORK_SESSION)
 
 #include <WebCore/SessionID.h>
+#include <wtf/HashSet.h>
 #include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
 
@@ -38,6 +39,7 @@ class NetworkStorageSession;
 namespace WebKit {
 
 class CustomProtocolManager;
+class NetworkDataTask;
 
 class NetworkSession : public RefCounted<NetworkSession> {
 public:
@@ -45,16 +47,21 @@ public:
     static NetworkSession& defaultSession();
     virtual ~NetworkSession();
 
-    virtual void invalidateAndCancel() = 0;
+    virtual void invalidateAndCancel();
     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
index 0a8edbb..6342e1c 100644 (file)
@@ -61,6 +61,7 @@ public:
     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;
index ba69711..7d76478 100644 (file)
@@ -466,6 +466,8 @@ NetworkSessionCocoa::~NetworkSessionCocoa()
 
 void NetworkSessionCocoa::invalidateAndCancel()
 {
+    NetworkSession::invalidateAndCancel();
+
     [m_sessionWithCredentialStorage invalidateAndCancel];
     [m_sessionWithoutCredentialStorage invalidateAndCancel];
 }
index 15fbb6d..6475522 100644 (file)
@@ -26,6 +26,8 @@
 #import "config.h"
 #import "NetworkLoad.h"
 
+#if !USE(NETWORK_SESSION)
+
 #import <WebCore/CFNetworkSPI.h>
 #import <WebCore/ResourceHandle.h>
 
@@ -54,3 +56,5 @@ void NetworkLoad::willCacheResponseAsync(ResourceHandle* handle, NSCachedURLResp
 #endif // !USE(CFURLCONNECTION)
 
 } // namespace WebKit
+
+#endif // !USE(NETWORK_SESSION)
index 1763652..1e9ee76 100644 (file)
@@ -52,7 +52,7 @@ NetworkDataTaskSoup::NetworkDataTaskSoup(NetworkSession& session, NetworkDataTas
     , m_shouldContentSniff(shouldContentSniff)
     , m_timeoutSource(RunLoop::main(), this, &NetworkDataTaskSoup::timeoutFired)
 {
-    static_cast<NetworkSessionSoup&>(m_session.get()).registerNetworkDataTask(*this);
+    m_session->registerNetworkDataTask(*this);
     if (m_scheduledFailureType != NoFailure)
         return;
 
@@ -80,7 +80,7 @@ NetworkDataTaskSoup::NetworkDataTaskSoup(NetworkSession& session, NetworkDataTas
 NetworkDataTaskSoup::~NetworkDataTaskSoup()
 {
     clearRequest();
-    static_cast<NetworkSessionSoup&>(m_session.get()).unregisterNetworkDataTask(*this);
+    m_session->unregisterNetworkDataTask(*this);
 }
 
 String NetworkDataTaskSoup::suggestedFilename() const
@@ -863,7 +863,7 @@ void NetworkDataTaskSoup::download()
     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);
index c8fa1a2..0bfe595 100644 (file)
@@ -42,14 +42,13 @@ public:
 
     ~NetworkDataTaskSoup();
 
-    void invalidateAndCancel();
-
 private:
     NetworkDataTaskSoup(NetworkSession&, NetworkDataTaskClient&, const WebCore::ResourceRequest&, WebCore::StoredCredentials, WebCore::ContentSniffingPolicy, bool shouldClearReferrerOnHTTPSToHTTPRedirect);
 
     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;
index ac82870..59ef91c 100644 (file)
 #include "config.h"
 #include "NetworkSessionSoup.h"
 
-#include "NetworkDataTaskSoup.h"
 #include <WebCore/NetworkStorageSession.h>
 #include <WebCore/SoupNetworkSession.h>
-#include <wtf/MainThread.h>
 
 using namespace WebCore;
 
@@ -49,10 +47,4 @@ SoupSession* NetworkSessionSoup::soupSession() const
     return networkStorageSession().soupNetworkSession().soupSession();
 }
 
-void NetworkSessionSoup::invalidateAndCancel()
-{
-    for (auto* task : m_dataTaskSet)
-        task->invalidateAndCancel();
-}
-
 } // namespace WebKit
index d75fb88..c5fcfd0 100644 (file)
 #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)
@@ -44,15 +41,8 @@ public:
 
     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
index f10f2cd..6e77ee6 100644 (file)
@@ -6,8 +6,6 @@ list(APPEND WebKit2_SOURCES
 
     NetworkProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp
 
-    NetworkProcess/Downloads/soup/DownloadSoup.cpp
-
     NetworkProcess/cache/NetworkCacheCodersSoup.cpp
     NetworkProcess/cache/NetworkCacheDataSoup.cpp
     NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp
index 75959a3..86c5557 100644 (file)
@@ -33,8 +33,6 @@ list(APPEND WebKit2_SOURCES
 
     NetworkProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp
 
-    NetworkProcess/Downloads/soup/DownloadSoup.cpp
-
     NetworkProcess/cache/NetworkCacheCodersSoup.cpp
     NetworkProcess/cache/NetworkCacheDataSoup.cpp
     NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp
index ab28691..1a60679 100644 (file)
                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 */; };
                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>"; };
                                5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */,
                                839901FF1BE9A01B000F3653 /* NetworkLoad.cpp */,
                                839901FE1BE9A01B000F3653 /* NetworkLoad.h */,
+                               539EB5461DC2EE40009D48CF /* NetworkDataTaskBlob.cpp */,
+                               539EB5471DC2EE40009D48CF /* NetworkDataTaskBlob.h */,
                                83D454D61BE9D3C4006C93BD /* NetworkLoadClient.h */,
                                839149631BEA838500D2D953 /* NetworkLoadParameters.h */,
                                510CC7DF16138E2900D03ED3 /* NetworkProcess.cpp */,
                                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 */,
                                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 */,