Diff
Modified: trunk/Source/WebCore/ChangeLog (192947 => 192948)
--- trunk/Source/WebCore/ChangeLog 2015-12-02 19:04:07 UTC (rev 192947)
+++ trunk/Source/WebCore/ChangeLog 2015-12-02 19:13:02 UTC (rev 192948)
@@ -1,3 +1,78 @@
+2015-12-02 Brady Eidson <[email protected]>
+
+ Modern IDB: Get rid of IDBExceptionCode.
+ https://bugs.webkit.org/show_bug.cgi?id=151753
+
+ Reviewed by Alex Christensen.
+
+ No new tests (No change in behavior).
+
+ * Modules/indexeddb/client/IDBIndexImpl.cpp:
+ (WebCore::IDBClient::IDBIndex::count):
+ (WebCore::IDBClient::IDBIndex::doCount):
+ (WebCore::IDBClient::IDBIndex::get):
+ (WebCore::IDBClient::IDBIndex::doGet):
+ (WebCore::IDBClient::IDBIndex::getKey):
+ (WebCore::IDBClient::IDBIndex::doGetKey):
+
+ * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
+ (WebCore::IDBClient::IDBObjectStore::get):
+ (WebCore::IDBClient::IDBObjectStore::deleteFunction):
+ (WebCore::IDBClient::IDBObjectStore::clear):
+ (WebCore::IDBClient::IDBObjectStore::createIndex):
+ (WebCore::IDBClient::IDBObjectStore::index):
+ (WebCore::IDBClient::IDBObjectStore::deleteIndex):
+ (WebCore::IDBClient::IDBObjectStore::count):
+ (WebCore::IDBClient::IDBObjectStore::doCount):
+
+ * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
+ (WebCore::IDBClient::IDBOpenDBRequest::fireErrorAfterVersionChangeAbort):
+
+ * Modules/indexeddb/client/IDBTransactionImpl.cpp:
+ (WebCore::IDBClient::IDBTransaction::abortOnServerAndCancelRequests):
+
+ * Modules/indexeddb/server/IndexValueStore.cpp:
+ (WebCore::IDBServer::IndexValueStore::addRecord):
+
+ * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
+ (WebCore::IDBServer::MemoryIDBBackingStore::beginTransaction):
+ (WebCore::IDBServer::MemoryIDBBackingStore::abortTransaction):
+ (WebCore::IDBServer::MemoryIDBBackingStore::commitTransaction):
+ (WebCore::IDBServer::MemoryIDBBackingStore::createObjectStore):
+ (WebCore::IDBServer::MemoryIDBBackingStore::deleteObjectStore):
+ (WebCore::IDBServer::MemoryIDBBackingStore::clearObjectStore):
+ (WebCore::IDBServer::MemoryIDBBackingStore::createIndex):
+ (WebCore::IDBServer::MemoryIDBBackingStore::deleteIndex):
+ (WebCore::IDBServer::MemoryIDBBackingStore::deleteRange):
+ (WebCore::IDBServer::MemoryIDBBackingStore::addRecord):
+ (WebCore::IDBServer::MemoryIDBBackingStore::getRecord):
+ (WebCore::IDBServer::MemoryIDBBackingStore::getIndexRecord):
+ (WebCore::IDBServer::MemoryIDBBackingStore::getCount):
+ (WebCore::IDBServer::MemoryIDBBackingStore::openCursor):
+ (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor):
+
+ * Modules/indexeddb/server/MemoryIndex.cpp:
+ (WebCore::IDBServer::MemoryIndex::putIndexKey):
+
+ * Modules/indexeddb/server/MemoryObjectStore.cpp:
+ (WebCore::IDBServer::MemoryObjectStore::createIndex):
+ (WebCore::IDBServer::MemoryObjectStore::deleteIndex):
+
+ * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabase::handleOpenDatabaseOperations):
+ (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
+
+ * Modules/indexeddb/shared/IDBError.cpp:
+ (WebCore::IDBError::IDBError):
+ (WebCore::IDBError::name):
+ (WebCore::IDBError::message):
+ (WebCore::idbErrorName): Deleted.
+ (WebCore::idbErrorDescription): Deleted.
+
+ * Modules/indexeddb/shared/IDBError.h:
+ (WebCore::IDBError::code):
+ (WebCore::IDBError::isNull):
+
2015-12-02 Jiewen Tan <[email protected]>
Null dereference loading Blink layout test fast/loader/unload-mutation-crash.html
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp (192947 => 192948)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp 2015-12-02 19:04:07 UTC (rev 192947)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp 2015-12-02 19:13:02 UTC (rev 192948)
@@ -162,7 +162,7 @@
DOMRequestState requestState(context);
RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
if (!idbKey || idbKey->type() == KeyType::Invalid) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::DataError);
return nullptr;
}
@@ -177,13 +177,13 @@
}
if (range.isNull) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::DataError);
return nullptr;
}
auto& transaction = m_objectStore->modernTransaction();
if (!transaction.isActive()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::TransactionInactiveError);
return nullptr;
}
@@ -247,7 +247,7 @@
DOMRequestState requestState(context);
RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
if (!idbKey || idbKey->type() == KeyType::Invalid) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::DataError);
return nullptr;
}
@@ -262,13 +262,13 @@
}
if (range.isNull) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::DataError);
return nullptr;
}
auto& transaction = m_objectStore->modernTransaction();
if (!transaction.isActive()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::TransactionInactiveError);
return nullptr;
}
@@ -299,7 +299,7 @@
DOMRequestState requestState(context);
RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
if (!idbKey || idbKey->type() == KeyType::Invalid) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::DataError);
return nullptr;
}
@@ -314,13 +314,13 @@
}
if (range.isNull) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::DataError);
return nullptr;
}
auto& transaction = m_objectStore->modernTransaction();
if (!transaction.isActive()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::TransactionInactiveError);
return nullptr;
}
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp (192947 => 192948)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp 2015-12-02 19:04:07 UTC (rev 192947)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp 2015-12-02 19:13:02 UTC (rev 192948)
@@ -152,7 +152,7 @@
}
if (!m_transaction->isActive()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::TransactionInactiveError);
return nullptr;
}
@@ -164,7 +164,7 @@
DOMRequestState requestState(context);
RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
if (!idbKey || idbKey->type() == KeyType::Invalid) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::DataError);
return nullptr;
}
@@ -182,7 +182,7 @@
}
if (!m_transaction->isActive()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::TransactionInactiveError);
return nullptr;
}
@@ -193,7 +193,7 @@
IDBKeyRangeData keyRangeData(keyRange);
if (!keyRangeData.isValid()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::DataError);
return nullptr;
}
@@ -315,12 +315,12 @@
LOG(IndexedDB, "IDBObjectStore::deleteFunction");
if (m_transaction->isReadOnly()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::ReadOnlyError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::ReadOnlyError);
return nullptr;
}
if (!m_transaction->isActive()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::TransactionInactiveError);
return nullptr;
}
@@ -331,7 +331,7 @@
IDBKeyRangeData keyRangeData(keyRange);
if (!keyRangeData.isValid()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::DataError);
return nullptr;
}
@@ -349,7 +349,7 @@
DOMRequestState requestState(context);
RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
if (!idbKey || idbKey->type() == KeyType::Invalid) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::DataError);
return nullptr;
}
@@ -361,17 +361,17 @@
LOG(IndexedDB, "IDBObjectStore::clear");
if (m_transaction->isReadOnly()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::ReadOnlyError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::ReadOnlyError);
return nullptr;
}
if (!m_transaction->isActive()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::TransactionInactiveError);
return nullptr;
}
if (m_deleted) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::InvalidStateError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::InvalidStateError);
return nullptr;
}
@@ -389,17 +389,17 @@
}
if (m_deleted) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::InvalidStateError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::InvalidStateError);
return nullptr;
}
if (!m_transaction->isVersionChange()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::InvalidStateError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::InvalidStateError);
return nullptr;
}
if (!m_transaction->isActive()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::TransactionInactiveError);
return nullptr;
}
@@ -449,7 +449,7 @@
}
if (!m_transaction->isActive()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::TransactionInactiveError);
return nullptr;
}
@@ -474,17 +474,17 @@
LOG(IndexedDB, "IDBObjectStore::deleteIndex %s", name.utf8().data());
if (m_deleted) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::InvalidStateError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::InvalidStateError);
return;
}
if (!m_transaction->isVersionChange()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::InvalidStateError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::InvalidStateError);
return;
}
if (!m_transaction->isActive()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::TransactionInactiveError);
return;
}
@@ -531,7 +531,7 @@
DOMRequestState requestState(context);
RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
if (!idbKey || idbKey->type() == KeyType::Invalid) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::DataError);
return nullptr;
}
@@ -553,7 +553,7 @@
RefPtr<WebCore::IDBRequest> IDBObjectStore::doCount(ScriptExecutionContext& context, const IDBKeyRangeData& range, ExceptionCode& ec)
{
if (!m_transaction->isActive()) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::TransactionInactiveError);
return nullptr;
}
@@ -563,7 +563,7 @@
}
if (range.isNull) {
- ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+ ec = static_cast<ExceptionCode>(IDBDatabaseException::DataError);
return nullptr;
}
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp (192947 => 192948)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp 2015-12-02 19:04:07 UTC (rev 192947)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp 2015-12-02 19:13:02 UTC (rev 192948)
@@ -92,7 +92,7 @@
ASSERT(hasPendingActivity());
- IDBError idbError(IDBExceptionCode::AbortError);
+ IDBError idbError(IDBDatabaseException::AbortError);
m_domError = DOMError::create(idbError.name());
m_transaction->addRequest(*this);
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp (192947 => 192948)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp 2015-12-02 19:04:07 UTC (rev 192947)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp 2015-12-02 19:13:02 UTC (rev 192948)
@@ -196,7 +196,7 @@
serverConnection().abortTransaction(*this);
- IDBError error(IDBExceptionCode::AbortError);
+ IDBError error(IDBDatabaseException::AbortError);
for (auto& operation : m_abortQueue)
operation->completed(IDBResultData::error(operation->identifier(), error));
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp (192947 => 192948)
--- trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp 2015-12-02 19:04:07 UTC (rev 192947)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp 2015-12-02 19:13:02 UTC (rev 192948)
@@ -75,7 +75,7 @@
auto result = m_records.add(indexKey, nullptr);
if (!result.isNewEntry && m_unique)
- return IDBError(IDBExceptionCode::ConstraintError);
+ return IDBError(IDBDatabaseException::ConstraintError);
if (result.isNewEntry)
result.iterator->value = std::make_unique<IndexValueEntry>(m_unique);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp (192947 => 192948)
--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp 2015-12-02 19:04:07 UTC (rev 192947)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp 2015-12-02 19:13:02 UTC (rev 192948)
@@ -73,7 +73,7 @@
LOG(IndexedDB, "MemoryIDBBackingStore::beginTransaction");
if (m_transactions.contains(info.identifier()))
- return IDBError(IDBExceptionCode::InvalidStateError, "Backing store asked to create transaction it already has a record of");
+ return IDBError(IDBDatabaseException::InvalidStateError, "Backing store asked to create transaction it already has a record of");
auto transaction = MemoryBackingStoreTransaction::create(*this, info);
@@ -99,7 +99,7 @@
auto transaction = m_transactions.take(transactionIdentifier);
if (!transaction)
- return IDBError(IDBExceptionCode::InvalidStateError, "Backing store asked to abort transaction it didn't have record of");
+ return IDBError(IDBDatabaseException::InvalidStateError, "Backing store asked to abort transaction it didn't have record of");
transaction->abort();
@@ -112,7 +112,7 @@
auto transaction = m_transactions.take(transactionIdentifier);
if (!transaction)
- return IDBError(IDBExceptionCode::InvalidStateError, "Backing store asked to commit transaction it didn't have record of");
+ return IDBError(IDBDatabaseException::InvalidStateError, "Backing store asked to commit transaction it didn't have record of");
transaction->commit();
@@ -125,7 +125,7 @@
ASSERT(m_databaseInfo);
if (m_databaseInfo->hasObjectStore(info.name()))
- return IDBError(IDBExceptionCode::ConstraintError);
+ return IDBError(IDBDatabaseException::ConstraintError);
ASSERT(!m_objectStoresByIdentifier.contains(info.identifier()));
auto objectStore = MemoryObjectStore::create(info);
@@ -148,7 +148,7 @@
ASSERT(m_databaseInfo);
if (!m_databaseInfo->hasObjectStore(objectStoreName))
- return IDBError(IDBExceptionCode::ConstraintError);
+ return IDBError(IDBDatabaseException::ConstraintError);
auto transaction = m_transactions.get(transactionIdentifier);
ASSERT(transaction);
@@ -157,7 +157,7 @@
auto objectStore = takeObjectStoreByName(objectStoreName);
ASSERT(objectStore);
if (!objectStore)
- return IDBError(IDBExceptionCode::ConstraintError);
+ return IDBError(IDBDatabaseException::ConstraintError);
m_databaseInfo->deleteObjectStore(objectStoreName);
transaction->objectStoreDeleted(WTF::move(objectStore));
@@ -179,7 +179,7 @@
auto objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
if (!objectStore)
- return IDBError(IDBExceptionCode::ConstraintError);
+ return IDBError(IDBDatabaseException::ConstraintError);
objectStore->clear();
@@ -196,7 +196,7 @@
auto* objectStore = m_objectStoresByIdentifier.get(info.objectStoreIdentifier());
if (!objectStore)
- return IDBError(IDBExceptionCode::ConstraintError);
+ return IDBError(IDBDatabaseException::ConstraintError);
return objectStore->createIndex(*rawTransaction, info);
}
@@ -211,7 +211,7 @@
auto* objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
if (!objectStore)
- return IDBError(IDBExceptionCode::ConstraintError);
+ return IDBError(IDBDatabaseException::ConstraintError);
return objectStore->deleteIndex(*rawTransaction, indexName);
}
@@ -251,11 +251,11 @@
ASSERT(objectStoreIdentifier);
if (!m_transactions.contains(transactionIdentifier))
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store transaction found to delete from"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store transaction found to delete from"));
MemoryObjectStore* objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
if (!objectStore)
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store object store found"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store object store found"));
objectStore->deleteRange(range);
return IDBError();
@@ -269,11 +269,11 @@
auto transaction = m_transactions.get(transactionIdentifier);
if (!transaction)
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store transaction found to put record"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store transaction found to put record"));
MemoryObjectStore* objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
if (!objectStore)
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store object store found to put record"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store object store found to put record"));
return objectStore->addRecord(*transaction, keyData, value);
}
@@ -285,11 +285,11 @@
ASSERT(objectStoreIdentifier);
if (!m_transactions.contains(transactionIdentifier))
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store transaction found to get record"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store transaction found to get record"));
MemoryObjectStore* objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
if (!objectStore)
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store object store found"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store object store found"));
outValue = objectStore->valueForKeyRange(range);
return IDBError();
@@ -302,11 +302,11 @@
ASSERT(objectStoreIdentifier);
if (!m_transactions.contains(transactionIdentifier))
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store transaction found to get record"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store transaction found to get record"));
MemoryObjectStore* objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
if (!objectStore)
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store object store found"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store object store found"));
outValue = objectStore->indexValueForKeyRange(indexIdentifier, recordType, range);
return IDBError();
@@ -319,11 +319,11 @@
ASSERT(objectStoreIdentifier);
if (!m_transactions.contains(transactionIdentifier))
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store transaction found to get count"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store transaction found to get count"));
MemoryObjectStore* objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
if (!objectStore)
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store object store found"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store object store found"));
outCount = objectStore->countForKeyRange(indexIdentifier, range);
@@ -353,17 +353,17 @@
ASSERT(!MemoryCursor::cursorForIdentifier(info.identifier()));
if (!m_transactions.contains(transactionIdentifier))
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store transaction found in which to open a cursor"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store transaction found in which to open a cursor"));
switch (info.cursorSource()) {
case IndexedDB::CursorSource::ObjectStore: {
auto* objectStore = m_objectStoresByIdentifier.get(info.sourceIdentifier());
if (!objectStore)
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store object store found"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store object store found"));
MemoryCursor* cursor = objectStore->maybeOpenCursor(info);
if (!cursor)
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("Could not create object store cursor in backing store"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("Could not create object store cursor in backing store"));
cursor->currentData(outData);
break;
@@ -371,15 +371,15 @@
case IndexedDB::CursorSource::Index:
auto* objectStore = m_objectStoresByIdentifier.get(info.objectStoreIdentifier());
if (!objectStore)
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store object store found"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store object store found"));
auto* index = objectStore->indexForIdentifier(info.sourceIdentifier());
if (!index)
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store index found"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store index found"));
MemoryCursor* cursor = index->maybeOpenCursor(info);
if (!cursor)
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("Could not create index cursor in backing store"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("Could not create index cursor in backing store"));
cursor->currentData(outData);
break;
@@ -393,11 +393,11 @@
LOG(IndexedDB, "MemoryIDBBackingStore::iterateCursor");
if (!m_transactions.contains(transactionIdentifier))
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store transaction found in which to iterate cursor"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store transaction found in which to iterate cursor"));
auto* cursor = MemoryCursor::cursorForIdentifier(cursorIdentifier);
if (!cursor)
- return IDBError(IDBExceptionCode::Unknown, ASCIILiteral("No backing store cursor found in which to iterate cursor"));
+ return IDBError(IDBDatabaseException::UnknownError, ASCIILiteral("No backing store cursor found in which to iterate cursor"));
cursor->iterate(key, count, outData);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp (192947 => 192948)
--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp 2015-12-02 19:04:07 UTC (rev 192947)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp 2015-12-02 19:13:02 UTC (rev 192948)
@@ -177,7 +177,7 @@
if (m_info.unique()) {
for (auto& key : keys) {
if (m_records->contains(key))
- return IDBError(IDBExceptionCode::ConstraintError);
+ return IDBError(IDBDatabaseException::ConstraintError);
}
}
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp (192947 => 192948)
--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp 2015-12-02 19:04:07 UTC (rev 192947)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp 2015-12-02 19:13:02 UTC (rev 192948)
@@ -86,7 +86,7 @@
LOG(IndexedDB, "MemoryObjectStore::createIndex");
if (!m_writeTransaction || !m_writeTransaction->isVersionChange() || m_writeTransaction != &transaction)
- return IDBError(IDBExceptionCode::ConstraintError);
+ return IDBError(IDBDatabaseException::ConstraintError);
ASSERT(!m_indexesByIdentifier.contains(info.identifier()));
auto index = MemoryIndex::create(info, *this);
@@ -143,12 +143,12 @@
LOG(IndexedDB, "MemoryObjectStore::deleteIndex");
if (!m_writeTransaction || !m_writeTransaction->isVersionChange() || m_writeTransaction != &transaction)
- return IDBError(IDBExceptionCode::ConstraintError);
+ return IDBError(IDBDatabaseException::ConstraintError);
auto index = takeIndexByName(indexName);
ASSERT(index);
if (!index)
- return IDBError(IDBExceptionCode::ConstraintError);
+ return IDBError(IDBDatabaseException::ConstraintError);
m_info.deleteIndex(indexName);
transaction.indexDeleted(WTF::move(index));
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (192947 => 192948)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2015-12-02 19:04:07 UTC (rev 192947)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2015-12-02 19:13:02 UTC (rev 192948)
@@ -134,7 +134,7 @@
// 3.3.1 Opening a database
// If the database version higher than the requested version, abort these steps and return a VersionError.
if (requestedVersion < m_databaseInfo->version()) {
- auto result = IDBResultData::error(operation->requestData().requestIdentifier(), IDBError(IDBExceptionCode::VersionError));
+ auto result = IDBResultData::error(operation->requestData().requestIdentifier(), IDBError(IDBDatabaseException::VersionError));
operation->connection().didOpenDatabase(result);
return;
}
@@ -512,7 +512,7 @@
auto objectStoreInfo = m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier);
if (!objectStoreInfo) {
- error = IDBError(IDBExceptionCode::InvalidStateError, ASCIILiteral("Object store cannot be found in the backing store"));
+ error = IDBError(IDBDatabaseException::InvalidStateError, ASCIILiteral("Object store cannot be found in the backing store"));
m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey));
return;
}
@@ -535,7 +535,7 @@
bool keyExists;
error = m_backingStore->keyExistsInObjectStore(transactionIdentifier, objectStoreIdentifier, usedKey, keyExists);
if (error.isNull() && keyExists)
- error = IDBError(IDBExceptionCode::ConstraintError, ASCIILiteral("Key already exists in the object store"));
+ error = IDBError(IDBDatabaseException::ConstraintError, ASCIILiteral("Key already exists in the object store"));
if (!error.isNull()) {
m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey));
@@ -552,18 +552,18 @@
JSValue value = deserializeIDBValueDataToJSValue(databaseThreadExecState(), originalRecordValue);
if (value.isUndefined()) {
- m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, IDBError(IDBExceptionCode::ConstraintError, ASCIILiteral("Unable to deserialize record value for record key injection")), usedKey));
+ m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, IDBError(IDBDatabaseException::ConstraintError, ASCIILiteral("Unable to deserialize record value for record key injection")), usedKey));
return;
}
if (!injectIDBKeyIntoScriptValue(databaseThreadExecState(), usedKey, value, objectStoreInfo->keyPath())) {
- m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, IDBError(IDBExceptionCode::ConstraintError, ASCIILiteral("Unable to inject record key into record value")), usedKey));
+ m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, IDBError(IDBDatabaseException::ConstraintError, ASCIILiteral("Unable to inject record key into record value")), usedKey));
return;
}
auto serializedValue = SerializedScriptValue::create(&databaseThreadExecState(), value, nullptr, nullptr);
if (databaseThreadExecState().hadException()) {
- m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, IDBError(IDBExceptionCode::ConstraintError, ASCIILiteral("Unable to serialize record value after injecting record key")), usedKey));
+ m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, IDBError(IDBDatabaseException::ConstraintError, ASCIILiteral("Unable to serialize record value after injecting record key")), usedKey));
return;
}
Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.cpp (192947 => 192948)
--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.cpp 2015-12-02 19:04:07 UTC (rev 192947)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.cpp 2015-12-02 19:13:02 UTC (rev 192948)
@@ -32,104 +32,12 @@
namespace WebCore {
-static const String& idbErrorName(IDBExceptionCode code)
-{
- switch (code) {
- case IDBExceptionCode::Unknown: {
- static NeverDestroyed<String> entry = ASCIILiteral("UnknownError");
- return entry;
- }
- case IDBExceptionCode::ConstraintError: {
- static NeverDestroyed<String> entry = ASCIILiteral("ConstraintError");
- return entry;
- }
- case IDBExceptionCode::VersionError: {
- static NeverDestroyed<String> entry = ASCIILiteral("VersionError");
- return entry;
- }
- case IDBExceptionCode::InvalidStateError: {
- static NeverDestroyed<String> entry = ASCIILiteral("InvalidStateError");
- return entry;
- }
- case IDBExceptionCode::DataError: {
- static NeverDestroyed<String> entry = ASCIILiteral("DataError");
- return entry;
- }
- case IDBExceptionCode::TransactionInactiveError: {
- static NeverDestroyed<String> entry = ASCIILiteral("TransactionInactiveError");
- return entry;
- }
- case IDBExceptionCode::ReadOnlyError: {
- static NeverDestroyed<String> entry = ASCIILiteral("ReadOnlyError");
- return entry;
- }
- case IDBExceptionCode::DataCloneError: {
- static NeverDestroyed<String> entry = ASCIILiteral("DataCloneError");
- return entry;
- }
- case IDBExceptionCode::AbortError: {
- static NeverDestroyed<String> entry = ASCIILiteral("AbortError");
- return entry;
- }
- case IDBExceptionCode::None:
- RELEASE_ASSERT_NOT_REACHED();
- }
-
- RELEASE_ASSERT_NOT_REACHED();
-}
-
-static const String& idbErrorDescription(IDBExceptionCode code)
-{
- switch (code) {
- case IDBExceptionCode::Unknown: {
- static NeverDestroyed<String> entry = ASCIILiteral("Operation failed for reasons unrelated to the database itself and not covered by any other errors.");
- return entry.get();
- }
- case IDBExceptionCode::ConstraintError: {
- static NeverDestroyed<String> entry = ASCIILiteral("Mutation operation in the transaction failed because a constraint was not satisfied.");
- return entry.get();
- }
- case IDBExceptionCode::VersionError: {
- static NeverDestroyed<String> entry = ASCIILiteral("An attempt was made to open a database using a lower version than the existing version.");
- return entry.get();
- }
- case IDBExceptionCode::InvalidStateError: {
- static NeverDestroyed<String> entry = ASCIILiteral("Operation was called on an object on which it is not allowed or at a time when it is not allowed.");
- return entry;
- }
- case IDBExceptionCode::DataError: {
- static NeverDestroyed<String> entry = ASCIILiteral("Data provided to an operation does not meet requirements.");
- return entry;
- }
- case IDBExceptionCode::TransactionInactiveError: {
- static NeverDestroyed<String> entry = ASCIILiteral("Request was placed against a transaction which is currently not active, or which is finished.");
- return entry;
- }
- case IDBExceptionCode::ReadOnlyError: {
- static NeverDestroyed<String> entry = ASCIILiteral("A mutating operation was attempted in a \"readonly\" transaction.");
- return entry;
- }
- case IDBExceptionCode::DataCloneError: {
- static NeverDestroyed<String> entry = ASCIILiteral("Data being stored could not be cloned by the structured cloning algorithm.");
- return entry;
- }
- case IDBExceptionCode::AbortError: {
- static NeverDestroyed<String> entry = ASCIILiteral("Transaction was aborted");
- return entry;
- }
- case IDBExceptionCode::None:
- RELEASE_ASSERT_NOT_REACHED();
- }
-
- RELEASE_ASSERT_NOT_REACHED();
-}
-
-IDBError::IDBError(IDBExceptionCode code)
+IDBError::IDBError(ExceptionCode code)
: IDBError(code, emptyString())
{
}
-IDBError::IDBError(IDBExceptionCode code, const String& message)
+IDBError::IDBError(ExceptionCode code, const String& message)
: m_code(code)
, m_message(message)
{
@@ -147,17 +55,14 @@
return *this;
}
-const String& IDBError::name() const
+String IDBError::name() const
{
- return idbErrorName(m_code);
+ return IDBDatabaseException::getErrorName(m_code);
}
-const String& IDBError::message() const
+String IDBError::message() const
{
- if (!m_message.isEmpty())
- return m_message;
-
- return idbErrorDescription(m_code);
+ return IDBDatabaseException::getErrorDescription(m_code);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.h (192947 => 192948)
--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.h 2015-12-02 19:04:07 UTC (rev 192947)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.h 2015-12-02 19:13:02 UTC (rev 192948)
@@ -28,44 +28,29 @@
#if ENABLE(INDEXED_DATABASE)
+#include "IDBDatabaseException.h"
#include <wtf/text/WTFString.h>
namespace WebCore {
-static const int IDBExceptionCodeOffset = 1200;
-
-enum class IDBExceptionCode {
- None = IDBExceptionCodeOffset,
- Unknown,
- ConstraintError,
- DataError,
- TransactionInactiveError,
- ReadOnlyError,
- VersionError,
-
- // Indexed DB existing exception codes with IDB-specific error messages:
- InvalidStateError,
- DataCloneError,
- AbortError,
-};
-
class IDBError {
public:
IDBError() { }
- IDBError(IDBExceptionCode);
- IDBError(IDBExceptionCode, const String& message);
+ IDBError(ExceptionCode);
+ IDBError(ExceptionCode, const String& message);
IDBError& operator=(const IDBError&);
- const String& name() const;
- const String& message() const;
+ ExceptionCode code() const { return m_code; }
+ String name() const;
+ String message() const;
- bool isNull() const { return m_code == IDBExceptionCode::None; }
+ bool isNull() const { return m_code == IDBDatabaseException::NoError; }
IDBError isolatedCopy() const;
private:
- IDBExceptionCode m_code { IDBExceptionCode::None };
+ ExceptionCode m_code { IDBDatabaseException::NoError };
String m_message;
};