Changeset 215991 in webkit
- Timestamp:
- Apr 30, 2017 1:24:05 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r215990 r215991 1 2017-04-30 Brady Eidson <beidson@apple.com> 2 3 Updates to _WKWebsiteDataStoreConfiguration cookie storage location SPI. 4 <rdar://problem/31906397> and https://bugs.webkit.org/show_bug.cgi?id=171483 5 6 Reviewed by Geoff Garen (and kind of Andy Estes). 7 8 No new tests (Covered by API test). 9 10 * platform/spi/cf/CFNetworkSPI.h: 11 1 12 2017-04-30 Dan Bernstein <mitz@apple.com> 2 13 -
trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h
r215941 r215991 171 171 172 172 void CFHTTPCookieStorageDeleteAllCookies(CFHTTPCookieStorageRef); 173 174 175 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101200) 176 void _CFHTTPCookieStorageFlushCookieStores(); 177 #else 178 void CFHTTPCookieStorageFlushCookieStores(); 179 #endif 173 180 174 181 #if PLATFORM(COCOA) -
trunk/Source/WebKit2/ChangeLog
r215983 r215991 1 2017-04-30 Brady Eidson <beidson@apple.com> 2 3 Updates to _WKWebsiteDataStoreConfiguration cookie storage location SPI. 4 <rdar://problem/31906397> and https://bugs.webkit.org/show_bug.cgi?id=171483 5 6 Reviewed by Geoff Garen (and kind of Andy Estes). 7 8 Updates include: 9 -Taking a file path as the config argument instead of a directory. 10 -Proper sandbox extension handling. 11 -Proper and thorough API test. 12 13 * NetworkProcess/NetworkProcess.cpp: 14 (WebKit::NetworkProcess::syncAllCookies): 15 * NetworkProcess/NetworkProcess.h: 16 * NetworkProcess/NetworkProcess.messages.in: 17 18 * NetworkProcess/cocoa/NetworkProcessCocoa.mm: 19 (WebKit::NetworkProcess::syncAllCookies): 20 21 * NetworkProcess/mac/RemoteNetworkingContext.mm: 22 (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession): 23 24 * Shared/WebsiteDataStoreParameters.cpp: 25 (WebKit::WebsiteDataStoreParameters::encode): 26 (WebKit::WebsiteDataStoreParameters::decode): 27 * Shared/WebsiteDataStoreParameters.h: 28 29 * UIProcess/API/Cocoa/WKProcessPool.mm: 30 (-[WKProcessPool _syncNetworkProcessCookies]): 31 * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: 32 33 * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: 34 (-[WKWebsiteDataStore _initWithConfiguration:]): 35 36 * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: 37 * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: 38 (-[_WKWebsiteDataStoreConfiguration _cookieStoragePath]): 39 (-[_WKWebsiteDataStoreConfiguration _setCookieStoragePath:]): 40 (-[_WKWebsiteDataStoreConfiguration _cookieStorageDirectory]): Deleted. 41 (-[_WKWebsiteDataStoreConfiguration _setCookieStorageDirectory:]): Deleted. 42 43 * UIProcess/WebProcessPool.cpp: 44 (WebKit::WebProcessPool::syncNetworkProcessCookies): 45 * UIProcess/WebProcessPool.h: 46 47 * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: 48 (WebKit::WebsiteDataStore::parameters): 49 50 * UIProcess/WebsiteData/WebsiteDataStore.cpp: 51 (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary): 52 53 * UIProcess/WebsiteData/WebsiteDataStore.h: 54 (WebKit::WebsiteDataStore::resolvedCookieStoragePath): 55 (WebKit::WebsiteDataStore::resolvedCookieStorageDirectory): Deleted. 56 1 57 2017-04-30 Brady Eidson <beidson@apple.com> 2 58 -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp
r215941 r215991 678 678 { 679 679 } 680 681 void NetworkProcess::syncAllCookies() 682 { 683 } 680 684 #endif 681 685 -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h
r215941 r215991 193 193 void clearCacheForAllOrigins(uint32_t cachesToClear); 194 194 void setAllowsAnySSLCertificateForWebSocket(bool); 195 void syncAllCookies(); 195 196 196 197 void didGrantSandboxExtensionsToDatabaseProcessForBlobs(uint64_t requestID); -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in
r215941 r215991 66 66 SetAllowsAnySSLCertificateForWebSocket(bool enabled) -> () 67 67 68 SyncAllCookies() -> () 69 68 70 AllowSpecificHTTPSCertificateForHost(WebCore::CertificateInfo certificate, String host) 69 71 SetCanHandleHTTPSServerTrustEvaluation(bool value) -
trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm
r215044 r215991 209 209 } 210 210 211 } 211 void NetworkProcess::syncAllCookies() 212 { 213 #if !PLATFORM(IOS) 214 #if (__MAC_OS_X_VERSION_MIN_REQUIRED <= 101200) 215 _CFHTTPCookieStorageFlushCookieStores(); 216 #else 217 CFHTTPCookieStorageFlushCookieStores(); 218 #endif 219 #endif 220 } 221 222 } -
trunk/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm
r215941 r215991 113 113 base = SessionTracker::getIdentifierBase(); 114 114 115 #if PLATFORM(IOS) 116 SandboxExtension::consumePermanently(parameters.cookieStorageDirectoryExtensionHandle); 117 #endif 115 SandboxExtension::consumePermanently(parameters.cookieStoragePathExtensionHandle); 118 116 119 117 RetainPtr<CFHTTPCookieStorageRef> uiProcessCookieStorage; 120 121 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100 122 RetainPtr<CFDataRef> cookieStorageData = adoptCF(CFDataCreate(kCFAllocatorDefault, parameters.uiProcessCookieStorageIdentifier.data(), parameters.uiProcessCookieStorageIdentifier.size())); 123 uiProcessCookieStorage = adoptCF(CFHTTPCookieStorageCreateFromIdentifyingData(kCFAllocatorDefault, cookieStorageData.get())); 124 #endif 118 if (!parameters.uiProcessCookieStorageIdentifier.isEmpty()) { 119 RetainPtr<CFDataRef> cookieStorageData = adoptCF(CFDataCreate(kCFAllocatorDefault, parameters.uiProcessCookieStorageIdentifier.data(), parameters.uiProcessCookieStorageIdentifier.size())); 120 uiProcessCookieStorage = adoptCF(CFHTTPCookieStorageCreateFromIdentifyingData(kCFAllocatorDefault, cookieStorageData.get())); 121 } 125 122 126 123 NetworkStorageSession::ensureSession(parameters.sessionID, base + '.' + String::number(parameters.sessionID.sessionID()), WTFMove(uiProcessCookieStorage)); -
trunk/Source/WebKit2/Shared/WebsiteDataStoreParameters.cpp
r215941 r215991 39 39 { 40 40 encoder << sessionID; 41 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 10110042 41 encoder << uiProcessCookieStorageIdentifier; 43 #endif 44 #if PLATFORM(IOS) 45 encoder << cookieStorageDirectoryExtensionHandle; 46 #endif 42 encoder << cookieStoragePathExtensionHandle; 47 43 } 48 44 … … 52 48 return false; 53 49 54 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 10110055 50 if (!decoder.decode(parameters.uiProcessCookieStorageIdentifier)) 56 51 return false; 57 #endif58 52 59 #if PLATFORM(IOS) 60 if (!decoder.decode(parameters.cookieStorageDirectoryExtensionHandle)) 53 if (!decoder.decode(parameters.cookieStoragePathExtensionHandle)) 61 54 return false; 62 #endif63 55 64 56 return true; -
trunk/Source/WebKit2/Shared/WebsiteDataStoreParameters.h
r215941 r215991 45 45 46 46 WebCore::SessionID sessionID; 47 48 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 10110049 47 Vector<uint8_t> uiProcessCookieStorageIdentifier; 50 #endif 51 #if PLATFORM(IOS) 52 SandboxExtension::Handle cookieStorageDirectoryExtensionHandle; 53 #endif 48 SandboxExtension::Handle cookieStoragePathExtensionHandle; 54 49 }; 55 50 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm
r215536 r215991 293 293 } 294 294 295 - (void)_syncNetworkProcessCookies 296 { 297 _processPool->syncNetworkProcessCookies(); 298 } 299 295 300 - (size_t)_webProcessCount 296 301 { -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
r215536 r215991 72 72 // Test only. 73 73 - (size_t)_webProcessCount; 74 - (void)_syncNetworkProcessCookies; 74 75 75 76 // Test only. Should be called before any web content processes are launched. -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
r215941 r215991 161 161 if (configuration._indexedDBDatabaseDirectory) 162 162 config.indexedDBDatabaseDirectory = configuration._indexedDBDatabaseDirectory.path; 163 if (configuration._cookieStorage Directory)164 config.cookieStorage Directory = configuration._cookieStorageDirectory.path;163 if (configuration._cookieStorageFile) 164 config.cookieStorageFile = configuration._cookieStorageFile.path; 165 165 166 166 API::Object::constructInWrapper<API::WebsiteDataStore>(self, config, WebCore::SessionID::generatePersistentSessionID()); -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h
r215897 r215991 38 38 @property (nonatomic, copy, setter=_setIndexedDBDatabaseDirectory:) NSURL *_indexedDBDatabaseDirectory; 39 39 @property (nonatomic, copy, setter=_setWebSQLDatabaseDirectory:) NSURL *_webSQLDatabaseDirectory; 40 @property (nonatomic, copy, setter=_setCookieStorage Directory:) NSURL *_cookieStorageDirectoryWK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));40 @property (nonatomic, copy, setter=_setCookieStorageFile:) NSURL *_cookieStorageFile WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 41 41 42 42 @end -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm
r215897 r215991 41 41 RetainPtr<NSURL> _indexedDBDatabaseDirectoryURL; 42 42 RetainPtr<NSURL> _webSQLDatabaseDirectoryURL; 43 RetainPtr<NSURL> _cookieStorage DirectoryURL;43 RetainPtr<NSURL> _cookieStorageFileURL; 44 44 } 45 45 … … 71 71 } 72 72 73 -(NSURL *)_cookieStorage Directory{74 return _cookieStorage DirectoryURL.get();73 -(NSURL *)_cookieStorageFile { 74 return _cookieStorageFileURL.get(); 75 75 } 76 76 77 -(void)_setCookieStorage Directory:(NSURL *)url {77 -(void)_setCookieStorageFile:(NSURL *)url { 78 78 checkURLArgument(url); 79 _cookieStorageDirectoryURL = adoptNS([url copy]); 79 if ([url hasDirectoryPath]) 80 [NSException raise:NSInvalidArgumentException format:@"The cookie storage path must point to a file, not a directory."]; 81 82 _cookieStorageFileURL = adoptNS([url copy]); 80 83 } 81 84 -
trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp
r215973 r215991 1320 1320 } 1321 1321 1322 void WebProcessPool::syncNetworkProcessCookies() 1323 { 1324 sendSyncToNetworkingProcess(Messages::NetworkProcess::SyncAllCookies(), Messages::NetworkProcess::SyncAllCookies::Reply()); 1325 } 1326 1322 1327 void WebProcessPool::allowSpecificHTTPSCertificateForHost(const WebCertificateInfo* certificate, const String& host) 1323 1328 { -
trunk/Source/WebKit2/UIProcess/WebProcessPool.h
r215973 r215991 265 265 void terminateNetworkProcess(); 266 266 267 void syncNetworkProcessCookies(); 268 267 269 void reportWebContentCPUTime(Seconds cpuTime, uint64_t activityState); 268 270 -
trunk/Source/WebKit2/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
r215941 r215991 31 31 #import "WebsiteDataStoreParameters.h" 32 32 #import <WebCore/CFNetworkSPI.h> 33 #import <WebCore/FileSystem.h> 33 34 #import <WebCore/SearchPopupMenuCocoa.h> 34 35 #import <wtf/NeverDestroyed.h> … … 55 56 parameters.sessionID = m_sessionID; 56 57 57 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100 58 auto cookieFile = resolvedCookieStorageFile(); 59 60 #if PLATFORM(COCOA) 58 61 if (m_uiProcessCookieStorageIdentifier.isEmpty()) { 59 auto cookiePath = resolvedCookieStorageDirectory().utf8();60 auto url = adoptCF(CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8 *) cookiePath.data(), (CFIndex)cookiePath.length(), true));62 auto utf8File = cookieFile.utf8(); 63 auto url = adoptCF(CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8 *)utf8File.data(), (CFIndex)utf8File.length(), true)); 61 64 m_cfCookieStorage = adoptCF(CFHTTPCookieStorageCreateFromFile(kCFAllocatorDefault, url.get(), nullptr)); 62 65 auto cfData = adoptCF(CFHTTPCookieStorageCreateIdentifyingData(kCFAllocatorDefault, m_cfCookieStorage.get())); … … 66 69 67 70 parameters.uiProcessCookieStorageIdentifier = m_uiProcessCookieStorageIdentifier; 68 #endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 10110071 #endif 69 72 70 #if PLATFORM(IOS) 71 String cookieStorageDirectory = resolvedCookieStorageDirectory(); 72 if (!cookieStorageDirectory.isEmpty()) 73 SandboxExtension::createHandleForReadWriteDirectory(cookieStorageDirectory, parameters.cookieStorageDirectoryExtensionHandle); 74 #endif 73 if (!cookieFile.isEmpty()) 74 SandboxExtension::createHandleForReadWriteDirectory(WebCore::directoryName(cookieFile), parameters.cookieStoragePathExtensionHandle); 75 75 76 76 return parameters; -
trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp
r215983 r215991 41 41 #include <WebCore/ApplicationCacheStorage.h> 42 42 #include <WebCore/DatabaseTracker.h> 43 #include <WebCore/FileSystem.h> 43 44 #include <WebCore/HTMLMediaElement.h> 44 45 #include <WebCore/OriginLock.h> … … 113 114 m_hasResolvedDirectories = true; 114 115 116 // Resolve directory paths. 115 117 m_resolvedConfiguration.applicationCacheDirectory = resolveAndCreateReadWriteDirectoryForSandboxExtension(m_configuration.applicationCacheDirectory); 116 118 m_resolvedConfiguration.mediaCacheDirectory = resolveAndCreateReadWriteDirectoryForSandboxExtension(m_configuration.mediaCacheDirectory); … … 119 121 m_resolvedConfiguration.indexedDBDatabaseDirectory = resolveAndCreateReadWriteDirectoryForSandboxExtension(m_configuration.indexedDBDatabaseDirectory); 120 122 121 if (!m_configuration.cookieStorageDirectory.isEmpty())122 m_resolvedConfiguration.cookieStorageDirectory = resolveAndCreateReadWriteDirectoryForSandboxExtension(m_configuration.cookieStorageDirectory);123 124 123 if (!m_configuration.javaScriptConfigurationDirectory.isEmpty()) 125 124 m_resolvedConfiguration.javaScriptConfigurationDirectory = resolvePathForSandboxExtension(m_configuration.javaScriptConfigurationDirectory); 125 126 // Resolve directories for file paths. 127 if (!m_configuration.cookieStorageFile.isEmpty()) { 128 m_resolvedConfiguration.cookieStorageFile = resolveAndCreateReadWriteDirectoryForSandboxExtension(WebCore::directoryName(m_configuration.cookieStorageFile)); 129 m_resolvedConfiguration.cookieStorageFile = WebCore::pathByAppendingComponent(m_resolvedConfiguration.cookieStorageFile, WebCore::pathGetFileName(m_configuration.cookieStorageFile)); 130 } 126 131 } 127 132 -
trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h
r215961 r215991 38 38 #include <wtf/text/WTFString.h> 39 39 40 #if PLATFORM( MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 10110040 #if PLATFORM(COCOA) 41 41 #include <WebCore/CFNetworkSPI.h> 42 42 #endif … … 76 76 String resourceLoadStatisticsDirectory; 77 77 String javaScriptConfigurationDirectory; 78 String cookieStorage Directory;78 String cookieStorageFile; 79 79 }; 80 80 static Ref<WebsiteDataStore> createNonPersistent(); … … 108 108 const String& resolvedDatabaseDirectory() const { return m_resolvedConfiguration.webSQLDatabaseDirectory; } 109 109 const String& resolvedJavaScriptConfigurationDirectory() const { return m_resolvedConfiguration.javaScriptConfigurationDirectory; } 110 const String& resolvedCookieStorage Directory() const { return m_resolvedConfiguration.cookieStorageDirectory; }110 const String& resolvedCookieStorageFile() const { return m_resolvedConfiguration.cookieStorageFile; } 111 111 const String& resolvedIndexedDatabaseDirectory() const { return m_resolvedConfiguration.indexedDBDatabaseDirectory; } 112 112 … … 157 157 Ref<WorkQueue> m_queue; 158 158 159 #if PLATFORM( MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100159 #if PLATFORM(COCOA) 160 160 Vector<uint8_t> m_uiProcessCookieStorageIdentifier; 161 161 RetainPtr<CFHTTPCookieStorageRef> m_cfCookieStorage; -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm
r215941 r215991 78 78 base = SessionTracker::getIdentifierBase(); 79 79 80 #if PLATFORM(IOS) 81 SandboxExtension::consumePermanently(parameters.cookieStorageDirectoryExtensionHandle); 82 #endif 80 SandboxExtension::consumePermanently(parameters.cookieStoragePathExtensionHandle); 83 81 84 RetainPtr<CFHTTPCookieStorageRef> uiProcessCookieStorage;85 86 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 10110087 82 RetainPtr<CFDataRef> cookieStorageData = adoptCF(CFDataCreate(kCFAllocatorDefault, parameters.uiProcessCookieStorageIdentifier.data(), parameters.uiProcessCookieStorageIdentifier.size())); 88 uiProcessCookieStorage = adoptCF(CFHTTPCookieStorageCreateFromIdentifyingData(kCFAllocatorDefault, cookieStorageData.get())); 89 #endif 83 auto uiProcessCookieStorage = adoptCF(CFHTTPCookieStorageCreateFromIdentifyingData(kCFAllocatorDefault, cookieStorageData.get())); 90 84 91 85 NetworkStorageSession::ensureSession(parameters.sessionID, base + '.' + String::number(parameters.sessionID.sessionID()), WTFMove(uiProcessCookieStorage)); -
trunk/Tools/ChangeLog
r215989 r215991 1 2017-04-30 Brady Eidson <beidson@apple.com> 2 3 Updates to _WKWebsiteDataStoreConfiguration cookie storage location SPI. 4 <rdar://problem/31906397> and https://bugs.webkit.org/show_bug.cgi?id=171483 5 6 Reviewed by Geoff Garen (and kind of Andy Estes). 7 8 * TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm: 9 (TEST): 10 1 11 2017-04-30 Joanmarie Diggs <jdiggs@igalia.com> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm
r215961 r215991 75 75 [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"testHandler"]; 76 76 77 NSURL *sqlPath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/WebSQL/" stringByExpandingTildeInPath] ];78 NSURL *idbPath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/IndexedDB/" stringByExpandingTildeInPath] ];79 NSURL *localStoragePath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/LocalStorage/" stringByExpandingTildeInPath] ];80 NSURL *cookieStorage Path = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/CookieStorage/" stringByExpandingTildeInPath]];77 NSURL *sqlPath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/WebSQL/" stringByExpandingTildeInPath] isDirectory:YES]; 78 NSURL *idbPath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/IndexedDB/" stringByExpandingTildeInPath] isDirectory:YES]; 79 NSURL *localStoragePath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/LocalStorage/" stringByExpandingTildeInPath] isDirectory:YES]; 80 NSURL *cookieStorageFile = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/CookieStorage/Cookie.File" stringByExpandingTildeInPath] isDirectory:NO]; 81 81 82 NSURL *defaultSQLPath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/WebsiteData/WebSQL/" stringByExpandingTildeInPath] ];83 NSURL *defaultIDBPath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/WebsiteData/IndexedDB/" stringByExpandingTildeInPath] ];84 NSURL *defaultLocalStoragePath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/WebsiteData/LocalStorage/" stringByExpandingTildeInPath] ];82 NSURL *defaultSQLPath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/WebsiteData/WebSQL/" stringByExpandingTildeInPath] isDirectory:YES]; 83 NSURL *defaultIDBPath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/WebsiteData/IndexedDB/" stringByExpandingTildeInPath] isDirectory:YES]; 84 NSURL *defaultLocalStoragePath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/WebsiteData/LocalStorage/" stringByExpandingTildeInPath] isDirectory:YES]; 85 85 86 86 [[NSFileManager defaultManager] removeItemAtURL:sqlPath error:nil]; 87 87 [[NSFileManager defaultManager] removeItemAtURL:idbPath error:nil]; 88 88 [[NSFileManager defaultManager] removeItemAtURL:localStoragePath error:nil]; 89 [[NSFileManager defaultManager] removeItemAtURL:cookieStorage Patherror:nil];89 [[NSFileManager defaultManager] removeItemAtURL:cookieStorageFile error:nil]; 90 90 [[NSFileManager defaultManager] removeItemAtURL:defaultSQLPath error:nil]; 91 91 [[NSFileManager defaultManager] removeItemAtURL:defaultIDBPath error:nil]; … … 95 95 EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:idbPath.path]); 96 96 EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:localStoragePath.path]); 97 EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:cookieStorage Path.path]);97 EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:cookieStorageFile.path]); 98 98 EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:defaultSQLPath.path]); 99 99 EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:defaultIDBPath.path]); … … 104 104 websiteDataStoreConfiguration._indexedDBDatabaseDirectory = idbPath; 105 105 websiteDataStoreConfiguration._webStorageDirectory = localStoragePath; 106 websiteDataStoreConfiguration._cookieStorage Directory = cookieStoragePath;106 websiteDataStoreConfiguration._cookieStorageFile = cookieStorageFile; 107 107 108 108 configuration.get().websiteDataStore = [[WKWebsiteDataStore alloc] _initWithConfiguration:websiteDataStoreConfiguration]; … … 126 126 EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:defaultIDBPath.path]); 127 127 128 // FIXME: This should be true, but comes up false. Possibly a CFNetwork issue. Being explored in <rdar://problem/31666275> 129 EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:cookieStoragePath.path]); 128 [[[webView configuration] processPool] _syncNetworkProcessCookies]; 129 EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:cookieStorageFile.path]); 130 131 // Note: The format of the cookie file on disk is proprietary and opaque, so this is fragile to future changes. 132 // But right now, it is reliable to scan the file for the ASCII string of the cookie name we set. 133 // This helps verify that the cookie file was actually written to as we'd expect. 134 auto data = adoptNS([[NSData alloc] initWithContentsOfURL:cookieStorageFile]); 135 char bytes[] = "testkey"; 136 auto cookieKeyData = adoptNS([[NSData alloc] initWithBytes:(void *)bytes length:strlen(bytes)]); 137 auto result = [data rangeOfData:cookieKeyData.get() options:0 range:NSMakeRange(0, data.get().length)]; 138 EXPECT_NE((const long)result.location, NSNotFound); 130 139 131 140 // FIXME: The default SQL and LocalStorage paths are being used for something, but they shouldn't be. (theses should be false, not true)
Note: See TracChangeset
for help on using the changeset viewer.