void IDBTransaction::indexDeleted(IDBIndex* index) { DCHECK(index); DCHECK(!index->isDeleted()) << "indexDeleted called twice for the same index"; IDBObjectStore* objectStore = index->objectStore(); DCHECK_EQ(objectStore->transaction(), this); DCHECK(m_objectStoreMap.contains(objectStore->name())) << "An index was deleted without accessing its object store"; const auto& objectStoreIterator = m_oldStoreMetadata.find(objectStore); if (objectStoreIterator == m_oldStoreMetadata.end()) { // The index's object store was created in this transaction, so this // index was also created (and deleted) in this transaction, and will // not be restored if the transaction aborts. // // Subtle proof for the first sentence above: Deleting an index requires // calling deleteIndex() on the store's IDBObjectStore instance. // Whenever we create an IDBObjectStore instance for a previously // created store, we snapshot the store's metadata. So, deleting an // index of an "old" store can only be done after the store's metadata // is snapshotted. return; } const IDBObjectStoreMetadata* oldStoreMetadata = objectStoreIterator->value.get(); DCHECK(oldStoreMetadata); if (!oldStoreMetadata->indexes.contains(index->id())) { // The index's object store was created before this transaction, but the // index was created (and deleted) in this transaction, so it will not // be restored if the transaction aborts. return; } m_deletedIndexes.append(index); }