https://bugs.webkit.org/show_bug.cgi?id=153614
Reviewed by Alex Christensen.
Source/WebCore:
No new tests (A few failing tests pass, a few get closer).
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange): Call notifyCursorsOfChanges.
(WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): Ditto.
* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
(WebCore::IDBServer::SQLiteIDBCursor::~SQLiteIDBCursor):
* Modules/indexeddb/server/SQLiteIDBCursor.h:
* Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
(WebCore::IDBServer::SQLiteIDBTransaction::maybeOpenBackingStoreCursor): Remember these transient backing
store cursors so they can be notified of changes.
(WebCore::IDBServer::SQLiteIDBTransaction::closeCursor): Handle removing the cursor from the right set.
(WebCore::IDBServer::SQLiteIDBTransaction::notifyCursorsOfChanges):
* Modules/indexeddb/server/SQLiteIDBTransaction.h:
LayoutTests:
* platform/mac-wk1/TestExpectations:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195784
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
2016-01-28 Brady Eidson <beidson@apple.com>
+ Modern IDB: SQLite backend doesn't handle mutation during cursor iteration.
+ https://bugs.webkit.org/show_bug.cgi?id=153614
+
+ Reviewed by Alex Christensen.
+
+ * platform/mac-wk1/TestExpectations:
+
+2016-01-28 Brady Eidson <beidson@apple.com>
+
Modern IDB: SQLite backend doesn't support deleting ranges with more than one key.
https://bugs.webkit.org/show_bug.cgi?id=153604
storage/indexeddb/modern/cursor-7.html [ Failure ]
storage/indexeddb/modern/get-keyrange.html [ Failure ]
storage/indexeddb/modern/index-3.html [ Failure ]
-storage/indexeddb/mozilla/cursor-mutation.html [ Failure ]
-storage/indexeddb/mozilla/cursors.html [ Failure ]
storage/indexeddb/objectstore-autoincrement.html [ Failure ]
# SQLite backend tests that timeout
2016-01-28 Brady Eidson <beidson@apple.com>
+ Modern IDB: SQLite backend doesn't handle mutation during cursor iteration.
+ https://bugs.webkit.org/show_bug.cgi?id=153614
+
+ Reviewed by Alex Christensen.
+
+ No new tests (A few failing tests pass, a few get closer).
+
+ * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
+ (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange): Call notifyCursorsOfChanges.
+ (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): Ditto.
+
+ * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
+ (WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
+ (WebCore::IDBServer::SQLiteIDBCursor::~SQLiteIDBCursor):
+ * Modules/indexeddb/server/SQLiteIDBCursor.h:
+
+ * Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
+ (WebCore::IDBServer::SQLiteIDBTransaction::maybeOpenBackingStoreCursor): Remember these transient backing
+ store cursors so they can be notified of changes.
+ (WebCore::IDBServer::SQLiteIDBTransaction::closeCursor): Handle removing the cursor from the right set.
+ (WebCore::IDBServer::SQLiteIDBTransaction::notifyCursorsOfChanges):
+ * Modules/indexeddb/server/SQLiteIDBTransaction.h:
+
+2016-01-28 Brady Eidson <beidson@apple.com>
+
Modern IDB: SQLite backend doesn't support deleting ranges with more than one key.
https://bugs.webkit.org/show_bug.cgi?id=153604
}
}
+ transaction->notifyCursorsOfChanges(objectStoreID);
+
return error;
}
// FIXME: If there was an error indexing this record, remove it.
+ transaction->notifyCursorsOfChanges(objectStoreInfo.identifier());
+
return error;
}
, m_indexID(indexID ? indexID : IDBIndexMetadata::InvalidId)
, m_cursorDirection(IndexedDB::CursorDirection::Next)
, m_keyRange(range)
+ , m_backingStoreCursor(true)
{
ASSERT(m_objectStoreID);
}
+SQLiteIDBCursor::~SQLiteIDBCursor()
+{
+ if (m_backingStoreCursor)
+ m_transaction->closeCursor(*this);
+}
+
void SQLiteIDBCursor::currentData(IDBGetResult& result)
{
if (m_completed) {
SQLiteIDBCursor(SQLiteIDBTransaction&, const IDBCursorInfo&);
SQLiteIDBCursor(SQLiteIDBTransaction&, uint64_t objectStoreID, uint64_t indexID, const IDBKeyRangeData&);
+ ~SQLiteIDBCursor();
+
const IDBResourceIdentifier& identifier() const { return m_cursorIdentifier; }
SQLiteIDBTransaction* transaction() const { return m_transaction; }
bool m_completed { false };
bool m_errored { false };
+
+ bool m_backingStoreCursor { false };
};
ASSERT(m_sqliteTransaction);
ASSERT(m_sqliteTransaction->inProgress());
- return SQLiteIDBCursor::maybeCreateBackingStoreCursor(*this, objectStoreID, indexID, range);
+ auto cursor = SQLiteIDBCursor::maybeCreateBackingStoreCursor(*this, objectStoreID, indexID, range);
+
+ if (cursor)
+ m_backingStoreCursors.add(cursor.get());
+
+ return cursor;
}
SQLiteIDBCursor* SQLiteIDBTransaction::maybeOpenCursor(const IDBCursorInfo& info)
void SQLiteIDBTransaction::closeCursor(SQLiteIDBCursor& cursor)
{
+ auto backingStoreTake = m_backingStoreCursors.take(&cursor);
+ if (backingStoreTake) {
+ ASSERT(!m_cursors.contains(cursor.identifier()));
+ return;
+ }
+
ASSERT(m_cursors.contains(cursor.identifier()));
m_backingStore.unregisterCursor(cursor);
if (i.value->objectStoreID() == objectStoreID)
i.value->objectStoreRecordsChanged();
}
+
+ for (auto* cursor : m_backingStoreCursors) {
+ if (cursor->objectStoreID() == objectStoreID)
+ cursor->objectStoreRecordsChanged();
+ }
}
void SQLiteIDBTransaction::clearCursors()
#include "IDBTransactionInfo.h"
#include "IndexedDB.h"
#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
#include <wtf/Noncopyable.h>
namespace WebCore {
SQLiteIDBBackingStore& m_backingStore;
std::unique_ptr<SQLiteTransaction> m_sqliteTransaction;
HashMap<IDBResourceIdentifier, std::unique_ptr<SQLiteIDBCursor>> m_cursors;
+ HashSet<SQLiteIDBCursor*> m_backingStoreCursors;
};
} // namespace IDBServer