Title: [221632] trunk/Source/WebKit
Revision
221632
Author
bfulg...@apple.com
Date
2017-09-05 13:41:31 -0700 (Tue, 05 Sep 2017)

Log Message

Use a single network storage session for stateless connections
https://bugs.webkit.org/show_bug.cgi?id=176386
<rdar://problem/34262148>

Reviewed by Alex Christensen.

Change the name of 'm_dataTaskMapWithoutCredentials' to 'm_dataTaskMapWithoutState'
to reflect that the data tasks do not involve credential or cookie storage. Ditto for
the change from 'm_sessionWIthoutCredentialStorage' to 'm_statelessSession'.

This update should not change behavior, unless some stateless sessions were depending
on cookies to be persistent (which would be a bug!)

* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Update for new variable names.
(WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa): Ditto.
* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Update the configuration to block
cookies as well.
(WebKit::NetworkSessionCocoa::invalidateAndCancel): Update for new names.
(WebKit::NetworkSessionCocoa::clearCredentials): Ditto.
(WebKit::NetworkSessionCocoa::dataTaskForIdentifier): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (221631 => 221632)


--- trunk/Source/WebKit/ChangeLog	2017-09-05 20:19:30 UTC (rev 221631)
+++ trunk/Source/WebKit/ChangeLog	2017-09-05 20:41:31 UTC (rev 221632)
@@ -1,3 +1,29 @@
+2017-09-05  Brent Fulgham  <bfulg...@apple.com>
+
+        Use a single network storage session for stateless connections
+        https://bugs.webkit.org/show_bug.cgi?id=176386
+        <rdar://problem/34262148>
+
+        Reviewed by Alex Christensen.
+
+        Change the name of 'm_dataTaskMapWithoutCredentials' to 'm_dataTaskMapWithoutState'
+        to reflect that the data tasks do not involve credential or cookie storage. Ditto for
+        the change from 'm_sessionWIthoutCredentialStorage' to 'm_statelessSession'.
+
+        This update should not change behavior, unless some stateless sessions were depending
+        on cookies to be persistent (which would be a bug!)
+
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+        (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Update for new variable names.
+        (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa): Ditto.
+        * NetworkProcess/cocoa/NetworkSessionCocoa.h:
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Update the configuration to block
+        cookies as well.
+        (WebKit::NetworkSessionCocoa::invalidateAndCancel): Update for new names.
+        (WebKit::NetworkSessionCocoa::clearCredentials): Ditto.
+        (WebKit::NetworkSessionCocoa::dataTaskForIdentifier): Ditto.
+
 2017-09-05  Yousuke Kimoto  <yousuke.kim...@sony.com>
 
         [WinCairo] Add Network Process files for wincairo webkit

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (221631 => 221632)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2017-09-05 20:19:30 UTC (rev 221631)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2017-09-05 20:41:31 UTC (rev 221632)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -116,9 +116,9 @@
         ASSERT(!cocoaSession.m_dataTaskMapWithCredentials.contains([m_task taskIdentifier]));
         cocoaSession.m_dataTaskMapWithCredentials.add([m_task taskIdentifier], this);
     } else {
-        m_task = [cocoaSession.m_sessionWithoutCredentialStorage dataTaskWithRequest:nsRequest];
-        ASSERT(!cocoaSession.m_dataTaskMapWithoutCredentials.contains([m_task taskIdentifier]));
-        cocoaSession.m_dataTaskMapWithoutCredentials.add([m_task taskIdentifier], this);
+        m_task = [cocoaSession.m_statelessSession dataTaskWithRequest:nsRequest];
+        ASSERT(!cocoaSession.m_dataTaskMapWithoutState.contains([m_task taskIdentifier]));
+        cocoaSession.m_dataTaskMapWithoutState.add([m_task taskIdentifier], this);
     }
     LOG(NetworkSession, "%llu Creating NetworkDataTask with URL %s", [m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String);
 
@@ -144,8 +144,8 @@
         ASSERT(cocoaSession.m_dataTaskMapWithCredentials.get([m_task taskIdentifier]) == this);
         cocoaSession.m_dataTaskMapWithCredentials.remove([m_task taskIdentifier]);
     } else {
-        ASSERT(cocoaSession.m_dataTaskMapWithoutCredentials.get([m_task taskIdentifier]) == this);
-        cocoaSession.m_dataTaskMapWithoutCredentials.remove([m_task taskIdentifier]);
+        ASSERT(cocoaSession.m_dataTaskMapWithoutState.get([m_task taskIdentifier]) == this);
+        cocoaSession.m_dataTaskMapWithoutState.remove([m_task taskIdentifier]);
     }
 }
 

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h (221631 => 221632)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h	2017-09-05 20:19:30 UTC (rev 221631)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h	2017-09-05 20:41:31 UTC (rev 221632)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -70,13 +70,13 @@
     void clearCredentials() override;
 
     HashMap<NetworkDataTaskCocoa::TaskIdentifier, NetworkDataTaskCocoa*> m_dataTaskMapWithCredentials;
-    HashMap<NetworkDataTaskCocoa::TaskIdentifier, NetworkDataTaskCocoa*> m_dataTaskMapWithoutCredentials;
+    HashMap<NetworkDataTaskCocoa::TaskIdentifier, NetworkDataTaskCocoa*> m_dataTaskMapWithoutState;
     HashMap<NetworkDataTaskCocoa::TaskIdentifier, DownloadID> m_downloadMap;
 
     RetainPtr<NSURLSession> m_sessionWithCredentialStorage;
     RetainPtr<WKNetworkSessionDelegate> m_sessionWithCredentialStorageDelegate;
-    RetainPtr<NSURLSession> m_sessionWithoutCredentialStorage;
-    RetainPtr<WKNetworkSessionDelegate> m_sessionWithoutCredentialStorageDelegate;
+    RetainPtr<NSURLSession> m_statelessSession;
+    RetainPtr<WKNetworkSessionDelegate> m_statelessSessionDelegate;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (221631 => 221632)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2017-09-05 20:19:30 UTC (rev 221631)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2017-09-05 20:41:31 UTC (rev 221632)
@@ -597,12 +597,15 @@
 
     m_sessionWithCredentialStorageDelegate = adoptNS([[WKNetworkSessionDelegate alloc] initWithNetworkSession:*this withCredentials:true]);
     m_sessionWithCredentialStorage = [NSURLSession sessionWithConfiguration:configuration delegate:static_cast<id>(m_sessionWithCredentialStorageDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
+    LOG(NetworkSession, "Created NetworkSession with cookieAcceptPolicy %lu", configuration.HTTPCookieStorage.cookieAcceptPolicy);
 
     configuration.URLCredentialStorage = nil;
     configuration._shouldSkipPreferredClientCertificateLookup = YES;
-    m_sessionWithoutCredentialStorageDelegate = adoptNS([[WKNetworkSessionDelegate alloc] initWithNetworkSession:*this withCredentials:false]);
-    m_sessionWithoutCredentialStorage = [NSURLSession sessionWithConfiguration:configuration delegate:static_cast<id>(m_sessionWithoutCredentialStorageDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
-    LOG(NetworkSession, "Created NetworkSession with cookieAcceptPolicy %lu", configuration.HTTPCookieStorage.cookieAcceptPolicy);
+    configuration.HTTPCookieStorage = nil;
+    configuration.HTTPCookieAcceptPolicy = NSHTTPCookieAcceptPolicyNever;
+
+    m_statelessSessionDelegate = adoptNS([[WKNetworkSessionDelegate alloc] initWithNetworkSession:*this withCredentials:false]);
+    m_statelessSession = [NSURLSession sessionWithConfiguration:configuration delegate:static_cast<id>(m_statelessSessionDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
 }
 
 NetworkSessionCocoa::~NetworkSessionCocoa()
@@ -614,9 +617,9 @@
     NetworkSession::invalidateAndCancel();
 
     [m_sessionWithCredentialStorage invalidateAndCancel];
-    [m_sessionWithoutCredentialStorage invalidateAndCancel];
+    [m_statelessSession invalidateAndCancel];
     [m_sessionWithCredentialStorageDelegate sessionInvalidated];
-    [m_sessionWithoutCredentialStorageDelegate sessionInvalidated];
+    [m_statelessSessionDelegate sessionInvalidated];
 }
 
 void NetworkSessionCocoa::clearCredentials()
@@ -623,11 +626,11 @@
 {
 #if !USE(CREDENTIAL_STORAGE_WITH_NETWORK_SESSION)
     ASSERT(m_dataTaskMapWithCredentials.isEmpty());
-    ASSERT(m_dataTaskMapWithoutCredentials.isEmpty());
+    ASSERT(m_dataTaskMapWithoutState.isEmpty());
     ASSERT(m_downloadMap.isEmpty());
     // FIXME: Use resetWithCompletionHandler instead.
     m_sessionWithCredentialStorage = [NSURLSession sessionWithConfiguration:m_sessionWithCredentialStorage.get().configuration delegate:static_cast<id>(m_sessionWithCredentialStorageDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
-    m_sessionWithoutCredentialStorage = [NSURLSession sessionWithConfiguration:m_sessionWithoutCredentialStorage.get().configuration delegate:static_cast<id>(m_sessionWithoutCredentialStorageDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
+    m_statelessSession = [NSURLSession sessionWithConfiguration:m_statelessSession.get().configuration delegate:static_cast<id>(m_statelessSessionDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
 #endif
 }
 
@@ -636,7 +639,7 @@
     ASSERT(RunLoop::isMain());
     if (storedCredentials == WebCore::StoredCredentials::AllowStoredCredentials)
         return m_dataTaskMapWithCredentials.get(taskIdentifier);
-    return m_dataTaskMapWithoutCredentials.get(taskIdentifier);
+    return m_dataTaskMapWithoutState.get(taskIdentifier);
 }
 
 void NetworkSessionCocoa::addDownloadID(NetworkDataTaskCocoa::TaskIdentifier taskIdentifier, DownloadID downloadID)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to