Title: [288528] branches/safari-613-branch/Source
Revision
288528
Author
[email protected]
Date
2022-01-24 17:56:50 -0800 (Mon, 24 Jan 2022)

Log Message

Cherry-pick r288389. rdar://problem/85405320

    Disable CFURLCache in WebKit2
    https://bugs.webkit.org/show_bug.cgi?id=234988
    <rdar://problem/87619196>

    Reviewed by Geoffrey Garen.

    Source/WebCore:

    _CFURLStorageSessionCopyCache can be slow (see rdar://85418732) and UI process may kill network process for
    being unresponsive. Since WebKit does not use CFURLCache, we should disable it to avoid the hang.

    * platform/network/NetworkStorageSession.h:
    * platform/network/cf/NetworkStorageSessionCFNet.cpp:
    (WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier):
    * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
    (WebCore::createPrivateStorageSession):

    Source/WebCore/PAL:

    * pal/spi/cf/CFNetworkSPI.h:

    Source/WebKit:

    * NetworkProcess/NetworkProcess.cpp:
    (WebKit::NetworkProcess::newTestingSession):
    (WebKit::NetworkProcess::ensureSession):

    Source/WebKitLegacy:

    * WebCoreSupport/NetworkStorageSessionMap.cpp:
    (NetworkStorageSessionMap::ensureSession):

    Source/WTF:

    * wtf/PlatformHave.h:

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

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WTF/ChangeLog (288527 => 288528)


--- branches/safari-613-branch/Source/WTF/ChangeLog	2022-01-25 01:56:44 UTC (rev 288527)
+++ branches/safari-613-branch/Source/WTF/ChangeLog	2022-01-25 01:56:50 UTC (rev 288528)
@@ -1,5 +1,58 @@
 2022-01-24  Alan Coon  <[email protected]>
 
+        Cherry-pick r288389. rdar://problem/85405320
+
+    Disable CFURLCache in WebKit2
+    https://bugs.webkit.org/show_bug.cgi?id=234988
+    <rdar://problem/87619196>
+    
+    Reviewed by Geoffrey Garen.
+    
+    Source/WebCore:
+    
+    _CFURLStorageSessionCopyCache can be slow (see rdar://85418732) and UI process may kill network process for
+    being unresponsive. Since WebKit does not use CFURLCache, we should disable it to avoid the hang.
+    
+    * platform/network/NetworkStorageSession.h:
+    * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+    (WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier):
+    * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+    (WebCore::createPrivateStorageSession):
+    
+    Source/WebCore/PAL:
+    
+    * pal/spi/cf/CFNetworkSPI.h:
+    
+    Source/WebKit:
+    
+    * NetworkProcess/NetworkProcess.cpp:
+    (WebKit::NetworkProcess::newTestingSession):
+    (WebKit::NetworkProcess::ensureSession):
+    
+    Source/WebKitLegacy:
+    
+    * WebCoreSupport/NetworkStorageSessionMap.cpp:
+    (NetworkStorageSessionMap::ensureSession):
+    
+    Source/WTF:
+    
+    * wtf/PlatformHave.h:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288389 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-21  Sihui Liu  <[email protected]>
+
+            Disable CFURLCache in WebKit2
+            https://bugs.webkit.org/show_bug.cgi?id=234988
+            <rdar://problem/87619196>
+
+            Reviewed by Geoffrey Garen.
+
+            * wtf/PlatformHave.h:
+
+2022-01-24  Alan Coon  <[email protected]>
+
         Cherry-pick r287941. rdar://problem/87472589
 
     [JSC] Enable libpas jit-heap when libpas is enabled

Modified: branches/safari-613-branch/Source/WTF/wtf/PlatformHave.h (288527 => 288528)


--- branches/safari-613-branch/Source/WTF/wtf/PlatformHave.h	2022-01-25 01:56:44 UTC (rev 288527)
+++ branches/safari-613-branch/Source/WTF/wtf/PlatformHave.h	2022-01-25 01:56:50 UTC (rev 288528)
@@ -1144,3 +1144,10 @@
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 120200
 #define HAVE_PLATFORM_SCROLL_MOMENTUM_INTERRUPTION_REASON 1
 #endif
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 120300) \
+    || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150400) \
+    || (PLATFORM(APPLETV) && __TV_OS_VERSION_MAX_ALLOWED >= 150400) \
+    || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MAX_ALLOWED >= 80500)
+#define HAVE_CFNETWORK_DISABLE_CACHE_SPI 1
+#endif

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (288527 => 288528)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-01-25 01:56:44 UTC (rev 288527)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-01-25 01:56:50 UTC (rev 288528)
@@ -1,5 +1,65 @@
 2022-01-24  Alan Coon  <[email protected]>
 
+        Cherry-pick r288389. rdar://problem/85405320
+
+    Disable CFURLCache in WebKit2
+    https://bugs.webkit.org/show_bug.cgi?id=234988
+    <rdar://problem/87619196>
+    
+    Reviewed by Geoffrey Garen.
+    
+    Source/WebCore:
+    
+    _CFURLStorageSessionCopyCache can be slow (see rdar://85418732) and UI process may kill network process for
+    being unresponsive. Since WebKit does not use CFURLCache, we should disable it to avoid the hang.
+    
+    * platform/network/NetworkStorageSession.h:
+    * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+    (WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier):
+    * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+    (WebCore::createPrivateStorageSession):
+    
+    Source/WebCore/PAL:
+    
+    * pal/spi/cf/CFNetworkSPI.h:
+    
+    Source/WebKit:
+    
+    * NetworkProcess/NetworkProcess.cpp:
+    (WebKit::NetworkProcess::newTestingSession):
+    (WebKit::NetworkProcess::ensureSession):
+    
+    Source/WebKitLegacy:
+    
+    * WebCoreSupport/NetworkStorageSessionMap.cpp:
+    (NetworkStorageSessionMap::ensureSession):
+    
+    Source/WTF:
+    
+    * wtf/PlatformHave.h:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288389 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-21  Sihui Liu  <[email protected]>
+
+            Disable CFURLCache in WebKit2
+            https://bugs.webkit.org/show_bug.cgi?id=234988
+            <rdar://problem/87619196>
+
+            Reviewed by Geoffrey Garen.
+
+            _CFURLStorageSessionCopyCache can be slow (see rdar://85418732) and UI process may kill network process for
+            being unresponsive. Since WebKit does not use CFURLCache, we should disable it to avoid the hang.
+
+            * platform/network/NetworkStorageSession.h:
+            * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+            (WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier):
+            * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+            (WebCore::createPrivateStorageSession):
+
+2022-01-24  Alan Coon  <[email protected]>
+
         Cherry-pick r288336. rdar://problem/86558157
 
     REGRESSION (r284136): A slight horizontal rubberband kills scroll momentum

Modified: branches/safari-613-branch/Source/WebCore/PAL/ChangeLog (288527 => 288528)


--- branches/safari-613-branch/Source/WebCore/PAL/ChangeLog	2022-01-25 01:56:44 UTC (rev 288527)
+++ branches/safari-613-branch/Source/WebCore/PAL/ChangeLog	2022-01-25 01:56:50 UTC (rev 288528)
@@ -1,3 +1,56 @@
+2022-01-24  Alan Coon  <[email protected]>
+
+        Cherry-pick r288389. rdar://problem/85405320
+
+    Disable CFURLCache in WebKit2
+    https://bugs.webkit.org/show_bug.cgi?id=234988
+    <rdar://problem/87619196>
+    
+    Reviewed by Geoffrey Garen.
+    
+    Source/WebCore:
+    
+    _CFURLStorageSessionCopyCache can be slow (see rdar://85418732) and UI process may kill network process for
+    being unresponsive. Since WebKit does not use CFURLCache, we should disable it to avoid the hang.
+    
+    * platform/network/NetworkStorageSession.h:
+    * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+    (WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier):
+    * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+    (WebCore::createPrivateStorageSession):
+    
+    Source/WebCore/PAL:
+    
+    * pal/spi/cf/CFNetworkSPI.h:
+    
+    Source/WebKit:
+    
+    * NetworkProcess/NetworkProcess.cpp:
+    (WebKit::NetworkProcess::newTestingSession):
+    (WebKit::NetworkProcess::ensureSession):
+    
+    Source/WebKitLegacy:
+    
+    * WebCoreSupport/NetworkStorageSessionMap.cpp:
+    (NetworkStorageSessionMap::ensureSession):
+    
+    Source/WTF:
+    
+    * wtf/PlatformHave.h:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288389 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-21  Sihui Liu  <[email protected]>
+
+            Disable CFURLCache in WebKit2
+            https://bugs.webkit.org/show_bug.cgi?id=234988
+            <rdar://problem/87619196>
+
+            Reviewed by Geoffrey Garen.
+
+            * pal/spi/cf/CFNetworkSPI.h:
+
 2022-01-09  Sam Weinig  <[email protected]>
 
         Remove support for Direct2D

Modified: branches/safari-613-branch/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h (288527 => 288528)


--- branches/safari-613-branch/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h	2022-01-25 01:56:44 UTC (rev 288527)
+++ branches/safari-613-branch/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h	2022-01-25 01:56:50 UTC (rev 288528)
@@ -359,6 +359,9 @@
 void _CFCachedURLResponseSetBecameFileBackedCallBackBlock(CFCachedURLResponseRef, CFCachedURLResponseCallBackBlock, dispatch_queue_t);
 #endif
 
+#if HAVE(CFNETWORK_DISABLE_CACHE_SPI)
+void _CFURLStorageSessionDisableCache(CFURLStorageSessionRef);
+#endif
 CFURLStorageSessionRef _CFURLStorageSessionCreate(CFAllocatorRef, CFStringRef, CFDictionaryRef);
 CFURLCacheRef _CFURLStorageSessionCopyCache(CFAllocatorRef, CFURLStorageSessionRef);
 void CFURLRequestSetShouldStartSynchronously(CFURLRequestRef, Boolean);

Modified: branches/safari-613-branch/Source/WebCore/platform/network/NetworkStorageSession.h (288527 => 288528)


--- branches/safari-613-branch/Source/WebCore/platform/network/NetworkStorageSession.h	2022-01-25 01:56:44 UTC (rev 288527)
+++ branches/safari-613-branch/Source/WebCore/platform/network/NetworkStorageSession.h	2022-01-25 01:56:50 UTC (rev 288528)
@@ -120,7 +120,8 @@
 #endif
 
 #if PLATFORM(COCOA) || USE(CFURLCONNECTION)
-    WEBCORE_EXPORT static RetainPtr<CFURLStorageSessionRef> createCFStorageSessionForIdentifier(CFStringRef identifier);
+    enum class ShouldDisableCFURLCache : bool { No, Yes };
+    WEBCORE_EXPORT static RetainPtr<CFURLStorageSessionRef> createCFStorageSessionForIdentifier(CFStringRef identifier, ShouldDisableCFURLCache = ShouldDisableCFURLCache::No);
     enum class IsInMemoryCookieStore : bool { No, Yes };
     WEBCORE_EXPORT NetworkStorageSession(PAL::SessionID, RetainPtr<CFURLStorageSessionRef>&&, RetainPtr<CFHTTPCookieStorageRef>&&, IsInMemoryCookieStore = IsInMemoryCookieStore::No);
     WEBCORE_EXPORT explicit NetworkStorageSession(PAL::SessionID);
@@ -301,7 +302,7 @@
 };
 
 #if PLATFORM(COCOA) || USE(CFURLCONNECTION)
-WEBCORE_EXPORT RetainPtr<CFURLStorageSessionRef> createPrivateStorageSession(CFStringRef identifier, std::optional<HTTPCookieAcceptPolicy> = std::nullopt);
+WEBCORE_EXPORT RetainPtr<CFURLStorageSessionRef> createPrivateStorageSession(CFStringRef identifier, std::optional<HTTPCookieAcceptPolicy> = std::nullopt, NetworkStorageSession::ShouldDisableCFURLCache = NetworkStorageSession::ShouldDisableCFURLCache::No);
 #endif
 
 }

Modified: branches/safari-613-branch/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (288527 => 288528)


--- branches/safari-613-branch/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp	2022-01-25 01:56:44 UTC (rev 288527)
+++ branches/safari-613-branch/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp	2022-01-25 01:56:50 UTC (rev 288528)
@@ -39,7 +39,7 @@
 
 namespace WebCore {
 
-RetainPtr<CFURLStorageSessionRef> NetworkStorageSession::createCFStorageSessionForIdentifier(CFStringRef identifier)
+RetainPtr<CFURLStorageSessionRef> NetworkStorageSession::createCFStorageSessionForIdentifier(CFStringRef identifier, ShouldDisableCFURLCache shouldDisableCFURLCache)
 {
     auto storageSession = adoptCF(_CFURLStorageSessionCreate(kCFAllocatorDefault, identifier, nullptr));
 
@@ -46,15 +46,25 @@
     if (!storageSession)
         return nullptr;
 
-    auto cache = adoptCF(_CFURLStorageSessionCopyCache(kCFAllocatorDefault, storageSession.get()));
-    if (!cache)
-        return nullptr;
+    if (shouldDisableCFURLCache == ShouldDisableCFURLCache::Yes) {
+#if HAVE(CFNETWORK_DISABLE_CACHE_SPI)
+        _CFURLStorageSessionDisableCache(storageSession.get());
+#else
+        shouldDisableCFURLCache = ShouldDisableCFURLCache::No;
+#endif
+    }
 
-    CFURLCacheSetDiskCapacity(cache.get(), 0);
+    if (shouldDisableCFURLCache == ShouldDisableCFURLCache::No) {
+        auto cache = adoptCF(_CFURLStorageSessionCopyCache(kCFAllocatorDefault, storageSession.get()));
+        if (!cache)
+            return nullptr;
 
-    auto sharedCache = adoptCF(CFURLCacheCopySharedURLCache());
-    CFURLCacheSetMemoryCapacity(cache.get(), CFURLCacheMemoryCapacity(sharedCache.get()));
+        CFURLCacheSetDiskCapacity(cache.get(), 0);
 
+        auto sharedCache = adoptCF(CFURLCacheCopySharedURLCache());
+        CFURLCacheSetMemoryCapacity(cache.get(), CFURLCacheMemoryCapacity(sharedCache.get()));
+    }
+
     if (!NetworkStorageSession::processMayUseCookieAPI())
         return storageSession;
 

Modified: branches/safari-613-branch/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNetWin.cpp (288527 => 288528)


--- branches/safari-613-branch/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNetWin.cpp	2022-01-25 01:56:44 UTC (rev 288527)
+++ branches/safari-613-branch/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNetWin.cpp	2022-01-25 01:56:50 UTC (rev 288528)
@@ -79,7 +79,7 @@
     return CFHTTPCookieStorageAcceptPolicyAlways;
 }
 
-RetainPtr<CFURLStorageSessionRef> createPrivateStorageSession(CFStringRef identifier, std::optional<HTTPCookieAcceptPolicy> cookieAcceptPolicy)
+RetainPtr<CFURLStorageSessionRef> createPrivateStorageSession(CFStringRef identifier, std::optional<HTTPCookieAcceptPolicy> cookieAcceptPolicy, NetworkStorageSession::ShouldDisableCFURLCache)
 {
     const void* sessionPropertyKeys[] = { _kCFURLStorageSessionIsPrivate };
     const void* sessionPropertyValues[] = { kCFBooleanTrue };

Modified: branches/safari-613-branch/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm (288527 => 288528)


--- branches/safari-613-branch/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm	2022-01-25 01:56:44 UTC (rev 288527)
+++ branches/safari-613-branch/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm	2022-01-25 01:56:50 UTC (rev 288528)
@@ -171,7 +171,7 @@
     return *m_cookieStorageObserver;
 }
 
-RetainPtr<CFURLStorageSessionRef> createPrivateStorageSession(CFStringRef identifier, std::optional<HTTPCookieAcceptPolicy> cookieAcceptPolicy)
+RetainPtr<CFURLStorageSessionRef> createPrivateStorageSession(CFStringRef identifier, std::optional<HTTPCookieAcceptPolicy> cookieAcceptPolicy, NetworkStorageSession::ShouldDisableCFURLCache shouldDisableCFURLCache)
 {
     const void* sessionPropertyKeys[] = { _kCFURLStorageSessionIsPrivate };
     const void* sessionPropertyValues[] = { kCFBooleanTrue };
@@ -181,6 +181,14 @@
     if (!storageSession)
         return nullptr;
 
+    if (shouldDisableCFURLCache == NetworkStorageSession::ShouldDisableCFURLCache::Yes) {
+#if HAVE(CFNETWORK_DISABLE_CACHE_SPI)
+        _CFURLStorageSessionDisableCache(storageSession.get());
+#else
+        shouldDisableCFURLCache = NetworkStorageSession::ShouldDisableCFURLCache::No;
+#endif
+    }
+
     // The private storage session should have the same properties as the default storage session,
     // with the exception that it should be in-memory only storage.
 
@@ -188,12 +196,13 @@
     // This could occur if there is an issue figuring out where to place a storage on disk (e.g. the
     // sandbox does not allow CFNetwork access).
 
-    auto cache = adoptCF(_CFURLStorageSessionCopyCache(kCFAllocatorDefault, storageSession.get()));
-    if (!cache)
-        return nullptr;
+    if (shouldDisableCFURLCache == NetworkStorageSession::ShouldDisableCFURLCache::No) {
+        auto cache = adoptCF(_CFURLStorageSessionCopyCache(kCFAllocatorDefault, storageSession.get()));
+        if (!cache)
+            return nullptr;
 
-    CFURLCacheSetDiskCapacity(cache.get(), 0); // Setting disk cache size should not be necessary once <rdar://problem/12656814> is fixed.
-    CFURLCacheSetMemoryCapacity(cache.get(), [[NSURLCache sharedURLCache] memoryCapacity]);
+        CFURLCacheSetMemoryCapacity(cache.get(), [[NSURLCache sharedURLCache] memoryCapacity]);
+    }
 
     auto cookieStorage = adoptCF(_CFURLStorageSessionCopyCookieStorage(kCFAllocatorDefault, storageSession.get()));
     if (!cookieStorage)

Modified: branches/safari-613-branch/Source/WebKit/ChangeLog (288527 => 288528)


--- branches/safari-613-branch/Source/WebKit/ChangeLog	2022-01-25 01:56:44 UTC (rev 288527)
+++ branches/safari-613-branch/Source/WebKit/ChangeLog	2022-01-25 01:56:50 UTC (rev 288528)
@@ -1,5 +1,60 @@
 2022-01-24  Alan Coon  <[email protected]>
 
+        Cherry-pick r288389. rdar://problem/85405320
+
+    Disable CFURLCache in WebKit2
+    https://bugs.webkit.org/show_bug.cgi?id=234988
+    <rdar://problem/87619196>
+    
+    Reviewed by Geoffrey Garen.
+    
+    Source/WebCore:
+    
+    _CFURLStorageSessionCopyCache can be slow (see rdar://85418732) and UI process may kill network process for
+    being unresponsive. Since WebKit does not use CFURLCache, we should disable it to avoid the hang.
+    
+    * platform/network/NetworkStorageSession.h:
+    * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+    (WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier):
+    * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+    (WebCore::createPrivateStorageSession):
+    
+    Source/WebCore/PAL:
+    
+    * pal/spi/cf/CFNetworkSPI.h:
+    
+    Source/WebKit:
+    
+    * NetworkProcess/NetworkProcess.cpp:
+    (WebKit::NetworkProcess::newTestingSession):
+    (WebKit::NetworkProcess::ensureSession):
+    
+    Source/WebKitLegacy:
+    
+    * WebCoreSupport/NetworkStorageSessionMap.cpp:
+    (NetworkStorageSessionMap::ensureSession):
+    
+    Source/WTF:
+    
+    * wtf/PlatformHave.h:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288389 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-21  Sihui Liu  <[email protected]>
+
+            Disable CFURLCache in WebKit2
+            https://bugs.webkit.org/show_bug.cgi?id=234988
+            <rdar://problem/87619196>
+
+            Reviewed by Geoffrey Garen.
+
+            * NetworkProcess/NetworkProcess.cpp:
+            (WebKit::NetworkProcess::newTestingSession):
+            (WebKit::NetworkProcess::ensureSession):
+
+2022-01-24  Alan Coon  <[email protected]>
+
         Cherry-pick r288386. rdar://problem/87822314
 
     [iOS][WP] Allow access to CFNetwork prefs

Modified: branches/safari-613-branch/Source/WebKit/NetworkProcess/NetworkProcess.cpp (288527 => 288528)


--- branches/safari-613-branch/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2022-01-25 01:56:44 UTC (rev 288527)
+++ branches/safari-613-branch/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2022-01-25 01:56:50 UTC (rev 288528)
@@ -443,7 +443,7 @@
 {
 #if PLATFORM(COCOA)
     // Session name should be short enough for shared memory region name to be under the limit, otherwise sandbox rules won't work (see <rdar://problem/13642852>).
-    auto session = WebCore::createPrivateStorageSession(makeString("WebKit Test-", getCurrentProcessID()).createCFString().get());
+    auto session = WebCore::createPrivateStorageSession(makeString("WebKit Test-", getCurrentProcessID()).createCFString().get(), std::nullopt, NetworkStorageSession::ShouldDisableCFURLCache::Yes);
     RetainPtr<CFHTTPCookieStorageRef> cookieStorage;
     if (WebCore::NetworkStorageSession::processMayUseCookieAPI()) {
         ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));
@@ -475,7 +475,7 @@
     RetainPtr<CFURLStorageSessionRef> storageSession;
     RetainPtr<CFStringRef> cfIdentifier = makeString(identifierBase, ".PrivateBrowsing.", createCanonicalUUIDString()).createCFString();
     if (sessionID.isEphemeral())
-        storageSession = createPrivateStorageSession(cfIdentifier.get());
+        storageSession = createPrivateStorageSession(cfIdentifier.get(), std::nullopt, WebCore::NetworkStorageSession::ShouldDisableCFURLCache::Yes);
     else if (sessionID != PAL::SessionID::defaultSessionID())
         storageSession = WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier(cfIdentifier.get());
 

Modified: branches/safari-613-branch/Source/WebKitLegacy/ChangeLog (288527 => 288528)


--- branches/safari-613-branch/Source/WebKitLegacy/ChangeLog	2022-01-25 01:56:44 UTC (rev 288527)
+++ branches/safari-613-branch/Source/WebKitLegacy/ChangeLog	2022-01-25 01:56:50 UTC (rev 288528)
@@ -1,3 +1,57 @@
+2022-01-24  Alan Coon  <[email protected]>
+
+        Cherry-pick r288389. rdar://problem/85405320
+
+    Disable CFURLCache in WebKit2
+    https://bugs.webkit.org/show_bug.cgi?id=234988
+    <rdar://problem/87619196>
+    
+    Reviewed by Geoffrey Garen.
+    
+    Source/WebCore:
+    
+    _CFURLStorageSessionCopyCache can be slow (see rdar://85418732) and UI process may kill network process for
+    being unresponsive. Since WebKit does not use CFURLCache, we should disable it to avoid the hang.
+    
+    * platform/network/NetworkStorageSession.h:
+    * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+    (WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier):
+    * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+    (WebCore::createPrivateStorageSession):
+    
+    Source/WebCore/PAL:
+    
+    * pal/spi/cf/CFNetworkSPI.h:
+    
+    Source/WebKit:
+    
+    * NetworkProcess/NetworkProcess.cpp:
+    (WebKit::NetworkProcess::newTestingSession):
+    (WebKit::NetworkProcess::ensureSession):
+    
+    Source/WebKitLegacy:
+    
+    * WebCoreSupport/NetworkStorageSessionMap.cpp:
+    (NetworkStorageSessionMap::ensureSession):
+    
+    Source/WTF:
+    
+    * wtf/PlatformHave.h:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288389 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-21  Sihui Liu  <[email protected]>
+
+            Disable CFURLCache in WebKit2
+            https://bugs.webkit.org/show_bug.cgi?id=234988
+            <rdar://problem/87619196>
+
+            Reviewed by Geoffrey Garen.
+
+            * WebCoreSupport/NetworkStorageSessionMap.cpp:
+            (NetworkStorageSessionMap::ensureSession):
+
 2022-01-11  Russell Epstein  <[email protected]>
 
         Cherry-pick r287884. rdar://problem/87206692

Modified: branches/safari-613-branch/Source/WebKitLegacy/WebCoreSupport/NetworkStorageSessionMap.cpp (288527 => 288528)


--- branches/safari-613-branch/Source/WebKitLegacy/WebCoreSupport/NetworkStorageSessionMap.cpp	2022-01-25 01:56:44 UTC (rev 288527)
+++ branches/safari-613-branch/Source/WebKitLegacy/WebCoreSupport/NetworkStorageSessionMap.cpp	2022-01-25 01:56:50 UTC (rev 288528)
@@ -90,7 +90,7 @@
     if (sessionID.isEphemeral())
         storageSession = WebCore::createPrivateStorageSession(identifier.get());
     else
-        storageSession = WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier(identifier.get());
+        storageSession = WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier(identifier.get(), WebCore::NetworkStorageSession::ShouldDisableCFURLCache::Yes);
 
     RetainPtr<CFHTTPCookieStorageRef> cookieStorage;
     if (WebCore::NetworkStorageSession::processMayUseCookieAPI()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to