Diff
Modified: trunk/Source/WebKit2/ChangeLog (196177 => 196178)
--- trunk/Source/WebKit2/ChangeLog 2016-02-05 18:52:19 UTC (rev 196177)
+++ trunk/Source/WebKit2/ChangeLog 2016-02-05 19:51:54 UTC (rev 196178)
@@ -1,5 +1,52 @@
2016-02-05 Alex Christensen <achristen...@webkit.org>
+ Move NetworkDataTask to its own header and source files
+ https://bugs.webkit.org/show_bug.cgi?id=153922
+
+ Reviewed by Tim Horton.
+
+ Also renamed NetworkSessionTaskClient to NetworkDataTaskClient.
+
+ * NetworkProcess/NetworkDataTask.h: Added.
+ (WebKit::NetworkDataTaskClient::~NetworkDataTaskClient):
+ (WebKit::NetworkDataTask::create):
+ (WebKit::NetworkDataTask::client):
+ (WebKit::NetworkDataTask::pendingDownloadID):
+ (WebKit::NetworkDataTask::pendingDownload):
+ (WebKit::NetworkDataTask::setPendingDownloadID):
+ (WebKit::NetworkDataTask::setPendingDownload):
+ * NetworkProcess/NetworkLoad.h:
+ * NetworkProcess/NetworkSession.h:
+ (WebKit::NetworkSessionTaskClient::~NetworkSessionTaskClient): Deleted.
+ (WebKit::NetworkDataTask::create): Deleted.
+ (WebKit::NetworkDataTask::client): Deleted.
+ (WebKit::NetworkDataTask::pendingDownloadID): Deleted.
+ (WebKit::NetworkDataTask::pendingDownload): Deleted.
+ (WebKit::NetworkDataTask::setPendingDownloadID): Deleted.
+ (WebKit::NetworkDataTask::setPendingDownload): Deleted.
+ * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: Added.
+ (WebKit::NetworkDataTask::NetworkDataTask):
+ (WebKit::NetworkDataTask::~NetworkDataTask):
+ (WebKit::NetworkDataTask::scheduleFailure):
+ (WebKit::NetworkDataTask::failureTimerFired):
+ (WebKit::NetworkDataTask::tryPasswordBasedAuthentication):
+ (WebKit::NetworkDataTask::cancel):
+ (WebKit::NetworkDataTask::resume):
+ (WebKit::NetworkDataTask::suspend):
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (WebKit::NetworkSession::takeDownloadID):
+ (WebKit::NetworkDataTask::NetworkDataTask): Deleted.
+ (WebKit::NetworkDataTask::~NetworkDataTask): Deleted.
+ (WebKit::NetworkDataTask::scheduleFailure): Deleted.
+ (WebKit::NetworkDataTask::failureTimerFired): Deleted.
+ (WebKit::NetworkDataTask::tryPasswordBasedAuthentication): Deleted.
+ (WebKit::NetworkDataTask::cancel): Deleted.
+ (WebKit::NetworkDataTask::resume): Deleted.
+ (WebKit::NetworkDataTask::suspend): Deleted.
+ * WebKit2.xcodeproj/project.pbxproj:
+
+2016-02-05 Alex Christensen <achristen...@webkit.org>
+
Clean up Blob code
https://bugs.webkit.org/show_bug.cgi?id=153910
Added: trunk/Source/WebKit2/NetworkProcess/NetworkDataTask.h (0 => 196178)
--- trunk/Source/WebKit2/NetworkProcess/NetworkDataTask.h (rev 0)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkDataTask.h 2016-02-05 19:51:54 UTC (rev 196178)
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * 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.
+ */
+
+#ifndef NetworkDataTask_h
+#define NetworkDataTask_h
+
+#include <WebCore/FrameLoaderTypes.h>
+#include <WebCore/ResourceHandleTypes.h>
+#include <WebCore/Timer.h>
+#include <wtf/RetainPtr.h>
+#include <wtf/text/WTFString.h>
+
+#if PLATFORM(COCOA)
+OBJC_CLASS NSURLSessionDataTask;
+#endif
+
+namespace WebCore {
+class AuthenticationChallenge;
+class Credential;
+class ResourceError;
+class ResourceRequest;
+class ResourceResponse;
+class SharedBuffer;
+}
+
+namespace WebKit {
+
+class NetworkSession;
+class PendingDownload;
+
+enum class AuthenticationChallengeDisposition {
+ UseCredential,
+ PerformDefaultHandling,
+ Cancel,
+ RejectProtectionSpace
+};
+
+typedef std::function<void(const WebCore::ResourceRequest&)> RedirectCompletionHandler;
+typedef std::function<void(AuthenticationChallengeDisposition, const WebCore::Credential&)> ChallengeCompletionHandler;
+typedef std::function<void(WebCore::PolicyAction)> ResponseCompletionHandler;
+
+class NetworkDataTaskClient {
+public:
+ virtual void willPerformHTTPRedirection(const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, RedirectCompletionHandler) = 0;
+ virtual void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler) = 0;
+ virtual void didReceiveResponse(const WebCore::ResourceResponse&, ResponseCompletionHandler) = 0;
+ virtual void didReceiveData(RefPtr<WebCore::SharedBuffer>&&) = 0;
+ virtual void didCompleteWithError(const WebCore::ResourceError&) = 0;
+ virtual void didBecomeDownload() = 0;
+ virtual void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) = 0;
+ virtual void wasBlocked() = 0;
+ virtual void cannotShowURL() = 0;
+
+ virtual ~NetworkDataTaskClient() { }
+};
+
+class NetworkDataTask : public RefCounted<NetworkDataTask> {
+ friend class NetworkSession;
+public:
+ static Ref<NetworkDataTask> create(NetworkSession& session, NetworkDataTaskClient& client, const WebCore::ResourceRequest& request, WebCore::StoredCredentials storedCredentials)
+ {
+ return adoptRef(*new NetworkDataTask(session, client, request, storedCredentials));
+ }
+
+ void suspend();
+ void cancel();
+ void resume();
+
+ typedef uint64_t TaskIdentifier;
+ TaskIdentifier taskIdentifier();
+
+ ~NetworkDataTask();
+
+ NetworkDataTaskClient& client() { return m_client; }
+
+ DownloadID pendingDownloadID() { return m_pendingDownloadID; }
+ PendingDownload* pendingDownload() { return m_pendingDownload; }
+ void setPendingDownloadID(DownloadID downloadID)
+ {
+ ASSERT(!m_pendingDownloadID.downloadID());
+ ASSERT(downloadID.downloadID());
+ m_pendingDownloadID = downloadID;
+ }
+ void setPendingDownload(PendingDownload& pendingDownload)
+ {
+ ASSERT(!m_pendingDownload);
+ m_pendingDownload = &pendingDownload;
+ }
+ bool tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler);
+
+private:
+ NetworkDataTask(NetworkSession&, NetworkDataTaskClient&, const WebCore::ResourceRequest&, WebCore::StoredCredentials);
+
+ enum FailureType {
+ NoFailure,
+ BlockedFailure,
+ InvalidURLFailure
+ };
+ FailureType m_scheduledFailureType { NoFailure };
+ WebCore::Timer m_failureTimer;
+ void failureTimerFired();
+ void scheduleFailure(FailureType);
+
+ NetworkSession& m_session;
+ NetworkDataTaskClient& m_client;
+ PendingDownload* m_pendingDownload { nullptr };
+ DownloadID m_pendingDownloadID;
+ String m_user;
+ String m_password;
+#if PLATFORM(COCOA)
+ RetainPtr<NSURLSessionDataTask> m_task;
+#endif
+};
+
+}
+
+#endif
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkLoad.h (196177 => 196178)
--- trunk/Source/WebKit2/NetworkProcess/NetworkLoad.h 2016-02-05 18:52:19 UTC (rev 196177)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkLoad.h 2016-02-05 19:51:54 UTC (rev 196178)
@@ -42,7 +42,7 @@
class NetworkLoad
#if USE(NETWORK_SESSION)
- : public NetworkSessionTaskClient
+ : public NetworkDataTaskClient
#else
: public WebCore::ResourceHandleClient
#endif
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkSession.h (196177 => 196178)
--- trunk/Source/WebKit2/NetworkProcess/NetworkSession.h 2016-02-05 18:52:19 UTC (rev 196177)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkSession.h 2016-02-05 19:51:54 UTC (rev 196178)
@@ -28,121 +28,19 @@
#if PLATFORM(COCOA)
OBJC_CLASS NSURLSession;
-OBJC_CLASS NSURLSessionDataTask;
OBJC_CLASS NSOperationQueue;
OBJC_CLASS WKNetworkSessionDelegate;
#endif
#include "DownloadID.h"
-#include <WebCore/FrameLoaderTypes.h>
-#include <WebCore/ResourceHandleTypes.h>
+#include "NetworkDataTask.h"
#include <WebCore/SessionID.h>
-#include <WebCore/Timer.h>
#include <wtf/HashMap.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
-#include <wtf/RetainPtr.h>
-#include <wtf/WeakPtr.h>
-#include <wtf/text/WTFString.h>
-namespace WebCore {
-class AuthenticationChallenge;
-class Credential;
-class ResourceError;
-class ResourceRequest;
-class ResourceResponse;
-class SharedBuffer;
-}
-
namespace WebKit {
-enum class AuthenticationChallengeDisposition {
- UseCredential,
- PerformDefaultHandling,
- Cancel,
- RejectProtectionSpace
-};
-
-class NetworkSession;
-class PendingDownload;
-
-typedef std::function<void(const WebCore::ResourceRequest&)> RedirectCompletionHandler;
-typedef std::function<void(AuthenticationChallengeDisposition, const WebCore::Credential&)> ChallengeCompletionHandler;
-typedef std::function<void(WebCore::PolicyAction)> ResponseCompletionHandler;
-
-class NetworkSessionTaskClient {
-public:
- virtual void willPerformHTTPRedirection(const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, RedirectCompletionHandler) = 0;
- virtual void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler) = 0;
- virtual void didReceiveResponse(const WebCore::ResourceResponse&, ResponseCompletionHandler) = 0;
- virtual void didReceiveData(RefPtr<WebCore::SharedBuffer>&&) = 0;
- virtual void didCompleteWithError(const WebCore::ResourceError&) = 0;
- virtual void didBecomeDownload() = 0;
- virtual void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) = 0;
- virtual void wasBlocked() = 0;
- virtual void cannotShowURL() = 0;
-
- virtual ~NetworkSessionTaskClient() { }
-};
-
-class NetworkDataTask : public RefCounted<NetworkDataTask> {
- friend class NetworkSession;
-public:
- static Ref<NetworkDataTask> create(NetworkSession& session, NetworkSessionTaskClient& client, const WebCore::ResourceRequest& request, WebCore::StoredCredentials storedCredentials)
- {
- return adoptRef(*new NetworkDataTask(session, client, request, storedCredentials));
- }
-
- void suspend();
- void cancel();
- void resume();
-
- typedef uint64_t TaskIdentifier;
- TaskIdentifier taskIdentifier();
-
- ~NetworkDataTask();
-
- NetworkSessionTaskClient& client() { return m_client; }
-
- DownloadID pendingDownloadID() { return m_pendingDownloadID; }
- PendingDownload* pendingDownload() { return m_pendingDownload; }
- void setPendingDownloadID(DownloadID downloadID)
- {
- ASSERT(!m_pendingDownloadID.downloadID());
- ASSERT(downloadID.downloadID());
- m_pendingDownloadID = downloadID;
- }
- void setPendingDownload(PendingDownload& pendingDownload)
- {
- ASSERT(!m_pendingDownload);
- m_pendingDownload = &pendingDownload;
- }
- bool tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler);
-
-private:
- NetworkDataTask(NetworkSession&, NetworkSessionTaskClient&, const WebCore::ResourceRequest&, WebCore::StoredCredentials);
-
- enum FailureType {
- NoFailure,
- BlockedFailure,
- InvalidURLFailure
- };
- FailureType m_scheduledFailureType { NoFailure };
- WebCore::Timer m_failureTimer;
- void failureTimerFired();
- void scheduleFailure(FailureType);
-
- NetworkSession& m_session;
- NetworkSessionTaskClient& m_client;
- PendingDownload* m_pendingDownload { nullptr };
- DownloadID m_pendingDownloadID;
- String m_user;
- String m_password;
-#if PLATFORM(COCOA)
- RetainPtr<NSURLSessionDataTask> m_task;
-#endif
-};
-
class NetworkSession {
friend class NetworkDataTask;
public:
Added: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (0 => 196178)
--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (rev 0)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2016-02-05 19:51:54 UTC (rev 196178)
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * 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.
+ */
+
+#import "config.h"
+#import "NetworkSession.h"
+
+#if USE(NETWORK_SESSION)
+
+#import <WebCore/AuthenticationChallenge.h>
+#import <WebCore/ResourceRequest.h>
+#import <wtf/MainThread.h>
+
+namespace WebKit {
+
+NetworkDataTask::NetworkDataTask(NetworkSession& session, NetworkDataTaskClient& client, const WebCore::ResourceRequest& requestWithCredentials, WebCore::StoredCredentials storedCredentials)
+ : m_failureTimer(*this, &NetworkDataTask::failureTimerFired)
+ , m_session(session)
+ , m_client(client)
+{
+ ASSERT(isMainThread());
+
+ if (!requestWithCredentials.url().isValid()) {
+ scheduleFailure(InvalidURLFailure);
+ return;
+ }
+
+ if (!portAllowed(requestWithCredentials.url())) {
+ scheduleFailure(BlockedFailure);
+ return;
+ }
+
+ auto request = requestWithCredentials;
+ m_user = request.url().user();
+ m_password = request.url().pass();
+ request.removeCredentials();
+
+ if (storedCredentials == WebCore::AllowStoredCredentials)
+ m_task = [m_session.m_sessionWithCredentialStorage dataTaskWithRequest:request.nsURLRequest(WebCore::UpdateHTTPBody)];
+ else
+ m_task = [m_session.m_sessionWithoutCredentialStorage dataTaskWithRequest:request.nsURLRequest(WebCore::UpdateHTTPBody)];
+
+ ASSERT(!m_session.m_dataTaskMap.contains(taskIdentifier()));
+ m_session.m_dataTaskMap.add(taskIdentifier(), this);
+}
+
+NetworkDataTask::~NetworkDataTask()
+{
+ if (m_task) {
+ ASSERT(m_session.m_dataTaskMap.contains(taskIdentifier()));
+ ASSERT(m_session.m_dataTaskMap.get(taskIdentifier()) == this);
+ ASSERT(isMainThread());
+ m_session.m_dataTaskMap.remove(taskIdentifier());
+ }
+}
+
+void NetworkDataTask::scheduleFailure(FailureType type)
+{
+ ASSERT(type != NoFailure);
+ m_scheduledFailureType = type;
+ m_failureTimer.startOneShot(0);
+}
+
+void NetworkDataTask::failureTimerFired()
+{
+ RefPtr<NetworkDataTask> protect(this);
+
+ switch (m_scheduledFailureType) {
+ case BlockedFailure:
+ m_scheduledFailureType = NoFailure;
+ client().wasBlocked();
+ return;
+ case InvalidURLFailure:
+ m_scheduledFailureType = NoFailure;
+ client().cannotShowURL();
+ return;
+ case NoFailure:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ ASSERT_NOT_REACHED();
+}
+
+bool NetworkDataTask::tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge& challenge, ChallengeCompletionHandler completionHandler)
+{
+ if (!challenge.protectionSpace().isPasswordBased())
+ return false;
+
+ if (!m_user.isNull() && !m_password.isNull()) {
+ completionHandler(AuthenticationChallengeDisposition::UseCredential, WebCore::Credential(m_user, m_password, WebCore::CredentialPersistenceForSession));
+ m_user = String();
+ m_password = String();
+ return true;
+ }
+
+ if (!challenge.proposedCredential().isEmpty() && !challenge.previousFailureCount()) {
+ completionHandler(AuthenticationChallengeDisposition::UseCredential, challenge.proposedCredential());
+ return true;
+ }
+
+ return false;
+}
+
+void NetworkDataTask::cancel()
+{
+ [m_task cancel];
+}
+
+void NetworkDataTask::resume()
+{
+ if (m_scheduledFailureType != NoFailure)
+ m_failureTimer.startOneShot(0);
+ [m_task resume];
+}
+
+void NetworkDataTask::suspend()
+{
+ if (m_failureTimer.isActive())
+ m_failureTimer.stop();
+ [m_task suspend];
+}
+
+auto NetworkDataTask::taskIdentifier() -> TaskIdentifier
+{
+ return [m_task taskIdentifier];
+}
+}
+
+#endif
Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm (196177 => 196178)
--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-02-05 18:52:19 UTC (rev 196177)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-02-05 19:51:54 UTC (rev 196178)
@@ -34,7 +34,6 @@
#import "NetworkProcess.h"
#import "SessionTracker.h"
#import <Foundation/NSURLSession.h>
-#import <WebCore/AuthenticationChallenge.h>
#import <WebCore/CFNetworkSPI.h>
#import <WebCore/Credential.h>
#import <WebCore/FrameLoaderTypes.h>
@@ -274,118 +273,6 @@
return downloadID;
}
-NetworkDataTask::NetworkDataTask(NetworkSession& session, NetworkSessionTaskClient& client, const WebCore::ResourceRequest& requestWithCredentials, WebCore::StoredCredentials storedCredentials)
- : m_failureTimer(*this, &NetworkDataTask::failureTimerFired)
- , m_session(session)
- , m_client(client)
-{
- ASSERT(isMainThread());
-
- if (!requestWithCredentials.url().isValid()) {
- scheduleFailure(InvalidURLFailure);
- return;
- }
-
- if (!portAllowed(requestWithCredentials.url())) {
- scheduleFailure(BlockedFailure);
- return;
- }
-
- auto request = requestWithCredentials;
- m_user = request.url().user();
- m_password = request.url().pass();
- request.removeCredentials();
-
- if (storedCredentials == WebCore::AllowStoredCredentials)
- m_task = [m_session.m_sessionWithCredentialStorage dataTaskWithRequest:request.nsURLRequest(WebCore::UpdateHTTPBody)];
- else
- m_task = [m_session.m_sessionWithoutCredentialStorage dataTaskWithRequest:request.nsURLRequest(WebCore::UpdateHTTPBody)];
-
- ASSERT(!m_session.m_dataTaskMap.contains(taskIdentifier()));
- m_session.m_dataTaskMap.add(taskIdentifier(), this);
}
-NetworkDataTask::~NetworkDataTask()
-{
- if (m_task) {
- ASSERT(m_session.m_dataTaskMap.contains(taskIdentifier()));
- ASSERT(m_session.m_dataTaskMap.get(taskIdentifier()) == this);
- ASSERT(isMainThread());
- m_session.m_dataTaskMap.remove(taskIdentifier());
- }
-}
-
-void NetworkDataTask::scheduleFailure(FailureType type)
-{
- ASSERT(type != NoFailure);
- m_scheduledFailureType = type;
- m_failureTimer.startOneShot(0);
-}
-
-void NetworkDataTask::failureTimerFired()
-{
- RefPtr<NetworkDataTask> protect(this);
-
- switch (m_scheduledFailureType) {
- case BlockedFailure:
- m_scheduledFailureType = NoFailure;
- client().wasBlocked();
- return;
- case InvalidURLFailure:
- m_scheduledFailureType = NoFailure;
- client().cannotShowURL();
- return;
- case NoFailure:
- ASSERT_NOT_REACHED();
- break;
- }
- ASSERT_NOT_REACHED();
-}
-
-bool NetworkDataTask::tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge& challenge, ChallengeCompletionHandler completionHandler)
-{
- if (!challenge.protectionSpace().isPasswordBased())
- return false;
-
- if (!m_user.isNull() && !m_password.isNull()) {
- completionHandler(AuthenticationChallengeDisposition::UseCredential, WebCore::Credential(m_user, m_password, WebCore::CredentialPersistenceForSession));
- m_user = String();
- m_password = String();
- return true;
- }
-
- if (!challenge.proposedCredential().isEmpty() && !challenge.previousFailureCount()) {
- completionHandler(AuthenticationChallengeDisposition::UseCredential, challenge.proposedCredential());
- return true;
- }
-
- return false;
-}
-
-void NetworkDataTask::cancel()
-{
- [m_task cancel];
-}
-
-void NetworkDataTask::resume()
-{
- if (m_scheduledFailureType != NoFailure)
- m_failureTimer.startOneShot(0);
- [m_task resume];
-}
-
-void NetworkDataTask::suspend()
-{
- if (m_failureTimer.isActive())
- m_failureTimer.stop();
- [m_task suspend];
-}
-
-auto NetworkDataTask::taskIdentifier() -> TaskIdentifier
-{
- return [m_task taskIdentifier];
-}
-
-}
-
#endif
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (196177 => 196178)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2016-02-05 18:52:19 UTC (rev 196177)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2016-02-05 19:51:54 UTC (rev 196178)
@@ -1063,6 +1063,8 @@
5C20CBA01BB1ECD800895BB1 /* NetworkSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C20CB9E1BB0DD1800895BB1 /* NetworkSession.h */; };
5C298DA01C3DF02100470AFE /* PendingDownload.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C298D9E1C3DEF2900470AFE /* PendingDownload.h */; };
5C85C7881C3F23CE0061A4FA /* PendingDownload.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C85C7861C3F23C50061A4FA /* PendingDownload.cpp */; };
+ 5CBC9B8D1C65279C00A8FDCF /* NetworkDataTaskCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */; };
+ 5CBC9B8E1C652CA000A8FDCF /* NetworkDataTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */; };
5DA6ED0A1490606900B41D12 /* DynamicLinkerEnvironmentExtractor.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DA6ED081490606900B41D12 /* DynamicLinkerEnvironmentExtractor.h */; };
5DA6ED0B1490606900B41D12 /* DynamicLinkerEnvironmentExtractor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5DA6ED091490606900B41D12 /* DynamicLinkerEnvironmentExtractor.mm */; };
6501BD1A12F1243400E9F248 /* WKBundleInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */; };
@@ -3167,6 +3169,8 @@
5C20CB9E1BB0DD1800895BB1 /* NetworkSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkSession.h; path = NetworkProcess/NetworkSession.h; sourceTree = "<group>"; };
5C298D9E1C3DEF2900470AFE /* PendingDownload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PendingDownload.h; path = NetworkProcess/Downloads/PendingDownload.h; sourceTree = "<group>"; };
5C85C7861C3F23C50061A4FA /* PendingDownload.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PendingDownload.cpp; path = NetworkProcess/Downloads/PendingDownload.cpp; sourceTree = "<group>"; };
+ 5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkDataTask.h; path = NetworkProcess/NetworkDataTask.h; sourceTree = "<group>"; };
+ 5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkDataTaskCocoa.mm; path = NetworkProcess/cocoa/NetworkDataTaskCocoa.mm; sourceTree = "<group>"; };
5D442A5516D5856700AC3331 /* PluginService.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PluginService.entitlements; sourceTree = "<group>"; };
5DA6ED081490606900B41D12 /* DynamicLinkerEnvironmentExtractor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DynamicLinkerEnvironmentExtractor.h; sourceTree = "<group>"; };
5DA6ED091490606900B41D12 /* DynamicLinkerEnvironmentExtractor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DynamicLinkerEnvironmentExtractor.mm; sourceTree = "<group>"; };
@@ -5369,6 +5373,7 @@
510CC7DA16138E0100D03ED3 /* NetworkProcess */ = {
isa = PBXGroup;
children = (
+ 5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */,
5C1426F21C23F82D00D41183 /* CustomProtocols */,
5C1426F11C23F81700D41183 /* Downloads */,
5C1426E21C23F80500D41183 /* NetworkProcessCreationParameters.cpp */,
@@ -5762,6 +5767,7 @@
7EC4F0F818E4A922008056AF /* cocoa */ = {
isa = PBXGroup;
children = (
+ 5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */,
7EC4F0F918E4A945008056AF /* NetworkProcessCocoa.mm */,
5C20CB9B1BB0DCD200895BB1 /* NetworkSessionCocoa.mm */,
);
@@ -7489,6 +7495,7 @@
512F589712A8838800629530 /* AuthenticationChallengeProxy.h in Headers */,
512F589912A8838800629530 /* AuthenticationDecisionListener.h in Headers */,
518E8EF916B2091C00E91429 /* AuthenticationManager.h in Headers */,
+ 5CBC9B8E1C652CA000A8FDCF /* NetworkDataTask.h in Headers */,
512F58A312A883AD00629530 /* AuthenticationManagerMessages.h in Headers */,
7CD102DA1866770600ED429D /* AutoCorrectionCallback.h in Headers */,
CDA041F41ACE2105004A13EC /* BackBoardServicesSPI.h in Headers */,
@@ -9279,6 +9286,7 @@
1A0EC910124C0AF5007EF4A5 /* PluginProcessConnectionManager.cpp in Sources */,
1A7865B916CAC71500ACE83A /* PluginProcessConnectionManagerMessageReceiver.cpp in Sources */,
1A2BB6D014117B4D000F35D4 /* PluginProcessConnectionMessageReceiver.cpp in Sources */,
+ 5CBC9B8D1C65279C00A8FDCF /* NetworkDataTaskCocoa.mm in Sources */,
1A2D90D31281C966001EB962 /* PluginProcessCreationParameters.cpp in Sources */,
1AA4792312A59FD9008236C3 /* PluginProcessMac.mm in Sources */,
BC82838C16B45F0700A278FE /* PluginProcessMain.mm in Sources */,