Safari is failing to remove SQLite Databases via Remove All Website Data
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Aug 2015 20:40:38 +0000 (20:40 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Aug 2015 20:40:38 +0000 (20:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147584
rdar://problem/22095006

Reviewed by Brady Eidson.

If we end up deleting every single database for an origin, make sure to also delete the origin.

* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::deleteDatabasesModifiedSince):

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

Source/WebCore/ChangeLog
Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp

index bd2a883..efd7220 100644 (file)
@@ -1,3 +1,16 @@
+2015-08-03  Anders Carlsson  <andersca@apple.com>
+
+        Safari is failing to remove SQLite Databases via Remove All Website Data
+        https://bugs.webkit.org/show_bug.cgi?id=147584
+        rdar://problem/22095006
+
+        Reviewed by Brady Eidson.
+
+        If we end up deleting every single database for an origin, make sure to also delete the origin.
+
+        * Modules/webdatabase/DatabaseTracker.cpp:
+        (WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
+
 2015-08-03  Zalan Bujtas  <zalan@apple.com>
 
         Move "starting from root" frame flattening logging to the correct place.
index daa8af9..b86f3ad 100644 (file)
@@ -862,6 +862,8 @@ void DatabaseTracker::deleteDatabasesModifiedSince(std::chrono::system_clock::ti
         if (!databaseNamesForOrigin(origin.get(), databaseNames))
             continue;
 
+        size_t deletedDatabases = 0;
+
         for (auto& databaseName : databaseNames) {
             auto fullPath = fullPathForDatabase(origin.get(), databaseName, false);
 
@@ -873,7 +875,11 @@ void DatabaseTracker::deleteDatabasesModifiedSince(std::chrono::system_clock::ti
                 continue;
 
             deleteDatabase(origin.get(), databaseName);
+            ++deletedDatabases;
         }
+
+        if (deletedDatabases == databaseNames.size())
+            deleteOrigin(origin.get());
     }
 }