Unreviewed, rolling out r223419.
authorryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Oct 2017 18:53:11 +0000 (18:53 +0000)
committerryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Oct 2017 18:53:11 +0000 (18:53 +0000)
This change broke the Windows build.

Reverted changeset:

"If we fail to delete any database file, don't remove its
information from the tracker database"
https://bugs.webkit.org/show_bug.cgi?id=178251
https://trac.webkit.org/changeset/223419

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

Source/WebCore/ChangeLog
Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp
Source/WebCore/Modules/webdatabase/DatabaseTracker.h
Source/WebCore/platform/Logging.h

index d495eb2..d6e6ae6 100644 (file)
@@ -1,3 +1,16 @@
+2017-10-16  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r223419.
+
+        This change broke the Windows build.
+
+        Reverted changeset:
+
+        "If we fail to delete any database file, don't remove its
+        information from the tracker database"
+        https://bugs.webkit.org/show_bug.cgi?id=178251
+        https://trac.webkit.org/changeset/223419
+
 2017-10-16  Maureen Daum  <mdaum@apple.com>
 
         If we fail to delete any database file, don't remove its information from the tracker database
index 5c443d3..a191a81 100644 (file)
@@ -781,17 +781,12 @@ void DatabaseTracker::deleteDatabasesModifiedSince(std::chrono::system_clock::ti
         for (const auto& databaseName : databaseNames) {
             auto fullPath = fullPathForDatabase(origin, databaseName, false);
 
-            // If the file doesn't exist, we previously deleted it but failed to remove the information
-            // from the tracker database. We want to delete all of the information associated with this
-            // database from the tracker database, so still add its name to databaseNamesToDelete.
-            if (fileExists(fullPath)) {
-                time_t modificationTime;
-                if (!getFileModificationTime(fullPath, modificationTime))
-                    continue;
-
-                if (modificationTime < std::chrono::system_clock::to_time_t(time))
-                    continue;
-            }
+            time_t modificationTime;
+            if (!getFileModificationTime(fullPath, modificationTime))
+                continue;
+
+            if (modificationTime < std::chrono::system_clock::to_time_t(time))
+                continue;
 
             databaseNamesToDelete.uncheckedAppend(databaseName);
         }
@@ -835,22 +830,13 @@ bool DatabaseTracker::deleteOrigin(const SecurityOriginData& origin, DeletionMod
     }
 
     // We drop the lock here because holding locks during a call to deleteDatabaseFile will deadlock.
-    bool failedToDeleteAnyDatabaseFile = false;
     for (auto& name : databaseNames) {
-        if (fileExists(fullPathForDatabase(origin, name, false)) && !deleteDatabaseFile(origin, name, deletionMode)) {
+        if (!deleteDatabaseFile(origin, name, deletionMode)) {
             // Even if the file can't be deleted, we want to try and delete the rest, don't return early here.
             LOG_ERROR("Unable to delete file for database %s in origin %s", name.utf8().data(), origin.databaseIdentifier().utf8().data());
-            failedToDeleteAnyDatabaseFile = true;
         }
     }
 
-    // If we failed to delete any database file, don't remove the origin from the tracker
-    // database because we didn't successfully remove all of its data.
-    if (failedToDeleteAnyDatabaseFile) {
-        RELEASE_LOG_ERROR(DatabaseTracker, "Failed to delete database for origin");
-        return false;
-    }
-
     {
         LockHolder lockDatabase(m_databaseGuard);
         deleteOriginLockFor(origin);
@@ -1045,7 +1031,7 @@ bool DatabaseTracker::deleteDatabase(const SecurityOriginData& origin, const Str
     }
 
     // We drop the lock here because holding locks during a call to deleteDatabaseFile will deadlock.
-    if (fileExists(fullPathForDatabase(origin, name, false)) && !deleteDatabaseFile(origin, name, DeletionMode::Default)) {
+    if (!deleteDatabaseFile(origin, name, DeletionMode::Default)) {
         LOG_ERROR("Unable to delete file for database %s in origin %s", name.utf8().data(), origin.databaseIdentifier().utf8().data());
         LockHolder lockDatabase(m_databaseGuard);
         doneDeletingDatabase(origin, name);
index a55b7dc..af6cb5b 100644 (file)
@@ -69,7 +69,7 @@ public:
     ExceptionOr<void> retryCanEstablishDatabase(DatabaseContext&, const String& name, unsigned estimatedSize);
 
     void setDatabaseDetails(const SecurityOriginData&, const String& name, const String& displayName, unsigned estimatedSize);
-    WEBCORE_TESTSUPPORT_EXPORT String fullPathForDatabase(const SecurityOriginData&, const String& name, bool createIfDoesNotExist);
+    String fullPathForDatabase(const SecurityOriginData&, const String& name, bool createIfDoesNotExist);
 
     void addOpenDatabase(Database&);
     void removeOpenDatabase(Database&);
index 06090cd..80bd97e 100644 (file)
@@ -42,7 +42,6 @@ namespace WebCore {
     M(Archives) \
     M(Compositing) \
     M(ContentFiltering) \
-    M(DatabaseTracker) \
     M(DisplayLists) \
     M(DOMTimers) \
     M(Editing) \