+2015-11-03 Alex Christensen <achristensen@webkit.org>
+
+ Use the same cookie storage as WebCore when using NETWORK_SESSION
+ https://bugs.webkit.org/show_bug.cgi?id=150833
+
+ Reviewed by Antti Koivisto.
+
+ This fixes 12 tests when using NETWORK_SESSION.
+
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (WebKit::NetworkSession::NetworkSession):
+
2015-11-03 Alex Christensen <achristensen@webkit.org>
Clean up NETWORK_SESSION code after r191848
#if USE(NETWORK_SESSION)
+#import "SessionTracker.h"
#import <Foundation/NSURLSession.h>
-
#import <WebCore/AuthenticationChallenge.h>
+#import <WebCore/CFNetworkSPI.h>
#import <WebCore/Credential.h>
#import <WebCore/ResourceError.h>
#import <WebCore/ResourceRequest.h>
m_sessionDelegate = adoptNS([[NetworkSessionDelegate alloc] initWithNetworkSession:*this]);
NSURLSessionConfiguration *configuration = configurationForType(type);
+ // FIXME: Use SessionTracker to make sure the correct cookie storage is used once there is more than one NetworkSession.
+ if (auto* session = SessionTracker::session(WebCore::SessionID::defaultSessionID())) {
+ if (CFHTTPCookieStorageRef storage = session->cookieStorage().get())
+ configuration.HTTPCookieStorage = [[[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:storage] autorelease];
+ }
m_session = [NSURLSession sessionWithConfiguration:configuration delegate:static_cast<id>(m_sessionDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
}