Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (201294 => 201295)
--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2016-05-23 20:44:06 UTC (rev 201294)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2016-05-23 20:54:01 UTC (rev 201295)
@@ -30,6 +30,7 @@
#import "Download.h"
#import "DownloadProxyMessages.h"
+#import "Logging.h"
#import "NetworkProcess.h"
#import "SessionTracker.h"
#import "WebCoreArgumentCoders.h"
@@ -109,6 +110,7 @@
ASSERT(!m_session->m_dataTaskMapWithoutCredentials.contains([m_task taskIdentifier]));
m_session->m_dataTaskMapWithoutCredentials.add([m_task taskIdentifier], this);
}
+ LOG(NetworkSession, "%llu Creating NetworkDataTask with URL %s", [m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String);
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
String storagePartition = WebCore::cookieStoragePartition(request);
Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm (201294 => 201295)
--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-05-23 20:44:06 UTC (rev 201294)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-05-23 20:54:01 UTC (rev 201295)
@@ -31,6 +31,7 @@
#import "CustomProtocolManager.h"
#import "DataReference.h"
#import "Download.h"
+#import "Logging.h"
#import "NetworkCache.h"
#import "NetworkLoad.h"
#import "NetworkProcess.h"
@@ -51,6 +52,8 @@
#import <wtf/MainThread.h>
#import <wtf/NeverDestroyed.h>
+using namespace WebKit;
+
static NSURLSessionResponseDisposition toNSURLSessionResponseDisposition(WebCore::PolicyAction disposition)
{
switch (disposition) {
@@ -114,28 +117,40 @@
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest *))completionHandler
{
+ auto taskIdentifier = task.taskIdentifier;
+ LOG(NetworkSession, "%llu willPerformHTTPRedirection from %s to %s", taskIdentifier, response.URL.absoluteString.UTF8String, request.URL.absoluteString.UTF8String);
+
auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier, storedCredentials)) {
auto completionHandlerCopy = Block_copy(completionHandler);
- networkDataTask->willPerformHTTPRedirection(response, request, [completionHandlerCopy](const WebCore::ResourceRequest& request) {
+ networkDataTask->willPerformHTTPRedirection(response, request, [completionHandlerCopy, taskIdentifier](const WebCore::ResourceRequest& request) {
+ LOG(NetworkSession, "%llu willPerformHTTPRedirection completionHandler (%s)", taskIdentifier, request.url().string().utf8().data());
completionHandlerCopy(request.nsURLRequest(WebCore::UpdateHTTPBody));
Block_release(completionHandlerCopy);
});
- } else
+ } else {
+ LOG(NetworkSession, "%llu willPerformHTTPRedirection completionHandler (nil)", taskIdentifier);
completionHandler(nil);
+ }
}
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask*)task _schemeUpgraded:(NSURLRequest*)request completionHandler:(void (^)(NSURLRequest*))completionHandler
{
+ auto taskIdentifier = task.taskIdentifier;
+ LOG(NetworkSession, "%llu _schemeUpgraded %s", taskIdentifier, request.URL.absoluteString.UTF8String);
+
auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
- if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier, storedCredentials)) {
+ if (auto* networkDataTask = _session->dataTaskForIdentifier(taskIdentifier, storedCredentials)) {
auto completionHandlerCopy = Block_copy(completionHandler);
- networkDataTask->willPerformHTTPRedirection(WebCore::synthesizeRedirectResponseIfNecessary([task currentRequest], request, nil), request, [completionHandlerCopy](const WebCore::ResourceRequest& request) {
+ networkDataTask->willPerformHTTPRedirection(WebCore::synthesizeRedirectResponseIfNecessary([task currentRequest], request, nil), request, [completionHandlerCopy, taskIdentifier](const WebCore::ResourceRequest& request) {
+ LOG(NetworkSession, "%llu _schemeUpgraded completionHandler (%s)", taskIdentifier, request.url().string().utf8().data());
completionHandlerCopy(request.nsURLRequest(WebCore::UpdateHTTPBody));
Block_release(completionHandlerCopy);
});
- } else
+ } else {
+ LOG(NetworkSession, "%llu _schemeUpgraded completionHandler (nil)", taskIdentifier);
completionHandler(nil);
+ }
}
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask willCacheResponse:(NSCachedURLResponse *)proposedResponse completionHandler:(void (^)(NSCachedURLResponse * _Nullable cachedResponse))completionHandler
@@ -150,13 +165,17 @@
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
{
+ auto taskIdentifier = task.taskIdentifier;
+ LOG(NetworkSession, "%llu didReceiveChallenge", taskIdentifier);
+
auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier, storedCredentials)) {
WebCore::AuthenticationChallenge authenticationChallenge(challenge);
auto completionHandlerCopy = Block_copy(completionHandler);
auto sessionID = _session->sessionID();
- auto challengeCompletionHandler = [completionHandlerCopy, sessionID, authenticationChallenge](WebKit::AuthenticationChallengeDisposition disposition, const WebCore::Credential& credential)
+ auto challengeCompletionHandler = [completionHandlerCopy, sessionID, authenticationChallenge, taskIdentifier](WebKit::AuthenticationChallengeDisposition disposition, const WebCore::Credential& credential)
{
+ LOG(NetworkSession, "%llu didReceiveChallenge completionHandler", taskIdentifier);
#if !USE(CREDENTIAL_STORAGE_WITH_NETWORK_SESSION)
UNUSED_PARAM(sessionID);
UNUSED_PARAM(authenticationChallenge);
@@ -179,12 +198,15 @@
Block_release(completionHandlerCopy);
};
networkDataTask->didReceiveChallenge(challenge, challengeCompletionHandler);
- } else
+ } else {
+ LOG(NetworkSession, "%llu didReceiveChallenge completionHandler (cancel)", taskIdentifier);
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
+ }
}
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error
{
+ LOG(NetworkSession, "%llu didCompleteWithError", task.taskIdentifier);
auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier, storedCredentials))
networkDataTask->didCompleteWithError(error);
@@ -209,8 +231,10 @@
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler
{
+ auto taskIdentifier = dataTask.taskIdentifier;
+ LOG(NetworkSession, "%llu didReceiveResponse", taskIdentifier);
auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
- if (auto* networkDataTask = _session->dataTaskForIdentifier(dataTask.taskIdentifier, storedCredentials)) {
+ if (auto* networkDataTask = _session->dataTaskForIdentifier(taskIdentifier, storedCredentials)) {
ASSERT(isMainThread());
// Avoid MIME type sniffing if the response comes back as 304 Not Modified.
@@ -223,12 +247,15 @@
WebCore::ResourceResponse resourceResponse(response);
copyTimingData([dataTask _timingData], resourceResponse.resourceLoadTiming());
auto completionHandlerCopy = Block_copy(completionHandler);
- networkDataTask->didReceiveResponse(resourceResponse, [completionHandlerCopy](WebCore::PolicyAction policyAction) {
+ networkDataTask->didReceiveResponse(resourceResponse, [completionHandlerCopy, taskIdentifier](WebCore::PolicyAction policyAction) {
+ LOG(NetworkSession, "%llu didReceiveResponse completionHandler (cancel)", taskIdentifier);
completionHandlerCopy(toNSURLSessionResponseDisposition(policyAction));
Block_release(completionHandlerCopy);
});
- } else
+ } else {
+ LOG(NetworkSession, "%llu didReceiveResponse completionHandler (cancel)", taskIdentifier);
completionHandler(NSURLSessionResponseCancel);
+ }
}
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data