Expose _boundInterfaceIdentifier and _allowsCellularAccess to WKWebsiteDataStorePrivate
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Oct 2017 20:39:34 +0000 (20:39 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Oct 2017 20:39:34 +0000 (20:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=178418
<rdar://problem/29599569>

Patch by Alex Christensen <achristensen@webkit.org> on 2017-10-20
Reviewed by Tim Horton.
Source/WebCore/PAL:

* pal/spi/cf/CFNetworkSPI.h:

Source/WebKit:

In r213747 I introduced allowsCellularAccess to _WKProcessPoolConfiguration because there
was no way to add parameters to the default (and other) NetworkSession constructors.  Since
clients have not adopted this SPI, we can introduce such a way in NetworkSessionCreationParameters
and move the SPI to WKWebsiteDataStore, which is where it and other NetworkSession properties
ought to be instead of making them WKProcessPool global.

We also need to expose access to NSURLRequest.boundInterfaceIdentifier.  Instead of serializing and
deserializing that property for each NSURLRequest and then having subresources mysteriously jump back
to having no bound interface identifiers, I'm adding this to WKWebsiteDataStore, too, to make it a
session networking property.

I manually verified that these properties are being set properly with a custom test app and added logs.
Unfortunately, these properties don't do anything under circumstances anywhere close to what we test.
The architecture change of having NetworkSessionCreationParameters is verified to not have a change in
behavior by existing tests, such as any test that uses TestProtocol (which we should eventually remove).

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::NetworkProcess):
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::clearCachedCredentials):
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::create):
(WebKit::NetworkSession::defaultSession): Deleted.
* NetworkProcess/NetworkSession.h:
* NetworkProcess/NetworkSessionCreationParameters.h: Added.
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
(WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::setSourceApplicationSecondaryIdentifier):
(WebKit::NetworkSessionCocoa::create):
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
(WebKit::NetworkSessionCocoa::setLegacyCustomProtocolManager): Deleted.
(WebKit::NetworkSessionCocoa::setAllowsCellularAccess): Deleted.
(WebKit::NetworkSessionCocoa::defaultSession): Deleted.
* NetworkProcess/mac/RemoteNetworkingContext.mm:
(WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
(WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
* Shared/SessionTracker.cpp:
(WebKit::SessionTracker::networkSession):
(WebKit::SessionTracker::setSession):
* Shared/WebsiteDataStoreParameters.cpp:
(WebKit::WebsiteDataStoreParameters::encode const):
(WebKit::WebsiteDataStoreParameters::decode):
* Shared/WebsiteDataStoreParameters.h:
* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _setBoundInterfaceIdentifier:]):
(-[WKWebsiteDataStore _boundInterfaceIdentifier]):
(-[WKWebsiteDataStore _setAllowsCellularAccess:]):
(-[WKWebsiteDataStore _allowsCellularAccess]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration allowsCellularAccess]):
(-[_WKProcessPoolConfiguration setAllowsCellularAccess:]):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureNetworkProcess):
(WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::setBoundInterfaceIdentifier):
(WebKit::WebsiteDataStore::boundInterfaceIdentifier):
(WebKit::WebsiteDataStore::setAllowsCellularAccess):
(WebKit::WebsiteDataStore::allowsCellularAccess):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setPrivateBrowsingEnabled):
* WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
* WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
(WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
(WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::ensurePrivateBrowsingSession):
(WebKit::WebProcess::clearCachedCredentials):

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

39 files changed:
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
Source/WebKit/NetworkProcess/NetworkSession.cpp
Source/WebKit/NetworkProcess/NetworkSession.h
Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h [new file with mode: 0644]
Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h
Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
Source/WebKit/NetworkProcess/mac/RemoteNetworkingContext.mm
Source/WebKit/NetworkProcess/soup/NetworkSessionSoup.cpp
Source/WebKit/NetworkProcess/soup/NetworkSessionSoup.h
Source/WebKit/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp
Source/WebKit/Shared/SessionTracker.cpp
Source/WebKit/Shared/WebsiteDataStoreParameters.cpp
Source/WebKit/Shared/WebsiteDataStoreParameters.h
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h
Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h
Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h
Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h
Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm
Source/WebKit/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
Source/WebKit/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h
Source/WebKit/WebProcess/WebProcess.cpp

index e9f7ca2..5602a02 100644 (file)
@@ -1,3 +1,13 @@
+2017-10-20  Alex Christensen  <achristensen@webkit.org>
+
+        Expose _boundInterfaceIdentifier and _allowsCellularAccess to WKWebsiteDataStorePrivate
+        https://bugs.webkit.org/show_bug.cgi?id=178418
+        <rdar://problem/29599569>
+
+        Reviewed by Tim Horton.
+
+        * pal/spi/cf/CFNetworkSPI.h:
+
 2017-10-20  Antoine Quint  <graouts@apple.com>
 
         [Web Animations] Provide basic timeline and animation interfaces
index 021f784..df39b8b 100644 (file)
@@ -101,6 +101,7 @@ typedef void (^CFCachedURLResponseCallBackBlock)(CFCachedURLResponseRef);
 
 @interface NSMutableURLRequest ()
 - (void)setContentDispositionEncodingFallbackArray:(NSArray *)theEncodingFallbackArray;
+- (void)setBoundInterfaceIdentifier:(NSString *)identifier;
 @end
 
 @interface NSURLResponse ()
index 1f4034c..3ff03af 100644 (file)
@@ -1,5 +1,101 @@
 2017-10-20  Alex Christensen  <achristensen@webkit.org>
 
+        Expose _boundInterfaceIdentifier and _allowsCellularAccess to WKWebsiteDataStorePrivate
+        https://bugs.webkit.org/show_bug.cgi?id=178418
+        <rdar://problem/29599569>
+
+        Reviewed by Tim Horton.
+        
+        In r213747 I introduced allowsCellularAccess to _WKProcessPoolConfiguration because there
+        was no way to add parameters to the default (and other) NetworkSession constructors.  Since
+        clients have not adopted this SPI, we can introduce such a way in NetworkSessionCreationParameters
+        and move the SPI to WKWebsiteDataStore, which is where it and other NetworkSession properties
+        ought to be instead of making them WKProcessPool global.
+
+        We also need to expose access to NSURLRequest.boundInterfaceIdentifier.  Instead of serializing and
+        deserializing that property for each NSURLRequest and then having subresources mysteriously jump back
+        to having no bound interface identifiers, I'm adding this to WKWebsiteDataStore, too, to make it a
+        session networking property.
+        
+        I manually verified that these properties are being set properly with a custom test app and added logs.
+        Unfortunately, these properties don't do anything under circumstances anywhere close to what we test.
+        The architecture change of having NetworkSessionCreationParameters is verified to not have a change in
+        behavior by existing tests, such as any test that uses TestProtocol (which we should eventually remove).
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::NetworkProcess):
+        (WebKit::NetworkProcess::initializeNetworkProcess):
+        (WebKit::NetworkProcess::clearCachedCredentials):
+        * NetworkProcess/NetworkProcessCreationParameters.cpp:
+        (WebKit::NetworkProcessCreationParameters::encode const):
+        (WebKit::NetworkProcessCreationParameters::decode):
+        * NetworkProcess/NetworkProcessCreationParameters.h:
+        * NetworkProcess/NetworkSession.cpp:
+        (WebKit::NetworkSession::create):
+        (WebKit::NetworkSession::defaultSession): Deleted.
+        * NetworkProcess/NetworkSession.h:
+        * NetworkProcess/NetworkSessionCreationParameters.h: Added.
+        (WebKit::NetworkSessionCreationParameters::encode const):
+        (WebKit::NetworkSessionCreationParameters::decode):
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
+        (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+        (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
+        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+        (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
+        * NetworkProcess/cocoa/NetworkSessionCocoa.h:
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (WebKit::NetworkSessionCocoa::setSourceApplicationSecondaryIdentifier):
+        (WebKit::NetworkSessionCocoa::create):
+        (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
+        (WebKit::NetworkSessionCocoa::setLegacyCustomProtocolManager): Deleted.
+        (WebKit::NetworkSessionCocoa::setAllowsCellularAccess): Deleted.
+        (WebKit::NetworkSessionCocoa::defaultSession): Deleted.
+        * NetworkProcess/mac/RemoteNetworkingContext.mm:
+        (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
+        (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
+        * Shared/SessionTracker.cpp:
+        (WebKit::SessionTracker::networkSession):
+        (WebKit::SessionTracker::setSession):
+        * Shared/WebsiteDataStoreParameters.cpp:
+        (WebKit::WebsiteDataStoreParameters::encode const):
+        (WebKit::WebsiteDataStoreParameters::decode):
+        * Shared/WebsiteDataStoreParameters.h:
+        * UIProcess/API/APIProcessPoolConfiguration.cpp:
+        (API::ProcessPoolConfiguration::copy):
+        * UIProcess/API/APIProcessPoolConfiguration.h:
+        * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+        (-[WKWebsiteDataStore _setBoundInterfaceIdentifier:]):
+        (-[WKWebsiteDataStore _boundInterfaceIdentifier]):
+        (-[WKWebsiteDataStore _setAllowsCellularAccess:]):
+        (-[WKWebsiteDataStore _allowsCellularAccess]):
+        * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
+        * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
+        (-[_WKProcessPoolConfiguration allowsCellularAccess]):
+        (-[_WKProcessPoolConfiguration setAllowsCellularAccess:]):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::ensureNetworkProcess):
+        (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        (WebKit::WebsiteDataStore::setBoundInterfaceIdentifier):
+        (WebKit::WebsiteDataStore::boundInterfaceIdentifier):
+        (WebKit::WebsiteDataStore::setAllowsCellularAccess):
+        (WebKit::WebsiteDataStore::allowsCellularAccess):
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
+        * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
+        * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
+        (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
+        (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::ensurePrivateBrowsingSession):
+        (WebKit::WebProcess::clearCachedCredentials):
+
+2017-10-20  Alex Christensen  <achristensen@webkit.org>
+
         Add ObjC SPI to _WKDownloadDelegate missing from WKContextDownloadClient
         https://bugs.webkit.org/show_bug.cgi?id=178566
         <rdar://problem/23041906>
index db4e9e9..46f4e41 100644 (file)
@@ -468,7 +468,7 @@ void NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled(boo
 
 void NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession()
 {
-    NetworkProcess::singleton().ensurePrivateBrowsingSession({PAL::SessionID::legacyPrivateSessionID(), { }, { }, { }, { }, WebsiteDataStore::defaultCacheStoragePerOriginQuota, { }});
+    NetworkProcess::singleton().ensurePrivateBrowsingSession({ { }, { }, { }, { }, WebsiteDataStore::defaultCacheStoragePerOriginQuota, { }, { PAL::SessionID::legacyPrivateSessionID(), { }, { }, AllowsCellularAccess::Yes }});
 }
 
 } // namespace WebKit
index 8d54bc9..2fd8eff 100644 (file)
@@ -115,9 +115,6 @@ NetworkProcess::NetworkProcess()
     addSupplement<AuthenticationManager>();
     addSupplement<WebCookieManager>();
     addSupplement<LegacyCustomProtocolManager>();
-#if USE(NETWORK_SESSION) && PLATFORM(COCOA)
-    NetworkSessionCocoa::setLegacyCustomProtocolManager(supplement<LegacyCustomProtocolManager>());
-#endif
 }
 
 NetworkProcess::~NetworkProcess()
@@ -241,11 +238,16 @@ void NetworkProcess::initializeNetworkProcess(NetworkProcessCreationParameters&&
 
     // FIXME: instead of handling this here, a message should be sent later (scales to multiple sessions)
     if (parameters.privateBrowsingEnabled)
-        RemoteNetworkingContext::ensurePrivateBrowsingSession({PAL::SessionID::legacyPrivateSessionID(), { }, { }, { }, { }, WebsiteDataStore::defaultCacheStoragePerOriginQuota, { }});
+        RemoteNetworkingContext::ensurePrivateBrowsingSession({ { }, { }, { }, { }, WebsiteDataStore::defaultCacheStoragePerOriginQuota, { }, { PAL::SessionID::legacyPrivateSessionID(), { }, { },  AllowsCellularAccess::Yes }});
 
     if (parameters.shouldUseTestingNetworkSession)
         NetworkStorageSession::switchToNewTestingSession();
 
+#if USE(NETWORK_SESSION)
+    parameters.defaultSessionParameters.legacyCustomProtocolManager = supplement<LegacyCustomProtocolManager>();
+    SessionTracker::setSession(PAL::SessionID::defaultSessionID(), NetworkSession::create(WTFMove(parameters.defaultSessionParameters)));
+#endif
+
     for (auto& supplement : m_supplements.values())
         supplement->initialize(parameters);
 }
@@ -288,7 +290,10 @@ void NetworkProcess::clearCachedCredentials()
 {
     NetworkStorageSession::defaultStorageSession().credentialStorage().clearCredentials();
 #if USE(NETWORK_SESSION)
-    NetworkSession::defaultSession().clearCredentials();
+    if (auto* networkSession = SessionTracker::networkSession(PAL::SessionID::defaultSessionID()))
+        networkSession->clearCredentials();
+    else
+        ASSERT_NOT_REACHED();
 #endif
 }
 
index cfe835e..2934a58 100644 (file)
@@ -41,6 +41,7 @@ NetworkProcessCreationParameters::NetworkProcessCreationParameters()
 
 void NetworkProcessCreationParameters::encode(IPC::Encoder& encoder) const
 {
+    encoder << defaultSessionParameters;
     encoder << privateBrowsingEnabled;
     encoder.encodeEnum(cacheModel);
     encoder << diskCacheSizeOverride;
@@ -75,7 +76,6 @@ void NetworkProcessCreationParameters::encode(IPC::Encoder& encoder) const
     encoder << nsURLCacheDiskCapacity;
     encoder << sourceApplicationBundleIdentifier;
     encoder << sourceApplicationSecondaryIdentifier;
-    encoder << allowsCellularAccess;
 #if PLATFORM(IOS)
     encoder << ctDataConnectionServiceType;
 #endif
@@ -105,6 +105,12 @@ void NetworkProcessCreationParameters::encode(IPC::Encoder& encoder) const
 
 bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProcessCreationParameters& result)
 {
+    std::optional<NetworkSessionCreationParameters> defaultSessionParameters;
+    decoder >> defaultSessionParameters;
+    if (!defaultSessionParameters)
+        return false;
+    result.defaultSessionParameters = WTFMove(*defaultSessionParameters);
+
     if (!decoder.decode(result.privateBrowsingEnabled))
         return false;
     if (!decoder.decodeEnum(result.cacheModel))
@@ -166,8 +172,6 @@ bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProc
         return false;
     if (!decoder.decode(result.sourceApplicationSecondaryIdentifier))
         return false;
-    if (!decoder.decode(result.allowsCellularAccess))
-        return false;
 #if PLATFORM(IOS)
     if (!decoder.decode(result.ctDataConnectionServiceType))
         return false;
index 029171b..c692313 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "Attachment.h"
 #include "CacheModel.h"
+#include "NetworkSessionCreationParameters.h"
 #include "SandboxExtension.h"
 #include <wtf/ProcessID.h>
 #include <wtf/Vector.h>
@@ -50,6 +51,7 @@ struct NetworkProcessCreationParameters {
     void encode(IPC::Encoder&) const;
     static bool decode(IPC::Decoder&, NetworkProcessCreationParameters&);
 
+    NetworkSessionCreationParameters defaultSessionParameters;
     bool privateBrowsingEnabled { false };
     CacheModel cacheModel { CacheModelDocumentViewer };
     int64_t diskCacheSizeOverride { -1 };
@@ -87,7 +89,6 @@ struct NetworkProcessCreationParameters {
     uint64_t nsURLCacheDiskCapacity;
     String sourceApplicationBundleIdentifier;
     String sourceApplicationSecondaryIdentifier;
-    bool allowsCellularAccess { true };
 #if PLATFORM(IOS)
     String ctDataConnectionServiceType;
 #endif
index 8e06112..caad22f 100644 (file)
@@ -45,25 +45,13 @@ using namespace WebCore;
 
 namespace WebKit {
 
-Ref<NetworkSession> NetworkSession::create(PAL::SessionID sessionID, LegacyCustomProtocolManager* customProtocolManager)
+Ref<NetworkSession> NetworkSession::create(NetworkSessionCreationParameters&& parameters)
 {
 #if PLATFORM(COCOA)
-    return NetworkSessionCocoa::create(sessionID, customProtocolManager);
+    return NetworkSessionCocoa::create(WTFMove(parameters));
 #endif
 #if USE(SOUP)
-    UNUSED_PARAM(customProtocolManager);
-    return NetworkSessionSoup::create(sessionID);
-#endif
-}
-
-NetworkSession& NetworkSession::defaultSession()
-{
-#if PLATFORM(COCOA)
-    return NetworkSessionCocoa::defaultSession();
-#else
-    ASSERT(RunLoop::isMain());
-    static NetworkSession* session = &NetworkSession::create(PAL::SessionID::defaultSessionID()).leakRef();
-    return *session;
+    return NetworkSessionSoup::create(WTFMove(parameters));
 #endif
 }
 
index 688d9ca..4f2af6b 100644 (file)
@@ -39,13 +39,12 @@ class NetworkStorageSession;
 
 namespace WebKit {
 
-class LegacyCustomProtocolManager;
 class NetworkDataTask;
+struct NetworkSessionCreationParameters;
 
 class NetworkSession : public RefCounted<NetworkSession> {
 public:
-    static Ref<NetworkSession> create(PAL::SessionID, LegacyCustomProtocolManager* = nullptr);
-    static NetworkSession& defaultSession();
+    static Ref<NetworkSession> create(NetworkSessionCreationParameters&&);
     virtual ~NetworkSession();
 
     virtual void invalidateAndCancel();
diff --git a/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h b/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h
new file mode 100644 (file)
index 0000000..a7e4567
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 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
+ * 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.
+ */
+
+#pragma once
+
+#include "ArgumentCoders.h"
+#include <pal/SessionID.h>
+#include <wtf/EnumTraits.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+class LegacyCustomProtocolManager;
+
+enum class AllowsCellularAccess { No, Yes };
+    
+struct NetworkSessionCreationParameters {
+    void encode(IPC::Encoder&) const;
+    static std::optional<NetworkSessionCreationParameters> decode(IPC::Decoder&);
+    
+    PAL::SessionID sessionID { PAL::SessionID::defaultSessionID() };
+    LegacyCustomProtocolManager* legacyCustomProtocolManager { nullptr };
+    String boundInterfaceIdentifier;
+    AllowsCellularAccess allowsCellularAccess { AllowsCellularAccess::Yes };
+};
+
+inline void NetworkSessionCreationParameters::encode(IPC::Encoder& encoder) const
+{
+    encoder << sessionID;
+    encoder << boundInterfaceIdentifier;
+    encoder << allowsCellularAccess;
+}
+
+inline std::optional<NetworkSessionCreationParameters> NetworkSessionCreationParameters::decode(IPC::Decoder& decoder)
+{
+    PAL::SessionID sessionID;
+    if (!decoder.decode(sessionID))
+        return std::nullopt;
+
+    std::optional<String> boundInterfaceIdentifier;
+    decoder >> boundInterfaceIdentifier;
+    if (!boundInterfaceIdentifier)
+        return std::nullopt;
+
+    std::optional<AllowsCellularAccess> allowsCellularAccess;
+    decoder >> allowsCellularAccess;
+    if (!allowsCellularAccess)
+        return std::nullopt;
+
+    return {{ sessionID, nullptr, WTFMove(*boundInterfaceIdentifier), WTFMove(*allowsCellularAccess) }};
+}
+
+} // namespace WebKit
+
+namespace WTF {
+template<> struct EnumTraits<WebKit::AllowsCellularAccess> {
+    using values = EnumValues<
+        WebKit::AllowsCellularAccess,
+        WebKit::AllowsCellularAccess::No,
+        WebKit::AllowsCellularAccess::Yes
+    >;
+};
+}
index b41686c..6913965 100644 (file)
@@ -32,6 +32,7 @@
 #include "NetworkCache.h"
 #include "NetworkLoad.h"
 #include "NetworkSession.h"
+#include "SessionTracker.h"
 #include <pal/SessionID.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/RunLoop.h>
@@ -57,7 +58,7 @@ SpeculativeLoad::SpeculativeLoad(Cache& cache, const GlobalFrameID& frameID, con
     parameters.contentSniffingPolicy = DoNotSniffContent;
     parameters.request = m_originalRequest;
 #if USE(NETWORK_SESSION)
-    m_networkLoad = std::make_unique<NetworkLoad>(*this, WTFMove(parameters), NetworkSession::defaultSession());
+    m_networkLoad = std::make_unique<NetworkLoad>(*this, WTFMove(parameters), *SessionTracker::networkSession(PAL::SessionID::defaultSessionID()));
 #else
     m_networkLoad = std::make_unique<NetworkLoad>(*this, WTFMove(parameters));
 #endif
index f77214b..df64e39 100644 (file)
@@ -116,6 +116,12 @@ NetworkDataTaskCocoa::NetworkDataTaskCocoa(NetworkSession& session, NetworkDataT
         m_storedCredentialsPolicy = WebCore::StoredCredentialsPolicy::DoNotUse;
     }
 
+    if (!cocoaSession.m_boundInterfaceIdentifier.isNull()) {
+        NSMutableURLRequest *mutableRequest = [[nsRequest mutableCopy] autorelease];
+        [mutableRequest setBoundInterfaceIdentifier:cocoaSession.m_boundInterfaceIdentifier];
+        nsRequest = mutableRequest;
+    }
+
     if (storedCredentialsPolicy == WebCore::StoredCredentialsPolicy::Use) {
         m_task = [cocoaSession.m_sessionWithCredentialStorage dataTaskWithRequest:nsRequest];
         ASSERT(!cocoaSession.m_dataTaskMapWithCredentials.contains([m_task taskIdentifier]));
index a3f2055..9dc1db6 100644 (file)
@@ -83,7 +83,6 @@ void NetworkProcess::platformInitializeNetworkProcessCocoa(const NetworkProcessC
     NetworkSessionCocoa::setSourceApplicationAuditTokenData(sourceApplicationAuditData());
     NetworkSessionCocoa::setSourceApplicationBundleIdentifier(parameters.sourceApplicationBundleIdentifier);
     NetworkSessionCocoa::setSourceApplicationSecondaryIdentifier(parameters.sourceApplicationSecondaryIdentifier);
-    NetworkSessionCocoa::setAllowsCellularAccess(parameters.allowsCellularAccess);
     NetworkSessionCocoa::setUsesNetworkCache(parameters.shouldEnableNetworkCache);
 #if PLATFORM(IOS)
     NetworkSessionCocoa::setCTDataConnectionServiceType(parameters.ctDataConnectionServiceType);
index 4dd31e0..df908f4 100644 (file)
@@ -41,19 +41,19 @@ OBJC_CLASS WKNetworkSessionDelegate;
 
 namespace WebKit {
 
+class LegacyCustomProtocolManager;
+
 class NetworkSessionCocoa final : public NetworkSession {
     friend class NetworkDataTaskCocoa;
 public:
-    static Ref<NetworkSession> create(PAL::SessionID, LegacyCustomProtocolManager*);
-    static NetworkSession& defaultSession();
+    static Ref<NetworkSession> create(NetworkSessionCreationParameters&&);
     ~NetworkSessionCocoa();
 
     // Must be called before any NetworkSession has been created.
-    static void setLegacyCustomProtocolManager(LegacyCustomProtocolManager*);
+    // FIXME: Move these to NetworkSessionCreationParameters.
     static void setSourceApplicationAuditTokenData(RetainPtr<CFDataRef>&&);
     static void setSourceApplicationBundleIdentifier(const String&);
     static void setSourceApplicationSecondaryIdentifier(const String&);
-    static void setAllowsCellularAccess(bool);
     static void setUsesNetworkCache(bool);
 #if PLATFORM(IOS)
     static void setCTDataConnectionServiceType(const String&);
@@ -69,7 +69,7 @@ public:
     static bool allowsSpecificHTTPSCertificateForHost(const WebCore::AuthenticationChallenge&);
 
 private:
-    NetworkSessionCocoa(PAL::SessionID, LegacyCustomProtocolManager*);
+    NetworkSessionCocoa(NetworkSessionCreationParameters&&);
 
     void invalidateAndCancel() override;
     void clearCredentials() override;
@@ -82,6 +82,8 @@ private:
     RetainPtr<WKNetworkSessionDelegate> m_sessionWithCredentialStorageDelegate;
     RetainPtr<NSURLSession> m_statelessSession;
     RetainPtr<WKNetworkSessionDelegate> m_statelessSessionDelegate;
+
+    String m_boundInterfaceIdentifier;
 };
 
 } // namespace WebKit
index 0d836c1..05c8684 100644 (file)
@@ -35,6 +35,7 @@
 #import "Logging.h"
 #import "NetworkLoad.h"
 #import "NetworkProcess.h"
+#import "NetworkSessionCreationParameters.h"
 #import "SessionTracker.h"
 #import <Foundation/NSURLSession.h>
 #import <WebCore/Credential.h>
@@ -483,9 +484,7 @@ static WebCore::NetworkLoadPriority toNetworkLoadPriority(float priority)
 
 namespace WebKit {
     
-static bool allowsCellularAccess { true };
 static bool usesNetworkCache { false };
-static LegacyCustomProtocolManager* legacyCustomProtocolManager;
 
 #if !ASSERT_DISABLED
 static bool sessionsCreated = false;
@@ -526,12 +525,6 @@ static String& globalCTDataConnectionServiceType()
     return ctDataConnectionServiceType.get();
 }
 #endif
-
-void NetworkSessionCocoa::setLegacyCustomProtocolManager(LegacyCustomProtocolManager* customProtocolManager)
-{
-    ASSERT(!sessionsCreated);
-    legacyCustomProtocolManager = customProtocolManager;
-}
     
 void NetworkSessionCocoa::setSourceApplicationAuditTokenData(RetainPtr<CFDataRef>&& data)
 {
@@ -550,11 +543,6 @@ void NetworkSessionCocoa::setSourceApplicationSecondaryIdentifier(const String&
     ASSERT(!sessionsCreated);
     globalSourceApplicationSecondaryIdentifier() = identifier;
 }
-    
-void NetworkSessionCocoa::setAllowsCellularAccess(bool value)
-{
-    allowsCellularAccess = value;
-}
 
 void NetworkSessionCocoa::setUsesNetworkCache(bool value)
 {
@@ -569,20 +557,14 @@ void NetworkSessionCocoa::setCTDataConnectionServiceType(const String& type)
 }
 #endif
 
-Ref<NetworkSession> NetworkSessionCocoa::create(PAL::SessionID sessionID, LegacyCustomProtocolManager* customProtocolManager)
+Ref<NetworkSession> NetworkSessionCocoa::create(NetworkSessionCreationParameters&& parameters)
 {
-    return adoptRef(*new NetworkSessionCocoa(sessionID, customProtocolManager));
-}
-
-NetworkSession& NetworkSessionCocoa::defaultSession()
-{
-    ASSERT(RunLoop::isMain());
-    static NetworkSession* session = &NetworkSessionCocoa::create(PAL::SessionID::defaultSessionID(), legacyCustomProtocolManager).leakRef();
-    return *session;
+    return adoptRef(*new NetworkSessionCocoa(WTFMove(parameters)));
 }
 
-NetworkSessionCocoa::NetworkSessionCocoa(PAL::SessionID sessionID, LegacyCustomProtocolManager* customProtocolManager)
-    : NetworkSession(sessionID)
+NetworkSessionCocoa::NetworkSessionCocoa(NetworkSessionCreationParameters&& parameters)
+    : NetworkSession(parameters.sessionID)
+    , m_boundInterfaceIdentifier(parameters.boundInterfaceIdentifier)
 {
     relaxAdoptionRequirement();
 
@@ -598,7 +580,7 @@ NetworkSessionCocoa::NetworkSessionCocoa(PAL::SessionID sessionID, LegacyCustomP
         configuration._suppressedAutoAddedHTTPHeaders = [NSSet setWithObject:@"Content-Type"];
 #endif
 
-    if (!allowsCellularAccess)
+    if (parameters.allowsCellularAccess == AllowsCellularAccess::No)
         configuration.allowsCellularAccess = NO;
 
     if (usesNetworkCache)
@@ -623,8 +605,8 @@ NetworkSessionCocoa::NetworkSessionCocoa(PAL::SessionID sessionID, LegacyCustomP
         configuration._CTDataConnectionServiceType = ctDataConnectionServiceType;
 #endif
 
-    if (customProtocolManager)
-        customProtocolManager->registerProtocolClass(configuration);
+    if (parameters.legacyCustomProtocolManager)
+        parameters.legacyCustomProtocolManager->registerProtocolClass(configuration);
     
 #if HAVE(TIMINGDATAOPTIONS)
     configuration._timingDataOptions = _TimingDataOptionsEnableW3CNavigationTiming;
@@ -632,7 +614,7 @@ NetworkSessionCocoa::NetworkSessionCocoa(PAL::SessionID sessionID, LegacyCustomP
     setCollectsTimingData();
 #endif
 
-    auto* storageSession = WebCore::NetworkStorageSession::storageSession(sessionID);
+    auto* storageSession = WebCore::NetworkStorageSession::storageSession(parameters.sessionID);
     RELEASE_ASSERT(storageSession);
     if (CFHTTPCookieStorageRef storage = storageSession->cookieStorage().get())
         configuration.HTTPCookieStorage = [[[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:storage] autorelease];
index 1d36fe5..4f59686 100644 (file)
@@ -30,6 +30,7 @@
 #import "LegacyCustomProtocolManager.h"
 #import "NetworkProcess.h"
 #import "NetworkSession.h"
+#import "NetworkSessionCreationParameters.h"
 #import "SessionTracker.h"
 #import "WebErrors.h"
 #import "WebsiteDataStoreParameters.h"
@@ -82,9 +83,10 @@ ResourceError RemoteNetworkingContext::blockedError(const ResourceRequest& reque
 
 void RemoteNetworkingContext::ensurePrivateBrowsingSession(WebsiteDataStoreParameters&& parameters)
 {
-    ASSERT(parameters.sessionID.isEphemeral());
+    auto sessionID = parameters.networkSessionParameters.sessionID;
+    ASSERT(sessionID.isEphemeral());
 
-    if (NetworkStorageSession::storageSession(parameters.sessionID))
+    if (NetworkStorageSession::storageSession(sessionID))
         return;
 
     String base;
@@ -93,21 +95,22 @@ void RemoteNetworkingContext::ensurePrivateBrowsingSession(WebsiteDataStoreParam
     else
         base = SessionTracker::getIdentifierBase();
 
-    NetworkStorageSession::ensurePrivateBrowsingSession(parameters.sessionID, base + '.' + String::number(parameters.sessionID.sessionID()));
+    NetworkStorageSession::ensurePrivateBrowsingSession(sessionID, base + '.' + String::number(sessionID.sessionID()));
 
-    auto* session = NetworkStorageSession::storageSession(parameters.sessionID);
+    auto* session = NetworkStorageSession::storageSession(sessionID);
     for (const auto& cookie : parameters.pendingCookies)
         session->setCookie(cookie);
 
 #if USE(NETWORK_SESSION)
-    auto networkSession = NetworkSession::create(parameters.sessionID, NetworkProcess::singleton().supplement<LegacyCustomProtocolManager>());
-    SessionTracker::setSession(parameters.sessionID, WTFMove(networkSession));
+    parameters.networkSessionParameters.legacyCustomProtocolManager = NetworkProcess::singleton().supplement<LegacyCustomProtocolManager>();
+    SessionTracker::setSession(sessionID, NetworkSession::create(WTFMove(parameters.networkSessionParameters)));
 #endif
 }
 
 void RemoteNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStoreParameters&& parameters)
 {
-    if (NetworkStorageSession::storageSession(parameters.sessionID))
+    auto sessionID = parameters.networkSessionParameters.sessionID;
+    if (NetworkStorageSession::storageSession(sessionID))
         return;
 
     String base;
@@ -122,9 +125,9 @@ void RemoteNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStorePara
     if (!parameters.uiProcessCookieStorageIdentifier.isEmpty())
         uiProcessCookieStorage = cookieStorageFromIdentifyingData(parameters.uiProcessCookieStorageIdentifier);
 
-    NetworkStorageSession::ensureSession(parameters.sessionID, base + '.' + String::number(parameters.sessionID.sessionID()), WTFMove(uiProcessCookieStorage));
+    NetworkStorageSession::ensureSession(sessionID, base + '.' + String::number(sessionID.sessionID()), WTFMove(uiProcessCookieStorage));
 
-    auto* session = NetworkStorageSession::storageSession(parameters.sessionID);
+    auto* session = NetworkStorageSession::storageSession(sessionID);
     for (const auto& cookie : parameters.pendingCookies)
         session->setCookie(cookie);
 
@@ -135,8 +138,8 @@ void RemoteNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStorePara
     }
 
 #if USE(NETWORK_SESSION)
-    auto networkSession = NetworkSession::create(parameters.sessionID, NetworkProcess::singleton().supplement<LegacyCustomProtocolManager>());
-    SessionTracker::setSession(parameters.sessionID, WTFMove(networkSession));
+    parameters.networkSessionParameters.legacyCustomProtocolManager = NetworkProcess::singleton().supplement<LegacyCustomProtocolManager>();
+    SessionTracker::setSession(sessionID, NetworkSession::create(WTFMove(parameters.networkSessionParameters)));
 #endif
 }
 
index dc69cc6..781299a 100644 (file)
@@ -27,6 +27,7 @@
 #include "NetworkSessionSoup.h"
 
 #include "NetworkProcess.h"
+#include "NetworkSessionCreationParameters.h"
 #include "WebCookieManager.h"
 #include <WebCore/NetworkStorageSession.h>
 #include <WebCore/SoupNetworkSession.h>
@@ -36,8 +37,8 @@ using namespace WebCore;
 
 namespace WebKit {
 
-NetworkSessionSoup::NetworkSessionSoup(PAL::SessionID sessionID)
-    : NetworkSession(sessionID)
+NetworkSessionSoup::NetworkSessionSoup(NetworkSessionCreationParameters&& parameters)
+    : NetworkSession(parameters.sessionID)
 {
     networkStorageSession().setCookieObserverHandler([this] {
         NetworkProcess::singleton().supplement<WebCookieManager>()->notifyCookiesDidChange(m_sessionID);
index f58cd81..4156345 100644 (file)
@@ -31,18 +31,20 @@ typedef struct _SoupSession SoupSession;
 
 namespace WebKit {
 
+struct NetworkSessionCreationParameters;
+
 class NetworkSessionSoup final : public NetworkSession {
 public:
-    static Ref<NetworkSession> create(PAL::SessionID sessionID)
+    static Ref<NetworkSession> create(NetworkSessionCreationParameters&& parameters)
     {
-        return adoptRef(*new NetworkSessionSoup(sessionID));
+        return adoptRef(*new NetworkSessionSoup(WTFMove(parameters)));
     }
     ~NetworkSessionSoup();
 
     SoupSession* soupSession() const;
 
 private:
-    NetworkSessionSoup(PAL::SessionID);
+    NetworkSessionSoup(NetworkSessionCreationParameters&&);
 
     void clearCredentials() override;
 };
index f76d6df..92ad77a 100644 (file)
@@ -50,13 +50,14 @@ bool RemoteNetworkingContext::isValid() const
 
 void RemoteNetworkingContext::ensurePrivateBrowsingSession(WebsiteDataStoreParameters&& parameters)
 {
-    ASSERT(parameters.sessionID.isEphemeral());
+    auto sessionID = parameters.networkSessionParameters.sessionID;
+    ASSERT(sessionID.isEphemeral());
 
-    if (NetworkStorageSession::storageSession(parameters.sessionID))
+    if (NetworkStorageSession::storageSession(sessionID))
         return;
 
-    NetworkStorageSession::ensurePrivateBrowsingSession(parameters.sessionID, String::number(parameters.sessionID.sessionID()));
-    SessionTracker::setSession(parameters.sessionID, NetworkSession::create(parameters.sessionID));
+    NetworkStorageSession::ensurePrivateBrowsingSession(sessionID, String::number(sessionID.sessionID()));
+    SessionTracker::setSession(sessionID, NetworkSession::create(WTFMove(parameters.networkSessionParameters)));
 }
 
 void RemoteNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStoreParameters&&)
index d738357..00daad1 100644 (file)
@@ -66,14 +66,11 @@ static HashMap<PAL::SessionID, RefPtr<NetworkSession>>& staticSessionMap()
 
 NetworkSession* SessionTracker::networkSession(PAL::SessionID sessionID)
 {
-    if (sessionID == PAL::SessionID::defaultSessionID())
-        return &NetworkSession::defaultSession();
     return staticSessionMap().get(sessionID);
 }
 
 void SessionTracker::setSession(PAL::SessionID sessionID, Ref<NetworkSession>&& session)
 {
-    ASSERT(sessionID != PAL::SessionID::defaultSessionID());
     staticSessionMap().set(sessionID, WTFMove(session));
 }
 #endif
index 4d9b33f..8bf1c8c 100644 (file)
@@ -36,7 +36,7 @@ WebsiteDataStoreParameters::~WebsiteDataStoreParameters()
 
 void WebsiteDataStoreParameters::encode(IPC::Encoder& encoder) const
 {
-    encoder << sessionID;
+    encoder << networkSessionParameters;
     encoder << uiProcessCookieStorageIdentifier;
     encoder << cookieStoragePathExtensionHandle;
     encoder << pendingCookies;
@@ -47,8 +47,11 @@ void WebsiteDataStoreParameters::encode(IPC::Encoder& encoder) const
 
 bool WebsiteDataStoreParameters::decode(IPC::Decoder& decoder, WebsiteDataStoreParameters& parameters)
 {
-    if (!decoder.decode(parameters.sessionID))
+    std::optional<NetworkSessionCreationParameters> networkSessionParameters;
+    decoder >> networkSessionParameters;
+    if (!networkSessionParameters)
         return false;
+    parameters.networkSessionParameters = WTFMove(*networkSessionParameters);
 
     if (!decoder.decode(parameters.uiProcessCookieStorageIdentifier))
         return false;
index b078e08..168c42d 100644 (file)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include "NetworkSessionCreationParameters.h"
 #include "SandboxExtension.h"
 #include <WebCore/Cookie.h>
 #include <pal/SessionID.h>
@@ -46,13 +47,13 @@ struct WebsiteDataStoreParameters {
     void encode(IPC::Encoder&) const;
     static bool decode(IPC::Decoder&, WebsiteDataStoreParameters&);
 
-    PAL::SessionID sessionID;
     Vector<uint8_t> uiProcessCookieStorageIdentifier;
     SandboxExtension::Handle cookieStoragePathExtensionHandle;
     Vector<WebCore::Cookie> pendingCookies;
     String cacheStorageDirectory;
     uint64_t cacheStoragePerOriginQuota { 0 };
     SandboxExtension::Handle cacheStorageDirectoryExtensionHandle;
+    NetworkSessionCreationParameters networkSessionParameters;
 };
 
 } // namespace WebKit
index 56dc889..f9d02c9 100644 (file)
@@ -117,7 +117,6 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::copy()
     copy->m_fullySynchronousModeIsAllowedForTesting = this->m_fullySynchronousModeIsAllowedForTesting;
     copy->m_ignoreSynchronousMessagingTimeoutsForTesting = this->m_ignoreSynchronousMessagingTimeoutsForTesting;
     copy->m_overrideLanguages = this->m_overrideLanguages;
-    copy->m_allowsCellularAccess = this->m_allowsCellularAccess;
     copy->m_sourceApplicationBundleIdentifier = this->m_sourceApplicationBundleIdentifier;
     copy->m_sourceApplicationSecondaryIdentifier = this->m_sourceApplicationSecondaryIdentifier;
     copy->m_alwaysRunsAtBackgroundPriority = this->m_alwaysRunsAtBackgroundPriority;
index 3f68ecc..196c2dd 100644 (file)
@@ -117,9 +117,6 @@ public:
 
     const WTF::String& sourceApplicationSecondaryIdentifier() const { return m_sourceApplicationSecondaryIdentifier; }
     void setSourceApplicationSecondaryIdentifier(const WTF::String& sourceApplicationSecondaryIdentifier) { m_sourceApplicationSecondaryIdentifier = sourceApplicationSecondaryIdentifier; }
-
-    bool allowsCellularAccess() const { return m_allowsCellularAccess; }
-    void setAllowsCellularAccess(bool allowsCellularAccess) { m_allowsCellularAccess = allowsCellularAccess; }
     
     bool alwaysRunsAtBackgroundPriority() const { return m_alwaysRunsAtBackgroundPriority; }
     void setAlwaysRunsAtBackgroundPriority(bool alwaysRunsAtBackgroundPriority) { m_alwaysRunsAtBackgroundPriority = alwaysRunsAtBackgroundPriority; }
@@ -165,7 +162,6 @@ private:
     Vector<WTF::String> m_overrideLanguages;
     WTF::String m_sourceApplicationBundleIdentifier;
     WTF::String m_sourceApplicationSecondaryIdentifier;
-    bool m_allowsCellularAccess { true };
     bool m_alwaysRunsAtBackgroundPriority { false };
     bool m_shouldTakeUIBackgroundAssertion { true };
     bool m_shouldCaptureAudioInUIProcess { false };
index adb5dbe..8154872 100644 (file)
@@ -251,6 +251,26 @@ static Vector<WebKit::WebsiteDataRecord> toWebsiteDataRecords(NSArray *dataRecor
     _websiteDataStore->websiteDataStore().setCacheStorageDirectory(directory);
 }
 
+- (void)_setBoundInterfaceIdentifier:(NSString *)identifier
+{
+    _websiteDataStore->websiteDataStore().setBoundInterfaceIdentifier(identifier);
+}
+
+- (NSString *)_boundInterfaceIdentifier
+{
+    return _websiteDataStore->websiteDataStore().boundInterfaceIdentifier();
+}
+
+- (void)_setAllowsCellularAccess:(BOOL)allows
+{
+    _websiteDataStore->websiteDataStore().setAllowsCellularAccess(allows ? WebKit::AllowsCellularAccess::Yes : WebKit::AllowsCellularAccess::No);
+}
+
+- (BOOL)_allowsCellularAccess
+{
+    return _websiteDataStore->websiteDataStore().allowsCellularAccess() == WebKit::AllowsCellularAccess::Yes;
+}
+
 - (void)_resourceLoadStatisticsSetLastSeen:(double)seconds forHost:(NSString *)host
 {
     auto* store = _websiteDataStore->websiteDataStore().resourceLoadStatistics();
index 7bf6c17..9323ca5 100644 (file)
@@ -48,6 +48,9 @@ typedef NS_OPTIONS(NSUInteger, _WKWebsiteDataStoreFetchOptions) {
 @property (nonatomic, setter=_setCacheStoragePerOriginQuota:) NSUInteger _cacheStoragePerOriginQuota WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_MAC_TBA));
 @property (nonatomic, setter=_setCacheStorageDirectory:) NSString* _cacheStorageDirectory WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_MAC_TBA));
 
+@property (nonatomic, setter=_setBoundInterfaceIdentifier:) NSString *_boundInterfaceIdentifier WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_MAC_TBA));
+@property (nonatomic, setter=_setAllowsCellularAccess:) BOOL _allowsCellularAccess WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_MAC_TBA));
+
 // ResourceLoadStatistics SPI for testing.
 - (void)_resourceLoadStatisticsSetLastSeen:(double)seconds forHost:(NSString *)host WK_API_AVAILABLE(macosx(10.13), ios(11.0));
 - (void)_resourceLoadStatisticsSetIsPrevalentResource:(BOOL)value forHost:(NSString *)host WK_API_AVAILABLE(macosx(10.13), ios(11.0));
index 2747d31..5163291 100644 (file)
@@ -49,7 +49,7 @@ WK_CLASS_AVAILABLE(macosx(10.10), ios(8.0))
 @property (nonatomic) BOOL diskCacheSpeculativeValidationEnabled WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 @property (nonatomic, nullable, copy) NSString *sourceApplicationBundleIdentifier WK_API_AVAILABLE(macosx(10.12.3), ios(10.3));
 @property (nonatomic, nullable, copy) NSString *sourceApplicationSecondaryIdentifier WK_API_AVAILABLE(macosx(10.12.3), ios(10.3));
-@property (nonatomic) BOOL allowsCellularAccess WK_API_AVAILABLE(macosx(10.13), ios(11.0));
+@property (nonatomic) BOOL allowsCellularAccess WK_API_DEPRECATED_WITH_REPLACEMENT("WKWebsiteDataStore._allowsCellularAccess", macosx(10.13, WK_MAC_TBA), ios(11.0, WK_IOS_TBA));
 @property (nonatomic) BOOL shouldCaptureAudioInUIProcess WK_API_AVAILABLE(macosx(10.13), ios(11.0));
 #if TARGET_OS_IPHONE
 @property (nonatomic, nullable, copy) NSString *CTDataConnectionServiceType WK_API_AVAILABLE(ios(10.3));
index 8fb4c73..53a08b5 100644 (file)
 
 - (BOOL)allowsCellularAccess
 {
-    return _processPoolConfiguration->allowsCellularAccess();
+    return YES;
 }
 
 - (void)setAllowsCellularAccess:(BOOL)allowsCellularAccess
 {
-    _processPoolConfiguration->setAllowsCellularAccess(allowsCellularAccess);
 }
 
 - (BOOL)shouldCaptureAudioInUIProcess
index 8b2ee8f..c6bdd9d 100644 (file)
@@ -424,6 +424,11 @@ NetworkProcessProxy& WebProcessPool::ensureNetworkProcess(WebsiteDataStore* with
 
     NetworkProcessCreationParameters parameters;
 
+    if (withWebsiteDataStore) {
+        auto websiteDataStoreParameters = withWebsiteDataStore->parameters();
+        parameters.defaultSessionParameters = websiteDataStoreParameters.networkSessionParameters;
+    }
+    
     parameters.privateBrowsingEnabled = WebPreferences::anyPagesAreUsingPrivateBrowsing();
 
     parameters.cacheModel = cacheModel();
@@ -460,8 +465,6 @@ NetworkProcessProxy& WebProcessPool::ensureNetworkProcess(WebsiteDataStore* with
     String parentBundleDirectory = this->parentBundleDirectory();
     if (!parentBundleDirectory.isEmpty())
         SandboxExtension::createHandle(parentBundleDirectory, SandboxExtension::Type::ReadOnly, parameters.parentBundleDirectoryExtensionHandle);
-
-    parameters.allowsCellularAccess = m_configuration->allowsCellularAccess();
 #endif
 
 #if OS(LINUX)
@@ -623,7 +626,7 @@ void WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled(bool private
 {
     if (networkProcess()) {
         if (privateBrowsingEnabled)
-            networkProcess()->send(Messages::NetworkProcess::EnsurePrivateBrowsingSession({PAL::SessionID::legacyPrivateSessionID(), { }, { }, { }, { }, WebsiteDataStore::defaultCacheStoragePerOriginQuota, { }}), 0);
+            networkProcess()->send(Messages::NetworkProcess::EnsurePrivateBrowsingSession({ { }, { }, { }, { }, WebsiteDataStore::defaultCacheStoragePerOriginQuota, { }, { PAL::SessionID::legacyPrivateSessionID(), { }, { }, AllowsCellularAccess::Yes }}), 0);
         else
             networkProcess()->send(Messages::NetworkProcess::DestroySession(PAL::SessionID::legacyPrivateSessionID()), 0);
     }
@@ -679,7 +682,7 @@ void WebProcessPool::resolvePathsForSandboxExtensions()
 
 WebProcessProxy& WebProcessPool::createNewWebProcess(WebsiteDataStore& websiteDataStore)
 {
-    ensureNetworkProcess();
+    ensureNetworkProcess(&websiteDataStore);
 
     Ref<WebProcessProxy> process = WebProcessProxy::create(*this, websiteDataStore);
 
@@ -1000,7 +1003,7 @@ void WebProcessPool::pageAddedToProcess(WebPageProxy& page)
     if (sessionID.isEphemeral()) {
         // FIXME: Merge NetworkProcess::EnsurePrivateBrowsingSession and NetworkProcess::AddWebsiteDataStore into one message type.
         // They do basically the same thing.
-        ASSERT(page.websiteDataStore().parameters().sessionID == sessionID);
+        ASSERT(page.websiteDataStore().parameters().networkSessionParameters.sessionID == sessionID);
         sendToNetworkingProcess(Messages::NetworkProcess::EnsurePrivateBrowsingSession(page.websiteDataStore().parameters()));
         page.process().send(Messages::WebProcess::EnsurePrivateBrowsingSession(sessionID), 0);
     } else if (sessionID != PAL::SessionID::defaultSessionID()) {
index 93560ae..8d65bbe 100644 (file)
@@ -55,7 +55,7 @@ WebsiteDataStoreParameters WebsiteDataStore::parameters()
     resolveDirectoriesIfNecessary();
 
     WebsiteDataStoreParameters parameters;
-    parameters.sessionID = m_sessionID;
+    parameters.networkSessionParameters = { m_sessionID, nullptr, m_boundInterfaceIdentifier, m_allowsCellularAccess };
 
     auto cookieFile = resolvedCookieStorageFile();
 
index c98001b..97d2bac 100644 (file)
@@ -1401,7 +1401,7 @@ WebsiteDataStoreParameters WebsiteDataStore::parameters()
 {
     // FIXME: Implement cookies.
     WebsiteDataStoreParameters parameters;
-    parameters.sessionID = m_sessionID;
+    parameters.networkSessionParameters.sessionID = m_sessionID;
     return parameters;
 }
 #endif
index 7fe349a..dd0ec92 100644 (file)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include "NetworkSessionCreationParameters.h"
 #include "WebProcessLifetimeObserver.h"
 #include <WebCore/Cookie.h>
 #include <WebCore/SecurityOriginData.h>
@@ -141,6 +142,12 @@ public:
     void enableResourceLoadStatisticsAndSetTestingCallback(Function<void (const String&)>&& callback);
 
     void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, WTF::Function<void (bool)>&& callback);
+    
+    void setBoundInterfaceIdentifier(String&& identifier) { m_boundInterfaceIdentifier = WTFMove(identifier); }
+    const String& boundInterfaceIdentifier() { return m_boundInterfaceIdentifier; }
+    
+    void setAllowsCellularAccess(AllowsCellularAccess allows) { m_allowsCellularAccess = allows; }
+    AllowsCellularAccess allowsCellularAccess() { return m_allowsCellularAccess; }
 
 private:
     explicit WebsiteDataStore(PAL::SessionID);
@@ -186,6 +193,9 @@ private:
     RetainPtr<CFHTTPCookieStorageRef> m_cfCookieStorage;
 #endif
     HashSet<WebCore::Cookie> m_pendingCookies;
+    
+    String m_boundInterfaceIdentifier;
+    AllowsCellularAccess m_allowsCellularAccess { AllowsCellularAccess::Yes };
 };
 
 }
index deb418b..594b433 100644 (file)
                5C6CE6D31F59EA350007C6CB /* PageClientImplCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageClientImplCocoa.h; sourceTree = "<group>"; };
                5C7706731D111D8B0012700F /* WebSocketProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebSocketProvider.cpp; path = Network/WebSocketProvider.cpp; sourceTree = "<group>"; };
                5C7C88DC1D0F41A0009D2F6D /* WebSocketProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebSocketProvider.h; path = Network/WebSocketProvider.h; sourceTree = "<group>"; };
+               5C84CF901F96AC4E00B6705A /* NetworkSessionCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkSessionCreationParameters.h; path = NetworkProcess/NetworkSessionCreationParameters.h; sourceTree = "<group>"; };
                5C85C7861C3F23C50061A4FA /* PendingDownload.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PendingDownload.cpp; path = NetworkProcess/Downloads/PendingDownload.cpp; sourceTree = "<group>"; };
                5C9E567F1DF7930900C9EE33 /* WebsitePolicies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsitePolicies.h; sourceTree = "<group>"; };
                5C9E56801DF7F05500C9EE33 /* WKWebsitePolicies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKWebsitePolicies.cpp; sourceTree = "<group>"; };
                                5C1426E61C23F80500D41183 /* NetworkResourceLoadParameters.h */,
                                532159521DBAE6FC0054AA3C /* NetworkSession.cpp */,
                                5C20CB9E1BB0DD1800895BB1 /* NetworkSession.h */,
+                               5C84CF901F96AC4E00B6705A /* NetworkSessionCreationParameters.h */,
                                5C0B177D1E7C886700E9123C /* NetworkSocketStream.cpp */,
                                5C0B177E1E7C886700E9123C /* NetworkSocketStream.h */,
                                5C0B177F1E7C886700E9123C /* NetworkSocketStream.messages.in */,
index 8b171b0..52e8d55 100644 (file)
@@ -29,6 +29,7 @@
 #include "APIArray.h"
 #include "APIData.h"
 #include "InjectedBundleScriptWorld.h"
+#include "NetworkSessionCreationParameters.h"
 #include "NotificationPermissionRequestManager.h"
 #include "SessionTracker.h"
 #include "UserData.h"
@@ -46,6 +47,7 @@
 #include "WebProcessMessages.h"
 #include "WebProcessPoolMessages.h"
 #include "WebUserContentController.h"
+#include "WebsiteDataStoreParameters.h"
 #include <JavaScriptCore/APICast.h>
 #include <JavaScriptCore/Exception.h>
 #include <JavaScriptCore/JSLock.h>
@@ -319,7 +321,7 @@ void InjectedBundle::setPrivateBrowsingEnabled(WebPageGroupProxy* pageGroup, boo
 {
     if (enabled) {
         WebProcess::singleton().ensureLegacyPrivateBrowsingSessionInNetworkProcess();
-        WebFrameNetworkingContext::ensurePrivateBrowsingSession(PAL::SessionID::legacyPrivateSessionID());
+        WebFrameNetworkingContext::ensurePrivateBrowsingSession({ { }, { }, { }, { }, { }, { }, { PAL::SessionID::legacyPrivateSessionID(), { }, { }, AllowsCellularAccess::Yes }});
     } else
         SessionTracker::destroySession(PAL::SessionID::legacyPrivateSessionID());
 
index 5eb2b26..fbad552 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebFrameNetworkingContext_h
-#define WebFrameNetworkingContext_h
+#pragma once
 
 #include "HTTPCookieAcceptPolicy.h"
 #include "WebFrame.h"
@@ -43,7 +42,7 @@ public:
     }
 
     // FIXME: remove platform-specific code and use SessionTracker
-    static void ensurePrivateBrowsingSession(PAL::SessionID);
+    static void ensurePrivateBrowsingSession(WebsiteDataStoreParameters&&);
     static void ensureWebsiteDataStoreSession(WebsiteDataStoreParameters&&);
 
     static void setCookieAcceptPolicyForAllContexts(HTTPCookieAcceptPolicy);
@@ -65,5 +64,3 @@ private:
 };
 
 }
-
-#endif
index c46883d..467a132 100644 (file)
@@ -46,8 +46,9 @@ using namespace WebCore;
 
 namespace WebKit {
     
-void WebFrameNetworkingContext::ensurePrivateBrowsingSession(PAL::SessionID sessionID)
+void WebFrameNetworkingContext::ensurePrivateBrowsingSession(WebsiteDataStoreParameters&& parameters)
 {
+    auto sessionID = parameters.networkSessionParameters.sessionID;
     ASSERT(sessionID.isEphemeral());
 
     if (WebCore::NetworkStorageSession::storageSession(sessionID))
@@ -61,14 +62,14 @@ void WebFrameNetworkingContext::ensurePrivateBrowsingSession(PAL::SessionID sess
 
     NetworkStorageSession::ensurePrivateBrowsingSession(sessionID, base + '.' + String::number(sessionID.sessionID()));
 #if USE(NETWORK_SESSION)
-    auto networkSession = NetworkSession::create(sessionID);
-    SessionTracker::setSession(sessionID, WTFMove(networkSession));
+    SessionTracker::setSession(sessionID, NetworkSession::create(WTFMove(parameters.networkSessionParameters)));
 #endif
 }
 
 void WebFrameNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStoreParameters&& parameters)
 {
-    if (NetworkStorageSession::storageSession(parameters.sessionID))
+    auto sessionID = parameters.networkSessionParameters.sessionID;
+    if (NetworkStorageSession::storageSession(sessionID))
         return;
 
     String base;
@@ -81,11 +82,10 @@ void WebFrameNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStorePa
 
     RetainPtr<CFHTTPCookieStorageRef> uiProcessCookieStorage = cookieStorageFromIdentifyingData(parameters.uiProcessCookieStorageIdentifier);
 
-    NetworkStorageSession::ensureSession(parameters.sessionID, base + '.' + String::number(parameters.sessionID.sessionID()), WTFMove(uiProcessCookieStorage));
+    NetworkStorageSession::ensureSession(sessionID, base + '.' + String::number(sessionID.sessionID()), WTFMove(uiProcessCookieStorage));
 
 #if USE(NETWORK_SESSION)
-    auto networkSession = NetworkSession::create(parameters.sessionID);
-    SessionTracker::setSession(parameters.sessionID, WTFMove(networkSession));
+    SessionTracker::setSession(sessionID, NetworkSession::create(WTFMove(parameters.networkSessionParameters)));
 #endif
 }
 
index 876baea..735e947 100644 (file)
 #include "WebFrameNetworkingContext.h"
 
 #include "NetworkSession.h"
+#include "NetworkSessionCreationParameters.h"
 #include "SessionTracker.h"
 #include "WebFrame.h"
 #include "WebPage.h"
+#include "WebsiteDataStoreParameters.h"
 #include <WebCore/FrameLoader.h>
 #include <WebCore/NetworkStorageSession.h>
 #include <WebCore/Settings.h>
@@ -41,8 +43,9 @@ using namespace WebCore;
 
 namespace WebKit {
 
-void WebFrameNetworkingContext::ensurePrivateBrowsingSession(PAL::SessionID sessionID)
+void WebFrameNetworkingContext::ensurePrivateBrowsingSession(WebsiteDataStoreParameters&& parameters)
 {
+    auto sessionID = parameters.networkSessionParameters.sessionID;
     ASSERT(RunLoop::isMain());
     ASSERT(sessionID.isEphemeral());
 
@@ -50,7 +53,7 @@ void WebFrameNetworkingContext::ensurePrivateBrowsingSession(PAL::SessionID sess
         return;
 
     NetworkStorageSession::ensurePrivateBrowsingSession(sessionID, String::number(sessionID.sessionID()));
-    SessionTracker::setSession(sessionID, NetworkSession::create(sessionID));
+    SessionTracker::setSession(sessionID, NetworkSession::create(WTFMove(parameters.networkSessionParameters)));
 }
 
 void WebFrameNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStoreParameters&&)
index c1a348c..9286de6 100644 (file)
@@ -43,7 +43,7 @@ public:
         return adoptRef(*new WebFrameNetworkingContext(frame));
     }
 
-    static void ensurePrivateBrowsingSession(PAL::SessionID);
+    static void ensurePrivateBrowsingSession(WebsiteDataStoreParameters&&);
     static void ensureWebsiteDataStoreSession(WebsiteDataStoreParameters&&);
 
     WebFrameLoaderClient* webFrameLoaderClient() const;
index 5c85c6e..1def71c 100644 (file)
@@ -39,6 +39,7 @@
 #include "NetworkConnectionToWebProcessMessages.h"
 #include "NetworkProcessConnection.h"
 #include "NetworkSession.h"
+#include "NetworkSessionCreationParameters.h"
 #include "PluginProcessConnectionManager.h"
 #include "ServiceWorkerContextManager.h"
 #include "ServiceWorkerContextManagerMessages.h"
@@ -71,6 +72,7 @@
 #include "WebSocketStream.h"
 #include "WebToStorageProcessConnection.h"
 #include "WebsiteData.h"
+#include "WebsiteDataStoreParameters.h"
 #include "WebsiteDataType.h"
 #include <JavaScriptCore/JSLock.h>
 #include <JavaScriptCore/MemoryStatistics.h>
@@ -265,6 +267,10 @@ void WebProcess::initializeWebProcess(WebProcessCreationParameters&& parameters)
 
     platformInitializeWebProcess(WTFMove(parameters));
 
+#if USE(NETWORK_SESSION)
+    SessionTracker::setSession(PAL::SessionID::defaultSessionID(), NetworkSession::create({ }));
+#endif
+
     // Match the QoS of the UIProcess and the scrolling thread but use a slightly lower priority.
     WTF::Thread::setCurrentThreadIsUserInteractive(-1);
 
@@ -511,7 +517,7 @@ void WebProcess::fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled)
 
 void WebProcess::ensurePrivateBrowsingSession(PAL::SessionID sessionID)
 {
-    WebFrameNetworkingContext::ensurePrivateBrowsingSession(sessionID);
+    WebFrameNetworkingContext::ensurePrivateBrowsingSession({ { }, { }, { }, { }, { }, { }, { sessionID, { }, { }, AllowsCellularAccess::Yes }});
 }
 
 void WebProcess::addWebsiteDataStore(WebsiteDataStoreParameters&& parameters)
@@ -565,7 +571,10 @@ void WebProcess::clearCachedCredentials()
 {
     NetworkStorageSession::defaultStorageSession().credentialStorage().clearCredentials();
 #if USE(NETWORK_SESSION)
-    NetworkSession::defaultSession().clearCredentials();
+    if (auto* networkSession = SessionTracker::networkSession(PAL::SessionID::defaultSessionID()))
+        networkSession->clearCredentials();
+    else
+        ASSERT_NOT_REACHED();
 #endif
 }