- Revision
- 195787
- Author
- beid...@apple.com
- Date
- 2016-01-28 15:18:55 -0800 (Thu, 28 Jan 2016)
Log Message
Modern IDB: Fix several more problems with object store changes during cursor iteration in SQLite backend.
https://bugs.webkit.org/show_bug.cgi?id=153616
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::clearObjectStore):
* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindStatement):
(WebCore::IDBServer::SQLiteIDBCursor::bindArguments):
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::iterateCursor):
LayoutTests:
* platform/mac-wk1/TestExpectations:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (195786 => 195787)
--- trunk/LayoutTests/ChangeLog 2016-01-28 23:16:20 UTC (rev 195786)
+++ trunk/LayoutTests/ChangeLog 2016-01-28 23:18:55 UTC (rev 195787)
@@ -1,5 +1,14 @@
2016-01-28 Brady Eidson <beid...@apple.com>
+ Modern IDB: Fix several more problems with object store changes during cursor iteration in SQLite backend.
+ https://bugs.webkit.org/show_bug.cgi?id=153616
+
+ Reviewed by Alex Christensen.
+
+ * platform/mac-wk1/TestExpectations:
+
+2016-01-28 Brady Eidson <beid...@apple.com>
+
Modern IDB: SQLite backend doesn't handle mutation during cursor iteration.
https://bugs.webkit.org/show_bug.cgi?id=153614
Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (195786 => 195787)
--- trunk/LayoutTests/platform/mac-wk1/TestExpectations 2016-01-28 23:16:20 UTC (rev 195786)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations 2016-01-28 23:18:55 UTC (rev 195787)
@@ -454,11 +454,9 @@
imported/w3c/indexeddb/writer-starvation.htm [ Failure ]
storage/indexeddb/cursor-continue-validity.html [ Failure ]
storage/indexeddb/cursor-primary-key-order.html [ Failure ]
-storage/indexeddb/cursor-update.html [ Failure ]
storage/indexeddb/get-keyrange.html [ Failure ]
storage/indexeddb/index-duplicate-keypaths.html [ Failure ]
storage/indexeddb/key-generator.html [ Failure ]
-storage/indexeddb/modern/cursor-7.html [ Failure ]
storage/indexeddb/modern/get-keyrange.html [ Failure ]
storage/indexeddb/modern/index-3.html [ Failure ]
storage/indexeddb/objectstore-autoincrement.html [ Failure ]
Modified: trunk/Source/WebCore/ChangeLog (195786 => 195787)
--- trunk/Source/WebCore/ChangeLog 2016-01-28 23:16:20 UTC (rev 195786)
+++ trunk/Source/WebCore/ChangeLog 2016-01-28 23:18:55 UTC (rev 195787)
@@ -1,3 +1,22 @@
+2016-01-28 Brady Eidson <beid...@apple.com>
+
+ Modern IDB: Fix several more problems with object store changes during cursor iteration in SQLite backend.
+ https://bugs.webkit.org/show_bug.cgi?id=153616
+
+ Reviewed by Alex Christensen.
+
+ No new tests (A few failing tests pass, a few get closer).
+
+ * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
+ (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore):
+
+ * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
+ (WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindStatement):
+ (WebCore::IDBServer::SQLiteIDBCursor::bindArguments):
+
+ * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabaseTransaction::iterateCursor):
+
2016-01-28 Daniel Bates <daba...@apple.com>
Cleanup: Make DedicatedWorkerThread::create() an inline template method
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (195786 => 195787)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp 2016-01-28 23:16:20 UTC (rev 195786)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp 2016-01-28 23:18:55 UTC (rev 195787)
@@ -673,6 +673,8 @@
IDBError SQLiteIDBBackingStore::clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID)
{
+ LOG(IndexedDB, "SQLiteIDBBackingStore::clearObjectStore - object store %" PRIu64, objectStoreID);
+
ASSERT(m_sqliteDB);
ASSERT(m_sqliteDB->isOpen());
@@ -706,6 +708,8 @@
}
}
+ transaction->notifyCursorsOfChanges(objectStoreID);
+
return { };
}
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp (195786 => 195787)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp 2016-01-28 23:16:20 UTC (rev 195786)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp 2016-01-28 23:18:55 UTC (rev 195787)
@@ -223,11 +223,30 @@
// Otherwise update the lower key or upper key used for the cursor range.
// This is so the cursor can pick up where we left off.
- if (m_cursorDirection == IndexedDB::CursorDirection::Next || m_cursorDirection == IndexedDB::CursorDirection::NextNoDuplicate)
+ // We might also have to change the statement from closed to open so we don't refetch the current key a second time.
+ if (m_cursorDirection == IndexedDB::CursorDirection::Next || m_cursorDirection == IndexedDB::CursorDirection::NextNoDuplicate) {
m_currentLowerKey = m_currentKey;
- else
+ if (!m_keyRange.lowerOpen) {
+ m_keyRange.lowerOpen = true;
+ m_keyRange.lowerKey = m_currentLowerKey;
+ m_statement = nullptr;
+ m_currentRecordID = -1;
+ }
+ } else {
m_currentUpperKey = m_currentKey;
+ if (!m_keyRange.upperOpen) {
+ m_keyRange.upperOpen = true;
+ m_keyRange.upperKey = m_currentUpperKey;
+ m_statement = nullptr;
+ m_currentRecordID = -1;
+ }
+ }
+ if (!m_statement && !establishStatement()) {
+ LOG_ERROR("Unable to establish new statement for cursor iteration");
+ return;
+ }
+
if (m_statement->reset() != SQLITE_OK) {
LOG_ERROR("Could not reset cursor statement to respond to object store changes");
return;
@@ -238,6 +257,8 @@
bool SQLiteIDBCursor::bindArguments()
{
+ LOG(IndexedDB, "Cursor is binding lower key '%s' and upper key '%s'", m_currentLowerKey.loggingString().utf8().data(), m_currentUpperKey.loggingString().utf8().data());
+
if (m_statement->bindInt64(1, m_boundID) != SQLITE_OK) {
LOG_ERROR("Could not bind id argument (bound ID)");
return false;
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp (195786 => 195787)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp 2016-01-28 23:16:20 UTC (rev 195786)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp 2016-01-28 23:18:55 UTC (rev 195787)
@@ -281,7 +281,7 @@
RefPtr<UniqueIDBDatabaseTransaction> protectedThis(this);
m_databaseConnection->database().iterateCursor(requestData, key, count, [this, protectedThis, requestData](const IDBError& error, const IDBGetResult& result) {
- LOG(IndexedDB, "UniqueIDBDatabaseTransaction::openCursor (callback)");
+ LOG(IndexedDB, "UniqueIDBDatabaseTransaction::iterateCursor (callback)");
if (error.isNull())
m_databaseConnection->connectionToClient().didIterateCursor(IDBResultData::iterateCursorSuccess(requestData.requestIdentifier(), result));