Changeset 233853 in webkit
- Timestamp:
- Jul 16, 2018, 11:35:50 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r233851 r233853 1 2018-07-16 Sihui Liu <sihui_liu@apple.com> 2 3 IndexedDB: closeAndDeleteDatabasesForOrigins should remove all databases for those origins 4 https://bugs.webkit.org/show_bug.cgi?id=187631 5 <rdar://problem/42164227> 6 7 Reviewed by Brady Eidson. 8 9 When asked to delete database for an origin, we deleted the databases whose mainFrameOrigin 10 is that origin. Given that the origin may create IndexedDB from subframes, we should delete 11 databases whose openingOrigin is that origin too. 12 13 Covered by modified API test: WebKit.WebsiteDataStoreCustomPaths. 14 15 * Modules/indexeddb/server/IDBServer.cpp: 16 (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins): 17 1 18 2018-07-16 Simon Fraser <simon.fraser@apple.com> 2 19 -
trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp
r233777 r233853 627 627 String originPath = FileSystem::pathByAppendingComponent(m_databaseDirectoryPath, origin.databaseIdentifier()); 628 628 removeAllDatabasesForOriginPath(originPath, -WallTime::infinity()); 629 630 for (const auto& topOriginPath : FileSystem::listDirectory(m_databaseDirectoryPath, "*")) { 631 originPath = FileSystem::pathByAppendingComponent(topOriginPath, origin.databaseIdentifier()); 632 removeAllDatabasesForOriginPath(originPath, -WallTime::infinity()); 633 } 629 634 } 630 635 } -
trunk/Source/WebKit/ChangeLog
r233842 r233853 1 2018-07-16 Sihui Liu <sihui_liu@apple.com> 2 3 IndexedDB: closeAndDeleteDatabasesForOrigins should remove all databases for those origins 4 https://bugs.webkit.org/show_bug.cgi?id=187631 5 <rdar://problem/42164227> 6 7 Reviewed by Brady Eidson. 8 9 We need to return all origins, both openingOrigin and mainFrameOrigin, of IndexedDB so users 10 could be better aware of which origins are using databases and decide what they want to 11 remove. 12 13 * StorageProcess/StorageProcess.cpp: 14 (WebKit::StorageProcess::indexedDatabaseOrigins): 15 * StorageProcess/StorageProcess.h: 16 1 17 2018-07-15 Carlos Garcia Campos <cgarcia@igalia.com> 2 18 -
trunk/Source/WebKit/StorageProcess/StorageProcess.cpp
r233807 r233853 407 407 } 408 408 409 Vector<WebCore::SecurityOriginData> StorageProcess::indexedDatabaseOrigins(const String& path)409 HashSet<WebCore::SecurityOriginData> StorageProcess::indexedDatabaseOrigins(const String& path) 410 410 { 411 411 if (path.isEmpty()) 412 412 return { }; 413 413 414 Vector<WebCore::SecurityOriginData> securityOrigins; 415 for (auto& originPath : FileSystem::listDirectory(path, "*")) { 416 String databaseIdentifier = FileSystem::pathGetFileName(originPath); 417 414 HashSet<WebCore::SecurityOriginData> securityOrigins; 415 for (auto& topOriginPath : FileSystem::listDirectory(path, "*")) { 416 auto databaseIdentifier = FileSystem::pathGetFileName(topOriginPath); 418 417 if (auto securityOrigin = SecurityOriginData::fromDatabaseIdentifier(databaseIdentifier)) 419 securityOrigins.append(WTFMove(*securityOrigin)); 418 securityOrigins.add(WTFMove(*securityOrigin)); 419 420 for (auto& originPath : FileSystem::listDirectory(topOriginPath, "*")) { 421 databaseIdentifier = FileSystem::pathGetFileName(originPath); 422 if (auto securityOrigin = SecurityOriginData::fromDatabaseIdentifier(databaseIdentifier)) 423 securityOrigins.add(WTFMove(*securityOrigin)); 424 } 420 425 } 421 426 -
trunk/Source/WebKit/StorageProcess/StorageProcess.h
r232891 r233853 156 156 #endif 157 157 #if ENABLE(INDEXED_DATABASE) 158 Vector<WebCore::SecurityOriginData> indexedDatabaseOrigins(const String& path);158 HashSet<WebCore::SecurityOriginData> indexedDatabaseOrigins(const String& path); 159 159 #endif 160 160 -
trunk/Tools/ChangeLog
r233844 r233853 1 2018-07-16 Sihui Liu <sihui_liu@apple.com> 2 3 IndexedDB: closeAndDeleteDatabasesForOrigins should remove all databases for those origins 4 https://bugs.webkit.org/show_bug.cgi?id=187631 5 <rdar://problem/42164227> 6 7 Reviewed by Brady Eidson. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm: 10 (TEST): 11 1 12 2018-07-15 Carlos Garcia Campos <cgarcia@igalia.com> 2 13 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm
r233798 r233853 191 191 [[NSFileManager defaultManager] copyItemAtURL:url3.get() toURL:[frameIDBPath.get() URLByAppendingPathComponent:@"IndexedDB.sqlite3-wal"] error:nil]; 192 192 193 RetainPtr<NSURL> frameIDBPath2 = [[fileIDBPath URLByAppendingPathComponent:@"https_webkit.org_0"] URLByAppendingPathComponent:@"WebsiteDataStoreCustomPaths"]; 194 [[NSFileManager defaultManager] createDirectoryAtURL:frameIDBPath2.get() withIntermediateDirectories:YES attributes:nil error:nil]; 195 196 [[NSFileManager defaultManager] copyItemAtURL:url1.get() toURL:[frameIDBPath2.get() URLByAppendingPathComponent:@"IndexedDB.sqlite3"] error:nil]; 197 [[NSFileManager defaultManager] copyItemAtURL:url2.get() toURL:[frameIDBPath2.get() URLByAppendingPathComponent:@"IndexedDB.sqlite3-shm"] error:nil]; 198 [[NSFileManager defaultManager] copyItemAtURL:url3.get() toURL:[frameIDBPath2.get() URLByAppendingPathComponent:@"IndexedDB.sqlite3-wal"] error:nil]; 199 200 [dataStore fetchDataRecordsOfTypes:types.get() completionHandler:^(NSArray<WKWebsiteDataRecord *> * records) { 201 EXPECT_EQ([records count], (unsigned long)3); 202 for (id record in records) { 203 if ([[record displayName] isEqual: @"apple.com"]) { 204 [dataStore removeDataOfTypes:types.get() forDataRecords:[NSArray arrayWithObject:record] completionHandler:^() { 205 receivedScriptMessage = true; 206 EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:frameIDBPath.get().path]); 207 }]; 208 } 209 } 210 }]; 193 211 receivedScriptMessage = false; 212 TestWebKitAPI::Util::run(&receivedScriptMessage); 213 194 214 [dataStore removeDataOfTypes:types.get() modifiedSince:[NSDate distantPast] completionHandler:[]() { 195 215 receivedScriptMessage = true; 196 216 }]; 217 receivedScriptMessage = false; 197 218 TestWebKitAPI::Util::run(&receivedScriptMessage); 198 219
Note:
See TracChangeset
for help on using the changeset viewer.