Changeset 223423 in webkit


Ignore:
Timestamp:
Oct 16, 2017, 12:21:07 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

We should wrap the removal of information from the tracker database in a transaction in DatabaseTracker::deleteOrigin()
https://bugs.webkit.org/show_bug.cgi?id=178274
<rdar://problem/34576132>

Patch by Maureen Daum <mdaum@apple.com> on 2017-10-16
Reviewed by Tim Horton.

  • Modules/webdatabase/DatabaseTracker.cpp:

(WebCore::DatabaseTracker::deleteOrigin):
Wrap the removal of information from the tracker database in a transaction so that
we don't end up in a case where only one of the tables contains information about
an origin.
If anything goes wrong when we're modifying the tracker database, rollback the transaction
before bailing.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r223420 r223423  
     12017-10-16  Maureen Daum  <mdaum@apple.com>
     2
     3        We should wrap the removal of information from the tracker database in a transaction in DatabaseTracker::deleteOrigin()
     4        https://bugs.webkit.org/show_bug.cgi?id=178274
     5        <rdar://problem/34576132>
     6
     7        Reviewed by Tim Horton.
     8
     9        * Modules/webdatabase/DatabaseTracker.cpp:
     10        (WebCore::DatabaseTracker::deleteOrigin):
     11        Wrap the removal of information from the tracker database in a transaction so that
     12        we don't end up in a case where only one of the tables contains information about
     13        an origin.
     14        If anything goes wrong when we're modifying the tracker database, rollback the transaction
     15        before bailing.
     16
    1172017-10-16  Ryan Haddad  <ryanhaddad@apple.com>
    218
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp

    r223420 r223423  
    4343#include "SQLiteFileSystem.h"
    4444#include "SQLiteStatement.h"
     45#include "SQLiteTransaction.h"
    4546#include <wtf/MainThread.h>
    4647#include <wtf/NeverDestroyed.h>
     
    843844        doneDeletingOrigin(origin);
    844845
     846        SQLiteTransaction transaction(m_database);
     847        transaction.begin();
     848
    845849        SQLiteStatement statement(m_database, "DELETE FROM Databases WHERE origin=?");
    846850        if (statement.prepare() != SQLITE_OK) {
     
    868872            return false;
    869873        }
     874
     875        transaction.commit();
    870876
    871877        SQLiteFileSystem::deleteEmptyDatabaseDirectory(originPath(origin));
Note: See TracChangeset for help on using the changeset viewer.