| Index: content/browser/indexed_db/indexed_db_database.cc
|
| diff --git a/content/browser/indexed_db/indexed_db_database.cc b/content/browser/indexed_db/indexed_db_database.cc
|
| index 839d7af3fc197172f65c9aebbd24ba607cf1d4d6..c97048b5612094eb54796602bc067543d9ac3515 100644
|
| --- a/content/browser/indexed_db/indexed_db_database.cc
|
| +++ b/content/browser/indexed_db/indexed_db_database.cc
|
| @@ -14,6 +14,7 @@
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "content/browser/indexed_db/indexed_db_connection.h"
|
| +#include "content/browser/indexed_db/indexed_db_context_impl.h"
|
| #include "content/browser/indexed_db/indexed_db_cursor.h"
|
| #include "content/browser/indexed_db/indexed_db_factory.h"
|
| #include "content/browser/indexed_db/indexed_db_index_writer.h"
|
| @@ -294,17 +295,22 @@ void IndexedDBDatabase::CreateObjectStoreOperation(
|
| const IndexedDBObjectStoreMetadata& object_store_metadata,
|
| IndexedDBTransaction* transaction) {
|
| IDB_TRACE("IndexedDBDatabase::CreateObjectStoreOperation");
|
| - if (!backing_store_->CreateObjectStore(
|
| - transaction->BackingStoreTransaction(),
|
| - transaction->database()->id(),
|
| - object_store_metadata.id,
|
| - object_store_metadata.name,
|
| - object_store_metadata.key_path,
|
| - object_store_metadata.auto_increment).ok()) {
|
| - transaction->Abort(IndexedDBDatabaseError(
|
| + leveldb::Status s =
|
| + backing_store_->CreateObjectStore(transaction->BackingStoreTransaction(),
|
| + transaction->database()->id(),
|
| + object_store_metadata.id,
|
| + object_store_metadata.name,
|
| + object_store_metadata.key_path,
|
| + object_store_metadata.auto_increment);
|
| + if (!s.ok()) {
|
| + IndexedDBDatabaseError error(
|
| blink::WebIDBDatabaseExceptionUnknownError,
|
| ASCIIToUTF16("Internal error creating object store '") +
|
| - object_store_metadata.name + ASCIIToUTF16("'.")));
|
| + object_store_metadata.name + ASCIIToUTF16("'."));
|
| + transaction->Abort(error);
|
| + if (s.IsCorruption())
|
| + factory_->HandleBackingStoreCorruption(backing_store_->origin_url(),
|
| + error);
|
| return;
|
| }
|
| }
|
| @@ -436,8 +442,12 @@ void IndexedDBDatabase::DeleteIndexOperation(
|
| base::string16 error_string =
|
| ASCIIToUTF16("Internal error deleting index '") +
|
| index_metadata.name + ASCIIToUTF16("'.");
|
| - transaction->Abort(IndexedDBDatabaseError(
|
| - blink::WebIDBDatabaseExceptionUnknownError, error_string));
|
| + IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError,
|
| + error_string);
|
| + transaction->Abort(error);
|
| + if (s.IsCorruption())
|
| + factory_->HandleBackingStoreCorruption(backing_store_->origin_url(),
|
| + error);
|
| }
|
| }
|
|
|
| @@ -569,9 +579,13 @@ void IndexedDBDatabase::GetOperation(
|
| *key,
|
| &value);
|
| if (!s.ok()) {
|
| - callbacks->OnError(
|
| - IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError,
|
| - "Internal error in GetRecord."));
|
| + IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError,
|
| + "Internal error in GetRecord.");
|
| + callbacks->OnError(error);
|
| +
|
| + if (s.IsCorruption())
|
| + factory_->HandleBackingStoreCorruption(backing_store_->origin_url(),
|
| + error);
|
| return;
|
| }
|
|
|
| @@ -599,9 +613,12 @@ void IndexedDBDatabase::GetOperation(
|
| *key,
|
| &primary_key);
|
| if (!s.ok()) {
|
| - callbacks->OnError(
|
| - IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError,
|
| - "Internal error in GetPrimaryKeyViaIndex."));
|
| + IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError,
|
| + "Internal error in GetPrimaryKeyViaIndex.");
|
| + callbacks->OnError(error);
|
| + if (s.IsCorruption())
|
| + factory_->HandleBackingStoreCorruption(backing_store_->origin_url(),
|
| + error);
|
| return;
|
| }
|
| if (!primary_key) {
|
| @@ -622,9 +639,12 @@ void IndexedDBDatabase::GetOperation(
|
| *primary_key,
|
| &value);
|
| if (!s.ok()) {
|
| - callbacks->OnError(
|
| - IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError,
|
| - "Internal error in GetRecord."));
|
| + IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError,
|
| + "Internal error in GetRecord.");
|
| + callbacks->OnError(error);
|
| + if (s.IsCorruption())
|
| + factory_->HandleBackingStoreCorruption(backing_store_->origin_url(),
|
| + error);
|
| return;
|
| }
|
|
|
| @@ -761,9 +781,12 @@ void IndexedDBDatabase::PutOperation(scoped_ptr<PutOperationParams> params,
|
| &record_identifier,
|
| &found);
|
| if (!s.ok()) {
|
| - params->callbacks->OnError(
|
| - IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError,
|
| - "Internal error checking key existence."));
|
| + IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError,
|
| + "Internal error checking key existence.");
|
| + params->callbacks->OnError(error);
|
| + if (s.IsCorruption())
|
| + factory_->HandleBackingStoreCorruption(backing_store_->origin_url(),
|
| + error);
|
| return;
|
| }
|
| if (found) {
|
| @@ -809,9 +832,13 @@ void IndexedDBDatabase::PutOperation(scoped_ptr<PutOperationParams> params,
|
| params->value,
|
| &record_identifier);
|
| if (!s.ok()) {
|
| - params->callbacks->OnError(IndexedDBDatabaseError(
|
| + IndexedDBDatabaseError error(
|
| blink::WebIDBDatabaseExceptionUnknownError,
|
| - "Internal error: backing store error performing put/add."));
|
| + "Internal error: backing store error performing put/add.");
|
| + params->callbacks->OnError(error);
|
| + if (s.IsCorruption())
|
| + factory_->HandleBackingStoreCorruption(backing_store_->origin_url(),
|
| + error);
|
| return;
|
| }
|
|
|
| @@ -834,9 +861,12 @@ void IndexedDBDatabase::PutOperation(scoped_ptr<PutOperationParams> params,
|
| *key,
|
| !key_was_generated);
|
| if (!s.ok()) {
|
| - params->callbacks->OnError(
|
| - IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError,
|
| - "Internal error updating key generator."));
|
| + IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError,
|
| + "Internal error updating key generator.");
|
| + params->callbacks->OnError(error);
|
| + if (s.IsCorruption())
|
| + factory_->HandleBackingStoreCorruption(backing_store_->origin_url(),
|
| + error);
|
| return;
|
| }
|
| }
|
| @@ -866,9 +896,12 @@ void IndexedDBDatabase::SetIndexKeys(int64 transaction_id,
|
| &record_identifier,
|
| &found);
|
| if (!s.ok()) {
|
| - transaction->Abort(
|
| - IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError,
|
| - "Internal error setting index keys."));
|
| + IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError,
|
| + "Internal error setting index keys.");
|
| + transaction->Abort(error);
|
| + if (s.IsCorruption())
|
| + factory_->HandleBackingStoreCorruption(backing_store_->origin_url(),
|
| + error);
|
| return;
|
| }
|
| if (!found) {
|
| @@ -1206,8 +1239,12 @@ void IndexedDBDatabase::DeleteObjectStoreOperation(
|
| base::string16 error_string =
|
| ASCIIToUTF16("Internal error deleting object store '") +
|
| object_store_metadata.name + ASCIIToUTF16("'.");
|
| - transaction->Abort(IndexedDBDatabaseError(
|
| - blink::WebIDBDatabaseExceptionUnknownError, error_string));
|
| + IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError,
|
| + error_string);
|
| + transaction->Abort(error);
|
| + if (s.IsCorruption())
|
| + factory_->HandleBackingStoreCorruption(backing_store_->origin_url(),
|
| + error);
|
| }
|
| }
|
|
|
|
|