Backed out changeset caeba7562e49

This commit is contained in:
Dave Camp 2008-06-25 21:17:48 -07:00
Родитель ac34f6f3bb
Коммит b9e199b7f0
2 изменённых файлов: 8 добавлений и 17 удалений

Просмотреть файл

@ -31,7 +31,6 @@ CPPSRCS = \
LOCAL_INCLUDES = \
-I$(srcdir)/../../build \
$(SQLITE_CFLAGS) \
$(NULL)

Просмотреть файл

@ -77,9 +77,6 @@
#include "prnetdb.h"
#include "zlib.h"
// Needed to interpert mozIStorageConnection::GetLastError
#include <sqlite3.h>
/**
* The DBServices stores a set of Fragments. A fragment is one URL
* fragment containing two or more domain components and some number
@ -3059,11 +3056,6 @@ nsUrlClassifierDBServiceWorker::FinishUpdate()
NS_ENSURE_STATE(!mInStream);
NS_ENSURE_STATE(mUpdateObserver);
// We need to get the error code before ApplyUpdate, because it might
// close/open the connection.
PRInt32 errcode = SQLITE_OK;
mConnection->GetLastError(&errcode);
ApplyUpdate();
if (NS_SUCCEEDED(mUpdateStatus)) {
@ -3072,13 +3064,7 @@ nsUrlClassifierDBServiceWorker::FinishUpdate()
mUpdateObserver->UpdateError(mUpdateStatus);
}
// It's important that we only reset the database on an update
// command if the update was successful, otherwise unauthenticated
// updates could cause a database reset.
PRBool resetDB = (NS_SUCCEEDED(mUpdateStatus) && mResetRequested) ||
errcode == SQLITE_CORRUPT;
if (!resetDB) {
if (!mResetRequested) {
if (NS_SUCCEEDED(mUpdateStatus)) {
PRInt64 now = (PR_Now() / PR_USEC_PER_SEC);
for (PRUint32 i = 0; i < mUpdateTables.Length(); i++) {
@ -3093,9 +3079,15 @@ nsUrlClassifierDBServiceWorker::FinishUpdate()
}
}
// ResetUpdate() clears mResetRequested...
PRBool resetRequested = mResetRequested;
ResetUpdate();
if (resetDB) {
// It's important that we only reset the database if the update was
// successful, otherwise unauthenticated updates could cause a
// database reset.
if (NS_SUCCEEDED(mUpdateStatus) && resetRequested) {
ResetDatabase();
}