Make sure all CFHTTPCookieStorageRefs we create are scheduled.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jul 2017 19:16:40 +0000 (19:16 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jul 2017 19:16:40 +0000 (19:16 +0000)
<rdar://problem/33221110> and https://bugs.webkit.org/show_bug.cgi?id=174513

Reviewed by Tim Horton.

Source/WebCore:

* platform/spi/cf/CFNetworkSPI.h:

Source/WebKit:

Whenever we create a CFHTTPCookieStorage from identifying data it is unscheduled.
We need to schedule it on a RunLoop.

This patch also cleans up the creation of the identifying data itself.

* NetworkProcess/mac/RemoteNetworkingContext.mm:
(WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):

* Shared/cf/CookieStorageUtilsCF.cpp: Added.
(WebKit::cookieStorageFromIdentifyingData):
(WebKit::identifyingDataFromCookieStorage):
* Shared/cf/CookieStorageUtilsCF.h: Added.

* Shared/mac/ChildProcessMac.mm:
(WebKit::ChildProcess::setSharedHTTPCookieStorage):

* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
(WebKit::WebProcessPool::platformInitializeNetworkProcess):

* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::parameters):

* WebKit.xcodeproj/project.pbxproj:

* WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
(WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/spi/cf/CFNetworkSPI.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/mac/RemoteNetworkingContext.mm
Source/WebKit/Shared/cf/CookieStorageUtilsCF.cpp [new file with mode: 0644]
Source/WebKit/Shared/cf/CookieStorageUtilsCF.h [new file with mode: 0644]
Source/WebKit/Shared/mac/ChildProcessMac.mm
Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm

index 9364320..6e2c1f3 100644 (file)
@@ -1,3 +1,12 @@
+2017-07-14  Brady Eidson  <beidson@apple.com>
+
+        Make sure all CFHTTPCookieStorageRefs we create are scheduled.
+        <rdar://problem/33221110> and https://bugs.webkit.org/show_bug.cgi?id=174513
+
+        Reviewed by Tim Horton.
+
+        * platform/spi/cf/CFNetworkSPI.h:
+
 2017-07-14  Youenn Fablet  <youenn@apple.com>
 
         Remove CoreAudioCaptureSource speaker configuration
index f3c6bc9..7e600bf 100644 (file)
@@ -195,10 +195,11 @@ extern const CFStringRef _kCFURLConnectionPropertyShouldSniff;
 
 CFHTTPCookieStorageRef _CFHTTPCookieStorageGetDefault(CFAllocatorRef);
 CFHTTPCookieStorageRef CFHTTPCookieStorageCreateFromFile(CFAllocatorRef, CFURLRef, CFHTTPCookieStorageRef);
-
+void CFHTTPCookieStorageScheduleWithRunLoop(CFHTTPCookieStorageRef, CFRunLoopRef, CFStringRef);
 void CFHTTPCookieStorageSetCookie(CFHTTPCookieStorageRef, CFHTTPCookieRef);
 void CFHTTPCookieStorageSetCookieAcceptPolicy(CFHTTPCookieStorageRef, CFHTTPCookieStorageAcceptPolicy);
 CFHTTPCookieStorageAcceptPolicy CFHTTPCookieStorageGetCookieAcceptPolicy(CFHTTPCookieStorageRef);
+
 void _CFNetworkSetOverrideSystemProxySettings(CFDictionaryRef);
 CFURLCredentialStorageRef CFURLCredentialStorageCreate(CFAllocatorRef);
 CFURLCredentialRef CFURLCredentialStorageCopyDefaultCredentialForProtectionSpace(CFURLCredentialStorageRef, CFURLProtectionSpaceRef);
index c33a1fa..92d08b2 100644 (file)
@@ -1,3 +1,38 @@
+2017-07-14  Brady Eidson  <beidson@apple.com>
+
+        Make sure all CFHTTPCookieStorageRefs we create are scheduled.
+        <rdar://problem/33221110> and https://bugs.webkit.org/show_bug.cgi?id=174513
+
+        Reviewed by Tim Horton.
+
+        Whenever we create a CFHTTPCookieStorage from identifying data it is unscheduled.
+        We need to schedule it on a RunLoop.
+        
+        This patch also cleans up the creation of the identifying data itself.
+        
+        * NetworkProcess/mac/RemoteNetworkingContext.mm:
+        (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
+        
+        * Shared/cf/CookieStorageUtilsCF.cpp: Added.
+        (WebKit::cookieStorageFromIdentifyingData):
+        (WebKit::identifyingDataFromCookieStorage):
+        * Shared/cf/CookieStorageUtilsCF.h: Added.
+        
+        * Shared/mac/ChildProcessMac.mm:
+        (WebKit::ChildProcess::setSharedHTTPCookieStorage):
+        
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeWebProcess):
+        (WebKit::WebProcessPool::platformInitializeNetworkProcess):
+        
+        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+        (WebKit::WebsiteDataStore::parameters):
+        
+        * WebKit.xcodeproj/project.pbxproj:
+        
+        * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
+        (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
+
 2017-07-14  Chris Dumez  <cdumez@apple.com>
 
         Potential null-dereference under NetworkRTCProvider::resolvedName()
index f44cdea..ab082ad 100644 (file)
@@ -26,6 +26,7 @@
 #import "config.h"
 #import "RemoteNetworkingContext.h"
 
+#import "CookieStorageUtilsCF.h"
 #import "LegacyCustomProtocolManager.h"
 #import "NetworkProcess.h"
 #import "NetworkSession.h"
@@ -119,10 +120,8 @@ void RemoteNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStorePara
     SandboxExtension::consumePermanently(parameters.cookieStoragePathExtensionHandle);
 
     RetainPtr<CFHTTPCookieStorageRef> uiProcessCookieStorage;
-    if (!parameters.uiProcessCookieStorageIdentifier.isEmpty()) {
-        RetainPtr<CFDataRef> cookieStorageData = adoptCF(CFDataCreate(kCFAllocatorDefault, parameters.uiProcessCookieStorageIdentifier.data(), parameters.uiProcessCookieStorageIdentifier.size()));
-        uiProcessCookieStorage = adoptCF(CFHTTPCookieStorageCreateFromIdentifyingData(kCFAllocatorDefault, cookieStorageData.get()));
-    }
+    if (!parameters.uiProcessCookieStorageIdentifier.isEmpty())
+        uiProcessCookieStorage = cookieStorageFromIdentifyingData(parameters.uiProcessCookieStorageIdentifier);
 
     NetworkStorageSession::ensureSession(parameters.sessionID, base + '.' + String::number(parameters.sessionID.sessionID()), WTFMove(uiProcessCookieStorage));
 
diff --git a/Source/WebKit/Shared/cf/CookieStorageUtilsCF.cpp b/Source/WebKit/Shared/cf/CookieStorageUtilsCF.cpp
new file mode 100644 (file)
index 0000000..b567c23
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "CookieStorageUtilsCF.h"
+
+namespace WebKit {
+
+RetainPtr<CFHTTPCookieStorageRef> cookieStorageFromIdentifyingData(const Vector<uint8_t>& data)
+{
+    ASSERT(!data.isEmpty());
+
+    auto cookieStorageData = adoptCF(CFDataCreate(kCFAllocatorDefault, data.data(), data.size()));
+    auto cookieStorage = adoptCF(CFHTTPCookieStorageCreateFromIdentifyingData(kCFAllocatorDefault, cookieStorageData.get()));
+    ASSERT(cookieStorage);
+
+    CFHTTPCookieStorageScheduleWithRunLoop(cookieStorage.get(), CFRunLoopGetMain(), kCFRunLoopCommonModes);
+
+    return cookieStorage;
+}
+
+Vector<uint8_t> identifyingDataFromCookieStorage(CFHTTPCookieStorageRef cookieStorage)
+{
+    Vector<uint8_t> result;
+
+    auto cfData = adoptCF(CFHTTPCookieStorageCreateIdentifyingData(kCFAllocatorDefault, cookieStorage));
+    result.append(CFDataGetBytePtr(cfData.get()), CFDataGetLength(cfData.get()));
+
+    return result;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/Shared/cf/CookieStorageUtilsCF.h b/Source/WebKit/Shared/cf/CookieStorageUtilsCF.h
new file mode 100644 (file)
index 0000000..a39d86f
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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 <WebCore/CFNetworkSPI.h>
+#include <wtf/RetainPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebKit {
+
+RetainPtr<CFHTTPCookieStorageRef> cookieStorageFromIdentifyingData(const Vector<uint8_t>&);
+Vector<uint8_t> identifyingDataFromCookieStorage(CFHTTPCookieStorageRef);
+
+} // namespace WebKit
index 8c732ac..378c118 100644 (file)
@@ -29,6 +29,7 @@
 #import "ChildProcess.h"
 
 #import "CodeSigning.h"
+#import "CookieStorageUtilsCF.h"
 #import "SandboxInitializationParameters.h"
 #import "WebKitSystemInterface.h"
 #import <WebCore/CFNetworkSPI.h>
@@ -179,9 +180,7 @@ void ChildProcess::initializeSandbox(const ChildProcessInitializationParameters&
 
 void ChildProcess::setSharedHTTPCookieStorage(const Vector<uint8_t>& identifier)
 {
-    RetainPtr<CFDataRef> cookieStorageData = adoptCF(CFDataCreate(kCFAllocatorDefault, identifier.data(), identifier.size()));
-    RetainPtr<CFHTTPCookieStorageRef> uiProcessCookieStorage = adoptCF(CFHTTPCookieStorageCreateFromIdentifyingData(kCFAllocatorDefault, cookieStorageData.get()));
-    [NSHTTPCookieStorage _setSharedHTTPCookieStorage:adoptNS([[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:uiProcessCookieStorage.get()]).get()];
+    [NSHTTPCookieStorage _setSharedHTTPCookieStorage:adoptNS([[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:cookieStorageFromIdentifyingData(identifier).get()]).get()];
 }
 
 #if USE(APPKIT)
index 491e3c3..8d3fac8 100644 (file)
@@ -26,6 +26,7 @@
 #import "config.h"
 #import "WebProcessPool.h"
 
+#import "CookieStorageUtilsCF.h"
 #import "LegacyCustomProtocolManagerClient.h"
 #import "NetworkProcessCreationParameters.h"
 #import "NetworkProcessMessages.h"
@@ -237,9 +238,8 @@ void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters&
     parameters.networkATSContext = adoptCF(_CFNetworkCopyATSContext());
 
 #if PLATFORM(MAC)
-    RetainPtr<CFDataRef> cookieStorageData = adoptCF(CFHTTPCookieStorageCreateIdentifyingData(kCFAllocatorDefault, [[NSHTTPCookieStorage sharedHTTPCookieStorage] _cookieStorage]));
     ASSERT(parameters.uiProcessCookieStorageIdentifier.isEmpty());
-    parameters.uiProcessCookieStorageIdentifier.append(CFDataGetBytePtr(cookieStorageData.get()), CFDataGetLength(cookieStorageData.get()));
+    parameters.uiProcessCookieStorageIdentifier = identifyingDataFromCookieStorage([[NSHTTPCookieStorage sharedHTTPCookieStorage] _cookieStorage]);
 #endif
 #if ENABLE(MEDIA_STREAM)
     // Allow microphone access if either preference is set because WebRTC requires microphone access.
@@ -293,9 +293,8 @@ void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationPara
     parameters.loadThrottleLatency = Seconds { [defaults integerForKey:WebKitNetworkLoadThrottleLatencyMillisecondsDefaultsKey] / 1000. };
 
 #if PLATFORM(MAC)
-    RetainPtr<CFDataRef> cookieStorageData = adoptCF(CFHTTPCookieStorageCreateIdentifyingData(kCFAllocatorDefault, [[NSHTTPCookieStorage sharedHTTPCookieStorage] _cookieStorage]));
     ASSERT(parameters.uiProcessCookieStorageIdentifier.isEmpty());
-    parameters.uiProcessCookieStorageIdentifier.append(CFDataGetBytePtr(cookieStorageData.get()), CFDataGetLength(cookieStorageData.get()));
+    parameters.uiProcessCookieStorageIdentifier = identifyingDataFromCookieStorage([[NSHTTPCookieStorage sharedHTTPCookieStorage] _cookieStorage]);
 #endif
 
     parameters.cookieStoragePartitioningEnabled = cookieStoragePartitioningEnabled();
index 7f038c9..2a04302 100644 (file)
@@ -26,6 +26,7 @@
 #import "config.h"
 #import "WebsiteDataStore.h"
 
+#import "CookieStorageUtilsCF.h"
 #import "StorageManager.h"
 #import "WebResourceLoadStatisticsStore.h"
 #import "WebsiteDataStoreParameters.h"
@@ -63,9 +64,7 @@ WebsiteDataStoreParameters WebsiteDataStore::parameters()
         auto utf8File = cookieFile.utf8();
         auto url = adoptCF(CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8 *)utf8File.data(), (CFIndex)utf8File.length(), true));
         m_cfCookieStorage = adoptCF(CFHTTPCookieStorageCreateFromFile(kCFAllocatorDefault, url.get(), nullptr));
-        auto cfData = adoptCF(CFHTTPCookieStorageCreateIdentifyingData(kCFAllocatorDefault, m_cfCookieStorage.get()));
-
-        m_uiProcessCookieStorageIdentifier.append(CFDataGetBytePtr(cfData.get()), CFDataGetLength(cfData.get()));
+        m_uiProcessCookieStorageIdentifier = identifyingDataFromCookieStorage(m_cfCookieStorage.get());
     }
 
     parameters.uiProcessCookieStorageIdentifier = m_uiProcessCookieStorageIdentifier;
index 4eaf46f..38bf1c1 100644 (file)
                518E8EFB16B2091C00E91429 /* AuthenticationManager.mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 518E8EF716B2091C00E91429 /* AuthenticationManager.mac.mm */; };
                51933DEF1965EB31008AC3EA /* MenuUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 51933DEB1965EB24008AC3EA /* MenuUtilities.h */; };
                51933DF01965EB31008AC3EA /* MenuUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51933DEC1965EB24008AC3EA /* MenuUtilities.mm */; };
+               5194B3881F192FBD00FA4708 /* CookieStorageUtilsCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5194B3871F192FB900FA4708 /* CookieStorageUtilsCF.cpp */; };
                51A4D5A916CAC4FF000E615E /* StatisticsRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A4D5A816CAC4FF000E615E /* StatisticsRequest.cpp */; };
                51A555F5128C6C47009ABCEC /* WKContextMenuItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A555F3128C6C47009ABCEC /* WKContextMenuItem.cpp */; };
                51A555F6128C6C47009ABCEC /* WKContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A555F4128C6C47009ABCEC /* WKContextMenuItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
                518E8EF716B2091C00E91429 /* AuthenticationManager.mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AuthenticationManager.mac.mm; sourceTree = "<group>"; };
                51933DEB1965EB24008AC3EA /* MenuUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuUtilities.h; sourceTree = "<group>"; };
                51933DEC1965EB24008AC3EA /* MenuUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MenuUtilities.mm; sourceTree = "<group>"; };
+               5194B3861F192FB900FA4708 /* CookieStorageUtilsCF.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CookieStorageUtilsCF.h; sourceTree = "<group>"; };
+               5194B3871F192FB900FA4708 /* CookieStorageUtilsCF.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CookieStorageUtilsCF.cpp; sourceTree = "<group>"; };
                51A4D5A816CAC4FF000E615E /* StatisticsRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StatisticsRequest.cpp; sourceTree = "<group>"; };
                51A555F3128C6C47009ABCEC /* WKContextMenuItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKContextMenuItem.cpp; sourceTree = "<group>"; };
                51A555F4128C6C47009ABCEC /* WKContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextMenuItem.h; sourceTree = "<group>"; };
                        children = (
                                1AAF0C4912B16334008E49E2 /* ArgumentCodersCF.cpp */,
                                1AAF0C4812B16334008E49E2 /* ArgumentCodersCF.h */,
+                               5194B3871F192FB900FA4708 /* CookieStorageUtilsCF.cpp */,
+                               5194B3861F192FB900FA4708 /* CookieStorageUtilsCF.h */,
                        );
                        path = cf;
                        sourceTree = "<group>";
                                7C85FD7F19341665000177C4 /* WebPreferencesKeys.cpp in Sources */,
                                BC84EB1812A7100C0083F2DA /* WebPreferencesMac.mm in Sources */,
                                BCD598AD112B7FDF00EC8C23 /* WebPreferencesStore.cpp in Sources */,
+                               5194B3881F192FBD00FA4708 /* CookieStorageUtilsCF.cpp in Sources */,
                                A1C512C8190656E500448914 /* WebPreviewLoaderClient.cpp in Sources */,
                                BC111AE4112F5C2600337BAB /* WebProcess.cpp in Sources */,
                                7C6E70FB18B2DC7A00F24E2E /* WebProcessCocoa.mm in Sources */,
index 8766939..8eef9d2 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "WebFrameNetworkingContext.h"
 
+#include "CookieStorageUtilsCF.h"
 #include "NetworkSession.h"
 #include "SessionTracker.h"
 #include "WebCookieManager.h"
@@ -79,8 +80,7 @@ void WebFrameNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStorePa
 
     SandboxExtension::consumePermanently(parameters.cookieStoragePathExtensionHandle);
 
-    RetainPtr<CFDataRef> cookieStorageData = adoptCF(CFDataCreate(kCFAllocatorDefault, parameters.uiProcessCookieStorageIdentifier.data(), parameters.uiProcessCookieStorageIdentifier.size()));
-    auto uiProcessCookieStorage = adoptCF(CFHTTPCookieStorageCreateFromIdentifyingData(kCFAllocatorDefault, cookieStorageData.get()));
+    RetainPtr<CFHTTPCookieStorageRef> uiProcessCookieStorage = cookieStorageFromIdentifyingData(parameters.uiProcessCookieStorageIdentifier);
 
     NetworkStorageSession::ensureSession(parameters.sessionID, base + '.' + String::number(parameters.sessionID.sessionID()), WTFMove(uiProcessCookieStorage));