Diff
Modified: trunk/LayoutTests/ChangeLog (195526 => 195527)
--- trunk/LayoutTests/ChangeLog 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/LayoutTests/ChangeLog 2016-01-25 07:55:17 UTC (rev 195527)
@@ -1,3 +1,12 @@
+2016-01-24 Brady Eidson <beid...@apple.com>
+
+ Modern IDB: Implement deleteIndex and getCount for the SQLite backing store.
+ https://bugs.webkit.org/show_bug.cgi?id=153415
+
+ Reviewed by Darin Adler.
+
+ * platform/mac-wk1/TestExpectations:
+
2016-01-24 Chris Dumez <cdu...@apple.com>
Unreviewed, update test after r195497
Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (195526 => 195527)
--- trunk/LayoutTests/platform/mac-wk1/TestExpectations 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations 2016-01-25 07:55:17 UTC (rev 195527)
@@ -494,7 +494,6 @@
storage/indexeddb/modern/get-keyrange.html [ Failure ]
storage/indexeddb/modern/idbobjectstore-clear-1.html [ Failure ]
storage/indexeddb/modern/idbobjectstore-clear-2.html [ Failure ]
-storage/indexeddb/modern/idbobjectstore-count-1.html [ Failure ]
storage/indexeddb/modern/idbobjectstore-delete-1.html [ Failure ]
storage/indexeddb/modern/index-1.html [ Failure ]
storage/indexeddb/modern/index-2.html [ Failure ]
@@ -504,7 +503,6 @@
storage/indexeddb/modern/index-cursor-2.html [ Failure ]
storage/indexeddb/modern/index-cursor-3.html [ Failure ]
storage/indexeddb/modern/index-get-count-basic.html [ Failure ]
-storage/indexeddb/modern/index-get-count-failures.html [ Failure ]
storage/indexeddb/modern/objectstore-cursor-advance-failures.html [ Failure ]
storage/indexeddb/modern/objectstore-cursor-continue-failures.html [ Failure ]
storage/indexeddb/modern/request-readystate.html [ Failure ]
@@ -530,7 +528,6 @@
storage/indexeddb/objectstore-autoincrement.html [ Failure ]
storage/indexeddb/objectstore-basics.html [ Failure ]
storage/indexeddb/objectstore-clear.html [ Failure ]
-storage/indexeddb/objectstore-count.html [ Failure ]
storage/indexeddb/objectstore-cursor.html [ Failure ]
storage/indexeddb/open-cursor.html [ Failure ]
storage/indexeddb/opencursor-key.html [ Failure ]
Modified: trunk/Source/WebCore/ChangeLog (195526 => 195527)
--- trunk/Source/WebCore/ChangeLog 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/ChangeLog 2016-01-25 07:55:17 UTC (rev 195527)
@@ -1,5 +1,52 @@
2016-01-24 Brady Eidson <beid...@apple.com>
+ Modern IDB: Implement deleteIndex and getCount for the SQLite backing store.
+ https://bugs.webkit.org/show_bug.cgi?id=153415
+
+ Reviewed by Darin Adler.
+
+ No new tests (Handful of tests now pass, improvements on a handful of others).
+
+ * Modules/indexeddb/server/IDBBackingStore.h:
+
+ * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
+ (WebCore::IDBServer::MemoryIDBBackingStore::deleteIndex):
+ * Modules/indexeddb/server/MemoryIDBBackingStore.h:
+
+ * Modules/indexeddb/server/MemoryObjectStore.cpp:
+ (WebCore::IDBServer::MemoryObjectStore::takeIndexByIdentifier):
+ (WebCore::IDBServer::MemoryObjectStore::deleteIndex):
+ (WebCore::IDBServer::MemoryObjectStore::deleteAllIndexes):
+ (WebCore::IDBServer::MemoryObjectStore::takeIndexByName): Deleted.
+ * Modules/indexeddb/server/MemoryObjectStore.h:
+
+ * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
+ (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::getCount):
+ * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
+
+ * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
+ (WebCore::IDBServer::SQLiteIDBCursor::maybeCreateBackingStoreCursor):
+ (WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
+ * Modules/indexeddb/server/SQLiteIDBCursor.h:
+
+ * Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
+ (WebCore::IDBServer::SQLiteIDBTransaction::maybeOpenBackingStoreCursor):
+ * Modules/indexeddb/server/SQLiteIDBTransaction.h:
+
+ * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabase::deleteIndex):
+ (WebCore::IDBServer::UniqueIDBDatabase::performDeleteIndex):
+ (WebCore::IDBServer::UniqueIDBDatabase::didPerformDeleteIndex):
+ * Modules/indexeddb/server/UniqueIDBDatabase.h:
+
+ * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
+ (WebCore::IDBObjectStoreInfo::deleteIndex):
+ * Modules/indexeddb/shared/IDBObjectStoreInfo.h:
+
+2016-01-24 Brady Eidson <beid...@apple.com>
+
Unreviewed, speculative fix for:
Modern IDB: Some IDB tests crash in ~SQLiteIDBBackingStore
https://bugs.webkit.org/show_bug.cgi?id=153418
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h 2016-01-25 07:55:17 UTC (rev 195527)
@@ -64,7 +64,7 @@
virtual IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) = 0;
virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) = 0;
virtual IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) = 0;
- virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName) = 0;
+ virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier) = 0;
virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) = 0;
virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) = 0;
virtual IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& value) = 0;
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp 2016-01-25 07:55:17 UTC (rev 195527)
@@ -204,7 +204,7 @@
return objectStore->createIndex(*rawTransaction, info);
}
-IDBError MemoryIDBBackingStore::deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName)
+IDBError MemoryIDBBackingStore::deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier)
{
LOG(IndexedDB, "MemoryIDBBackingStore::deleteIndex");
@@ -216,7 +216,7 @@
if (!objectStore)
return IDBError(IDBDatabaseException::ConstraintError);
- return objectStore->deleteIndex(*rawTransaction, indexName);
+ return objectStore->deleteIndex(*rawTransaction, indexIdentifier);
}
void MemoryIDBBackingStore::removeObjectStoreForVersionChangeAbort(MemoryObjectStore& objectStore)
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h 2016-01-25 07:55:17 UTC (rev 195527)
@@ -56,7 +56,7 @@
virtual IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) override final;
virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) override final;
virtual IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) override final;
- virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName) override final;
+ virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier) override final;
virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) override final;
virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) override final;
virtual IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& value) override final;
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp 2016-01-25 07:55:17 UTC (rev 195527)
@@ -124,31 +124,31 @@
registerIndex(WTFMove(index));
}
-RefPtr<MemoryIndex> MemoryObjectStore::takeIndexByName(const String& name)
+RefPtr<MemoryIndex> MemoryObjectStore::takeIndexByIdentifier(uint64_t indexIdentifier)
{
- auto indexByName = m_indexesByName.take(name);
- if (!indexByName)
+ auto indexByIdentifier = m_indexesByIdentifier.take(indexIdentifier);
+ if (!indexByIdentifier)
return nullptr;
- auto index = m_indexesByIdentifier.take(indexByName->info().identifier());
+ auto index = m_indexesByName.take(indexByIdentifier->info().name());
ASSERT(index);
return index;
}
-IDBError MemoryObjectStore::deleteIndex(MemoryBackingStoreTransaction& transaction, const String& indexName)
+IDBError MemoryObjectStore::deleteIndex(MemoryBackingStoreTransaction& transaction, uint64_t indexIdentifier)
{
LOG(IndexedDB, "MemoryObjectStore::deleteIndex");
if (!m_writeTransaction || !m_writeTransaction->isVersionChange() || m_writeTransaction != &transaction)
return IDBError(IDBDatabaseException::ConstraintError);
- auto index = takeIndexByName(indexName);
+ auto index = takeIndexByIdentifier(indexIdentifier);
ASSERT(index);
if (!index)
return IDBError(IDBDatabaseException::ConstraintError);
- m_info.deleteIndex(indexName);
+ m_info.deleteIndex(indexIdentifier);
transaction.indexDeleted(*index);
return { };
@@ -156,14 +156,14 @@
void MemoryObjectStore::deleteAllIndexes(MemoryBackingStoreTransaction& transaction)
{
- Vector<String> indexNames;
- indexNames.reserveInitialCapacity(m_indexesByName.size());
+ Vector<uint64_t> indexIdentifiers;
+ indexIdentifiers.reserveInitialCapacity(m_indexesByName.size());
- for (auto& name : m_indexesByName.keys())
- indexNames.uncheckedAppend(name);
+ for (auto& index : m_indexesByName.values())
+ indexIdentifiers.uncheckedAppend(index->info().identifier());
- for (auto& name : indexNames)
- deleteIndex(transaction, name);
+ for (auto identifier : indexIdentifiers)
+ deleteIndex(transaction, identifier);
}
bool MemoryObjectStore::containsRecord(const IDBKeyData& key)
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h 2016-01-25 07:55:17 UTC (rev 195527)
@@ -66,7 +66,7 @@
MemoryBackingStoreTransaction* writeTransaction() { return m_writeTransaction; }
IDBError createIndex(MemoryBackingStoreTransaction&, const IDBIndexInfo&);
- IDBError deleteIndex(MemoryBackingStoreTransaction&, const String& indexName);
+ IDBError deleteIndex(MemoryBackingStoreTransaction&, uint64_t indexIdentifier);
void deleteAllIndexes(MemoryBackingStoreTransaction&);
void registerIndex(Ref<MemoryIndex>&&);
@@ -108,7 +108,7 @@
void updateCursorsForPutRecord(std::set<IDBKeyData>::iterator);
void updateCursorsForDeleteRecord(const IDBKeyData&);
- RefPtr<MemoryIndex> takeIndexByName(const String& name);
+ RefPtr<MemoryIndex> takeIndexByIdentifier(uint64_t indexIdentifier);
IDBObjectStoreInfo m_info;
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp 2016-01-25 07:55:17 UTC (rev 195527)
@@ -720,7 +720,7 @@
// Write index records for any records that already exist in this object store.
- auto cursor = transaction->maybeOpenBackingStoreCursor(info.objectStoreIdentifier());
+ auto cursor = transaction->maybeOpenBackingStoreCursor(info.objectStoreIdentifier(), 0, IDBKeyRangeData::allKeys());
if (!cursor) {
LOG_ERROR("Cannot open cursor to populate indexes in database");
@@ -849,9 +849,47 @@
}
-IDBError SQLiteIDBBackingStore::deleteIndex(const IDBResourceIdentifier&, uint64_t, const String&)
+IDBError SQLiteIDBBackingStore::deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier)
{
- return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") };
+ LOG(IndexedDB, "SQLiteIDBBackingStore::deleteIndex - object store %" PRIu64, objectStoreIdentifier);
+
+ ASSERT(m_sqliteDB);
+ ASSERT(m_sqliteDB->isOpen());
+
+ auto* transaction = m_transactions.get(transactionIdentifier);
+ if (!transaction || !transaction->inProgress()) {
+ LOG_ERROR("Attempt to delete index without an in-progress transaction");
+ return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete index without an in-progress transaction") };
+ }
+
+ if (transaction->mode() != IndexedDB::TransactionMode::VersionChange) {
+ LOG_ERROR("Attempt to delete index during a non-version-change transaction");
+ return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete index during a non-version-change transaction") };
+ }
+
+ {
+ SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("DELETE FROM IndexInfo WHERE id = ? AND objectStoreID = ?;"));
+ if (sql.prepare() != SQLITE_OK
+ || sql.bindInt64(1, indexIdentifier) != SQLITE_OK
+ || sql.bindInt64(2, objectStoreIdentifier) != SQLITE_OK
+ || sql.step() != SQLITE_DONE) {
+ LOG_ERROR("Could not delete index id %" PRIi64 " from IndexInfo table (%i) - %s", objectStoreIdentifier, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+ return { IDBDatabaseException::UnknownError, ASCIILiteral("Error deleting index from database") };
+ }
+ }
+
+ {
+ SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("DELETE FROM IndexRecords WHERE indexID = ? AND objectStoreID = ?;"));
+ if (sql.prepare() != SQLITE_OK
+ || sql.bindInt64(1, indexIdentifier) != SQLITE_OK
+ || sql.bindInt64(2, objectStoreIdentifier) != SQLITE_OK
+ || sql.step() != SQLITE_DONE) {
+ LOG_ERROR("Could not delete index records for index id %" PRIi64 " from IndexRecords table (%i) - %s", indexIdentifier, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+ return { IDBDatabaseException::UnknownError, ASCIILiteral("Error deleting index records from database") };
+ }
+ }
+
+ return { };
}
IDBError SQLiteIDBBackingStore::keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, const IDBKeyData& keyData, bool& keyExists)
@@ -1093,9 +1131,30 @@
return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") };
}
-IDBError SQLiteIDBBackingStore::getCount(const IDBResourceIdentifier&, uint64_t, uint64_t, const IDBKeyRangeData&, uint64_t&)
+IDBError SQLiteIDBBackingStore::getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData& range, uint64_t& outCount)
{
- return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") };
+ LOG(IndexedDB, "SQLiteIDBBackingStore::getCount - object store %" PRIu64, objectStoreIdentifier);
+ ASSERT(m_sqliteDB);
+ ASSERT(m_sqliteDB->isOpen());
+
+ outCount = 0;
+
+ auto* transaction = m_transactions.get(transactionIdentifier);
+ if (!transaction || !transaction->inProgress()) {
+ LOG_ERROR("Attempt to get count from database without an in-progress transaction");
+ return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to get count from database without an in-progress transaction") };
+ }
+
+ auto cursor = transaction->maybeOpenBackingStoreCursor(objectStoreIdentifier, indexIdentifier, range);
+ if (!cursor) {
+ LOG_ERROR("Cannot open cursor to populate indexes in database");
+ return { IDBDatabaseException::UnknownError, ASCIILiteral("Unable to populate indexes in database") };
+ }
+
+ while (cursor->advance(1))
+ ++outCount;
+
+ return { };
}
IDBError SQLiteIDBBackingStore::generateKeyNumber(const IDBResourceIdentifier&, uint64_t, uint64_t&)
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h 2016-01-25 07:55:17 UTC (rev 195527)
@@ -59,7 +59,7 @@
virtual IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) override final;
virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) override final;
virtual IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) override final;
- virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName) override final;
+ virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier) override final;
virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) override final;
virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) override final;
virtual IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& value) override final;
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp 2016-01-25 07:55:17 UTC (rev 195527)
@@ -51,9 +51,9 @@
return cursor;
}
-std::unique_ptr<SQLiteIDBCursor> SQLiteIDBCursor::maybeCreateBackingStoreCursor(SQLiteIDBTransaction& transaction, const uint64_t objectStoreIdentifier)
+std::unique_ptr<SQLiteIDBCursor> SQLiteIDBCursor::maybeCreateBackingStoreCursor(SQLiteIDBTransaction& transaction, const uint64_t objectStoreID, const uint64_t indexID, const IDBKeyRangeData& range)
{
- auto cursor = std::make_unique<SQLiteIDBCursor>(transaction, objectStoreIdentifier);
+ auto cursor = std::make_unique<SQLiteIDBCursor>(transaction, objectStoreID, indexID, range);
if (!cursor->establishStatement())
return nullptr;
@@ -75,11 +75,13 @@
ASSERT(m_objectStoreID);
}
-SQLiteIDBCursor::SQLiteIDBCursor(SQLiteIDBTransaction& transaction, uint64_t objectStoreID)
+SQLiteIDBCursor::SQLiteIDBCursor(SQLiteIDBTransaction& transaction, const uint64_t objectStoreID, const uint64_t indexID, const IDBKeyRangeData& range)
: m_transaction(&transaction)
, m_cursorIdentifier(transaction.transactionIdentifier())
, m_objectStoreID(objectStoreID)
+ , m_indexID(indexID ? indexID : IDBIndexMetadata::InvalidId)
, m_cursorDirection(IndexedDB::CursorDirection::Next)
+ , m_keyRange(range)
{
ASSERT(m_objectStoreID);
}
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.h (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.h 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.h 2016-01-25 07:55:17 UTC (rev 195527)
@@ -46,10 +46,10 @@
WTF_MAKE_NONCOPYABLE(SQLiteIDBCursor);
public:
static std::unique_ptr<SQLiteIDBCursor> maybeCreate(SQLiteIDBTransaction&, const IDBCursorInfo&);
- static std::unique_ptr<SQLiteIDBCursor> maybeCreateBackingStoreCursor(SQLiteIDBTransaction&, const uint64_t objectStoreIdentifier);
+ static std::unique_ptr<SQLiteIDBCursor> maybeCreateBackingStoreCursor(SQLiteIDBTransaction&, const uint64_t objectStoreIdentifier, const uint64_t indexIdentifier, const IDBKeyRangeData&);
SQLiteIDBCursor(SQLiteIDBTransaction&, const IDBCursorInfo&);
- SQLiteIDBCursor(SQLiteIDBTransaction&, uint64_t objectStoreID);
+ SQLiteIDBCursor(SQLiteIDBTransaction&, uint64_t objectStoreID, uint64_t indexID, const IDBKeyRangeData&);
const IDBResourceIdentifier& identifier() const { return m_cursorIdentifier; }
SQLiteIDBTransaction* transaction() const { return m_transaction; }
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.cpp (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.cpp 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.cpp 2016-01-25 07:55:17 UTC (rev 195527)
@@ -99,12 +99,12 @@
clearCursors();
}
-std::unique_ptr<SQLiteIDBCursor> SQLiteIDBTransaction::maybeOpenBackingStoreCursor(uint64_t objectStoreID)
+std::unique_ptr<SQLiteIDBCursor> SQLiteIDBTransaction::maybeOpenBackingStoreCursor(uint64_t objectStoreID, uint64_t indexID, const IDBKeyRangeData& range)
{
ASSERT(m_sqliteTransaction);
ASSERT(m_sqliteTransaction->inProgress());
- return SQLiteIDBCursor::maybeCreateBackingStoreCursor(*this, objectStoreID);
+ return SQLiteIDBCursor::maybeCreateBackingStoreCursor(*this, objectStoreID, indexID, range);
}
SQLiteIDBCursor* SQLiteIDBTransaction::maybeOpenCursor(const IDBCursorInfo& info)
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.h (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.h 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.h 2016-01-25 07:55:17 UTC (rev 195527)
@@ -59,7 +59,7 @@
IDBError commit();
IDBError abort();
- std::unique_ptr<SQLiteIDBCursor> maybeOpenBackingStoreCursor(uint64_t objectStoreID);
+ std::unique_ptr<SQLiteIDBCursor> maybeOpenBackingStoreCursor(uint64_t objectStoreID, uint64_t indexID, const IDBKeyRangeData&);
SQLiteIDBCursor* maybeOpenCursor(const IDBCursorInfo&);
void closeCursor(SQLiteIDBCursor&);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2016-01-25 07:55:17 UTC (rev 195527)
@@ -607,22 +607,35 @@
LOG(IndexedDB, "(main) UniqueIDBDatabase::deleteIndex");
uint64_t callbackID = storeCallback(callback);
- m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performDeleteIndex, callbackID, transaction.info().identifier(), objectStoreIdentifier, indexName));
+
+ auto* objectStoreInfo = m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier);
+ if (!objectStoreInfo) {
+ performErrorCallback(callbackID, { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete index from non-existant object store") });
+ return;
+ }
+
+ auto* indexInfo = objectStoreInfo->infoForExistingIndex(indexName);
+ if (!indexInfo) {
+ performErrorCallback(callbackID, { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete non-existant index") });
+ return;
+ }
+
+ m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performDeleteIndex, callbackID, transaction.info().identifier(), objectStoreIdentifier, indexInfo->identifier()));
}
-void UniqueIDBDatabase::performDeleteIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName)
+void UniqueIDBDatabase::performDeleteIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const uint64_t indexIdentifier)
{
ASSERT(!isMainThread());
LOG(IndexedDB, "(db) UniqueIDBDatabase::performDeleteIndex");
ASSERT(m_backingStore);
- m_backingStore->deleteIndex(transactionIdentifier, objectStoreIdentifier, indexName);
+ m_backingStore->deleteIndex(transactionIdentifier, objectStoreIdentifier, indexIdentifier);
IDBError error;
- m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformDeleteIndex, callbackIdentifier, error, objectStoreIdentifier, indexName));
+ m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformDeleteIndex, callbackIdentifier, error, objectStoreIdentifier, indexIdentifier));
}
-void UniqueIDBDatabase::didPerformDeleteIndex(uint64_t callbackIdentifier, const IDBError& error, uint64_t objectStoreIdentifier, const String& indexName)
+void UniqueIDBDatabase::didPerformDeleteIndex(uint64_t callbackIdentifier, const IDBError& error, uint64_t objectStoreIdentifier, uint64_t indexIdentifier)
{
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::didPerformDeleteIndex");
@@ -630,7 +643,7 @@
if (error.isNull()) {
auto* objectStoreInfo = m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier);
if (objectStoreInfo)
- objectStoreInfo->deleteIndex(indexName);
+ objectStoreInfo->deleteIndex(indexIdentifier);
}
performErrorCallback(callbackIdentifier, error);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h 2016-01-25 07:55:17 UTC (rev 195527)
@@ -134,7 +134,7 @@
void performDeleteObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier);
void performClearObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier);
void performCreateIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&);
- void performDeleteIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName);
+ void performDeleteIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier);
void performPutOrAdd(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode);
void performGetRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&);
void performGetIndexRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, IndexedDB::IndexRecordType, const IDBKeyRangeData&);
@@ -151,7 +151,7 @@
void didPerformDeleteObjectStore(uint64_t callbackIdentifier, const IDBError&, uint64_t objectStoreIdentifier);
void didPerformClearObjectStore(uint64_t callbackIdentifier, const IDBError&);
void didPerformCreateIndex(uint64_t callbackIdentifier, const IDBError&, const IDBIndexInfo&);
- void didPerformDeleteIndex(uint64_t callbackIdentifier, const IDBError&, uint64_t objectStoreIdentifier, const String& indexName);
+ void didPerformDeleteIndex(uint64_t callbackIdentifier, const IDBError&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier);
void didPerformPutOrAdd(uint64_t callbackIdentifier, const IDBError&, const IDBKeyData&);
void didPerformGetRecord(uint64_t callbackIdentifier, const IDBError&, const IDBGetResult&);
void didPerformGetCount(uint64_t callbackIdentifier, const IDBError&, uint64_t);
Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp 2016-01-25 07:55:17 UTC (rev 195527)
@@ -113,6 +113,11 @@
m_indexMap.remove(info->identifier());
}
+void IDBObjectStoreInfo::deleteIndex(uint64_t indexIdentifier)
+{
+ m_indexMap.remove(indexIdentifier);
+}
+
#ifndef NDEBUG
String IDBObjectStoreInfo::loggingString(int indent) const
{
Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h (195526 => 195527)
--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h 2016-01-25 07:45:39 UTC (rev 195526)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h 2016-01-25 07:55:17 UTC (rev 195527)
@@ -59,6 +59,7 @@
Vector<String> indexNames() const;
void deleteIndex(const String& indexName);
+ void deleteIndex(uint64_t indexIdentifier);
#ifndef NDEBUG
String loggingString(int indent = 0) const;