Changeset 290239 in webkit
- Timestamp:
- Feb 21, 2022 1:23:39 AM (5 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp (modified) (3 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r290237 r290239 1 2022-02-21 Sihui Liu <sihui_liu@apple.com> 2 3 Fetching website data may get wrong record after migrating data to general storage directory 4 https://bugs.webkit.org/show_bug.cgi?id=236905 5 6 Reviewed by Chris Dumez. 7 8 To decide if an origin has data, we need to not only check if its directory exists but also if the directory is 9 empty. 10 11 Modified existing test to add test coverage. 12 13 * NetworkProcess/storage/OriginStorageManager.cpp: 14 (WebKit::OriginStorageManager::StorageBucket::resolvedLocalStoragePath): 15 (WebKit::OriginStorageManager::StorageBucket::resolvedIDBStoragePath): directory should be created before moving 16 files. 17 (WebKit::OriginStorageManager::StorageBucket::fetchDataTypesInListFromDisk): given that IndexedDB and 18 LocalStorage can have custom paths, we may just check data by type. 19 1 20 2022-02-19 Jon Lee <jonlee@apple.com> 2 21 -
trunk/Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp
r290115 r290239 259 259 260 260 auto localStoragePath = LocalStorageManager::localStorageFilePath(localStorageDirectory); 261 if (!m_customLocalStoragePath.isEmpty() && !FileSystem::fileExists(localStoragePath) )261 if (!m_customLocalStoragePath.isEmpty() && !FileSystem::fileExists(localStoragePath) && FileSystem::fileExists(m_customLocalStoragePath)) 262 262 WebCore::SQLiteFileSystem::moveDatabaseFile(m_customLocalStoragePath, localStoragePath); 263 263 … … 281 281 } else { 282 282 auto idbStoragePath = typeStoragePath(StorageType::IndexedDB); 283 if (!m_customIDBStoragePath.isEmpty() && !FileSystem::fileExists(idbStoragePath)) { 283 if (!m_customIDBStoragePath.isEmpty() && !FileSystem::fileExists(idbStoragePath) && FileSystem::fileExists(m_customIDBStoragePath)) { 284 FileSystem::makeAllDirectories(idbStoragePath); 284 285 FileSystem::moveFile(m_customIDBStoragePath, idbStoragePath); 285 FileSystem::makeAllDirectories(idbStoragePath);286 286 } 287 287 … … 318 318 { 319 319 OptionSet<WebsiteDataType> result; 320 for (auto& storageType : FileSystem::listDirectory(m_rootPath)) { 321 if (auto type = toWebsiteDataType(storageType); type && types.contains(*type)) 322 result.add(*type); 323 } 324 325 if (types.contains(WebsiteDataType::LocalStorage) && !result.contains(WebsiteDataType::LocalStorage)) { 320 if (types.contains(WebsiteDataType::FileSystem)) { 321 auto fileSystemStoragePath = typeStoragePath(StorageType::FileSystem); 322 if (auto files = FileSystem::listDirectory(fileSystemStoragePath); !files.isEmpty()) 323 result.add(WebsiteDataType::FileSystem); 324 } 325 326 if (types.contains(WebsiteDataType::LocalStorage)) { 326 327 if (FileSystem::fileExists(resolvedLocalStoragePath())) 327 328 result.add(WebsiteDataType::LocalStorage); 328 329 } 329 330 330 if (types.contains(WebsiteDataType::IndexedDBDatabases) && !result.contains(WebsiteDataType::IndexedDBDatabases)) {331 if (types.contains(WebsiteDataType::IndexedDBDatabases)) { 331 332 if (auto databases = FileSystem::listDirectory(resolvedIDBStoragePath()); !databases.isEmpty()) 332 333 result.add(WebsiteDataType::IndexedDBDatabases); -
trunk/Tools/ChangeLog
r290233 r290239 1 2022-02-21 Sihui Liu <sihui_liu@apple.com> 2 3 Fetching website data may get wrong record after migrating data to general storage directory 4 https://bugs.webkit.org/show_bug.cgi?id=236905 5 6 Reviewed by Chris Dumez. 7 8 * TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm: 9 (TEST): 10 1 11 2022-02-20 Sihui Liu <sihui_liu@apple.com> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm
r290233 r290239 1083 1083 EXPECT_FALSE([fileManager fileExistsAtPath:appleGeneralLocalStorageFile.path]); 1084 1084 EXPECT_FALSE([fileManager fileExistsAtPath:appleGeneralIndexedDBDatabaseFile.path]); 1085 } 1085 1086 // Ensure data records do not exist after deletion. 1087 done = false; 1088 [websiteDataStore fetchDataRecordsOfTypes:dataTypes completionHandler:^(NSArray<WKWebsiteDataRecord *> *records) { 1089 EXPECT_EQ(records.count, 0u); 1090 done = true; 1091 }]; 1092 TestWebKitAPI::Util::run(&done); 1093 }
Note: See TracChangeset
for help on using the changeset viewer.