Title: [195696] trunk
Revision
195696
Author
[email protected]
Date
2016-01-27 14:57:10 -0800 (Wed, 27 Jan 2016)

Log Message

Modern IDB: Cursors are utterly broken in the SQLite backend.
https://bugs.webkit.org/show_bug.cgi?id=153558

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (35 failures now pass, others improve).

- Fixes incorrect usage of Index cursors when ObjectStore cursors are intended.
- Improves the state of getting the cursor value vs. reaching the end of a cursor.

* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::openCursor):
(WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):

* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
(WebCore::IDBServer::SQLiteIDBCursor::currentData):
* Modules/indexeddb/server/SQLiteIDBCursor.h:

LayoutTests:

* platform/mac-wk1/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (195695 => 195696)


--- trunk/LayoutTests/ChangeLog	2016-01-27 22:40:52 UTC (rev 195695)
+++ trunk/LayoutTests/ChangeLog	2016-01-27 22:57:10 UTC (rev 195696)
@@ -1,3 +1,12 @@
+2016-01-27  Brady Eidson  <[email protected]>
+
+        Modern IDB: Cursors are utterly broken in the SQLite backend.
+        https://bugs.webkit.org/show_bug.cgi?id=153558
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk1/TestExpectations:
+
 2016-01-27  Chris Dumez  <[email protected]>
 
         Getting / Setting property on prototype object must throw TypeError

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (195695 => 195696)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2016-01-27 22:40:52 UTC (rev 195695)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2016-01-27 22:57:10 UTC (rev 195696)
@@ -452,27 +452,15 @@
 imported/w3c/indexeddb/value.htm [ Failure ]
 imported/w3c/indexeddb/value_recursive.htm [ Failure ]
 imported/w3c/indexeddb/writer-starvation.htm [ Failure ]
-storage/indexeddb/closed-cursor.html [ Failure ]
-storage/indexeddb/cursor-added-bug.html [ Failure ]
 storage/indexeddb/cursor-advance.html [ Failure ]
-storage/indexeddb/cursor-basics.html [ Failure ]
-storage/indexeddb/cursor-continue-dir.html [ Failure ]
 storage/indexeddb/cursor-continue-validity.html [ Failure ]
 storage/indexeddb/cursor-continue.html [ Failure ]
-storage/indexeddb/cursor-delete.html [ Failure ]
-storage/indexeddb/cursor-finished.html [ Failure ]
-storage/indexeddb/cursor-inconsistency.html [ Failure ]
 storage/indexeddb/cursor-index-delete.html [ Failure ]
-storage/indexeddb/cursor-key-order.html [ Failure ]
-storage/indexeddb/cursor-prev-no-duplicate.html [ Failure ]
 storage/indexeddb/cursor-primary-key-order.html [ Failure ]
 storage/indexeddb/cursor-skip-deleted.html [ Failure ]
 storage/indexeddb/cursor-update.html [ Failure ]
-storage/indexeddb/cursor-value.html [ Failure ]
 storage/indexeddb/delete-range.html [ Failure ]
-storage/indexeddb/deleted-objects.html [ Failure ]
 storage/indexeddb/duplicates.html [ Failure ]
-storage/indexeddb/exceptions.html [ Failure ]
 storage/indexeddb/get-keyrange.html [ Failure ]
 storage/indexeddb/index-basics.html [ Failure ]
 storage/indexeddb/index-count.html [ Failure ]
@@ -482,21 +470,13 @@
 storage/indexeddb/index-population.html [ Failure ]
 storage/indexeddb/index-unique.html [ Failure ]
 storage/indexeddb/key-generator.html [ Failure ]
-storage/indexeddb/key-sort-order-across-types.html [ Failure ]
-storage/indexeddb/key-sort-order-date.html [ Failure ]
 storage/indexeddb/keypath-arrays.html [ Failure ]
-storage/indexeddb/keypath-fetch-key.html [ Failure ]
 storage/indexeddb/keypath-intrinsic-properties.html [ Failure ]
 storage/indexeddb/lazy-index-population.html [ Failure ]
 storage/indexeddb/lazy-index-types.html [ Failure ]
-storage/indexeddb/modern/cursor-1.html [ Failure ]
-storage/indexeddb/modern/cursor-2.html [ Failure ]
 storage/indexeddb/modern/cursor-3.html [ Failure ]
 storage/indexeddb/modern/cursor-4.html [ Failure ]
-storage/indexeddb/modern/cursor-5.html [ Failure ]
-storage/indexeddb/modern/cursor-6.html [ Failure ]
 storage/indexeddb/modern/cursor-7.html [ Failure ]
-storage/indexeddb/modern/cursor-8.html [ Failure ]
 storage/indexeddb/modern/deleteindex-1.html [ Failure ]
 storage/indexeddb/modern/deleteindex-2.html [ Failure ]
 storage/indexeddb/modern/get-keyrange.html [ Failure ]
@@ -509,31 +489,16 @@
 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/objectstore-cursor-advance-failures.html [ Failure ]
-storage/indexeddb/modern/objectstore-cursor-continue-failures.html [ Failure ]
-storage/indexeddb/modern/request-readystate.html [ Failure ]
-storage/indexeddb/mozilla/clear.html [ Failure ]
-storage/indexeddb/mozilla/cursor-mutation-objectstore-only.html [ Failure ]
 storage/indexeddb/mozilla/cursor-mutation.html [ Failure ]
 storage/indexeddb/mozilla/cursor-update-updates-indexes.html [ Failure ]
 storage/indexeddb/mozilla/cursors.html [ Failure ]
 storage/indexeddb/mozilla/index-prev-no-duplicate.html [ Failure ]
 storage/indexeddb/mozilla/indexes.html [ Failure ]
 storage/indexeddb/mozilla/object-cursors.html [ Failure ]
-storage/indexeddb/mozilla/remove-objectstore.html [ Failure ]
-storage/indexeddb/mutating-cursor.html [ Failure ]
 storage/indexeddb/objectstore-autoincrement.html [ Failure ]
 storage/indexeddb/objectstore-basics.html [ Failure ]
-storage/indexeddb/objectstore-clear.html [ Failure ]
-storage/indexeddb/objectstore-cursor.html [ Failure ]
-storage/indexeddb/open-cursor.html [ Failure ]
 storage/indexeddb/opencursor-key.html [ Failure ]
 storage/indexeddb/optional-arguments.html [ Failure ]
-storage/indexeddb/prefetch-bugfix-108071.html [ Failure ]
-storage/indexeddb/readonly.html [ Failure ]
-storage/indexeddb/transaction-rollback.html [ Failure ]
-storage/indexeddb/value-undefined.html [ Failure ]
-storage/indexeddb/values-odd-types.html [ Failure ]
 
 # SQLite backend tests that timeout
 crypto/subtle/rsa-indexeddb.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (195695 => 195696)


--- trunk/Source/WebCore/ChangeLog	2016-01-27 22:40:52 UTC (rev 195695)
+++ trunk/Source/WebCore/ChangeLog	2016-01-27 22:57:10 UTC (rev 195696)
@@ -1,3 +1,24 @@
+2016-01-27  Brady Eidson  <[email protected]>
+
+        Modern IDB: Cursors are utterly broken in the SQLite backend.
+        https://bugs.webkit.org/show_bug.cgi?id=153558
+
+        Reviewed by Alex Christensen.
+
+        No new tests (35 failures now pass, others improve).
+
+        - Fixes incorrect usage of Index cursors when ObjectStore cursors are intended.
+        - Improves the state of getting the cursor value vs. reaching the end of a cursor.
+
+        * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
+        (WebCore::IDBServer::SQLiteIDBBackingStore::openCursor):
+        (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
+
+        * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
+        (WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
+        (WebCore::IDBServer::SQLiteIDBCursor::currentData):
+        * Modules/indexeddb/server/SQLiteIDBCursor.h:
+
 2016-01-27  Chris Dumez  <[email protected]>
 
         Getting / Setting property on prototype object must throw TypeError

Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (195695 => 195696)


--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp	2016-01-27 22:40:52 UTC (rev 195695)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp	2016-01-27 22:57:10 UTC (rev 195696)
@@ -1406,7 +1406,7 @@
 
     m_cursors.set(cursor->identifier(), cursor);
 
-    result = { cursor->currentKey(), cursor->currentPrimaryKey(), ThreadSafeDataBuffer::copyVector(cursor->currentValueBuffer()) };
+    cursor->currentData(result);
     return { };
 }
 
@@ -1442,7 +1442,7 @@
         }
     }
 
-    result = { cursor->currentKey(), cursor->currentPrimaryKey(), ThreadSafeDataBuffer::copyVector(cursor->currentValueBuffer()) };
+    cursor->currentData(result);
     return { };
 }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp (195695 => 195696)


--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp	2016-01-27 22:40:52 UTC (rev 195695)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp	2016-01-27 22:57:10 UTC (rev 195696)
@@ -28,6 +28,7 @@
 #if ENABLE(INDEXED_DATABASE)
 
 #include "IDBCursorInfo.h"
+#include "IDBGetResult.h"
 #include "IDBSerialization.h"
 #include "Logging.h"
 #include "SQLiteIDBTransaction.h"
@@ -68,7 +69,7 @@
     : m_transaction(&transaction)
     , m_cursorIdentifier(info.identifier())
     , m_objectStoreID(info.objectStoreIdentifier())
-    , m_indexID(info.sourceIdentifier())
+    , m_indexID(info.cursorSource() == IndexedDB::CursorSource::Index ? info.sourceIdentifier() : IDBIndexMetadata::InvalidId)
     , m_cursorDirection(info.cursorDirection())
     , m_keyRange(info.range())
 {
@@ -86,6 +87,17 @@
     ASSERT(m_objectStoreID);
 }
 
+void SQLiteIDBCursor::currentData(IDBGetResult& result)
+{
+    if (m_completed) {
+        ASSERT(!m_errored);
+        result = { };
+        return;
+    }
+
+    result = { m_currentKey, m_currentPrimaryKey, ThreadSafeDataBuffer::copyVector(m_currentValueBuffer) };
+}
+
 static String buildIndexStatement(const IDBKeyRangeData& keyRange, IndexedDB::CursorDirection cursorDirection)
 {
     StringBuilder builder;

Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.h (195695 => 195696)


--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.h	2016-01-27 22:40:52 UTC (rev 195695)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.h	2016-01-27 22:57:10 UTC (rev 195696)
@@ -37,6 +37,7 @@
 namespace WebCore {
 
 class IDBCursorInfo;
+class IDBGetResult;
 
 namespace IDBServer {
 
@@ -67,6 +68,8 @@
 
     void objectStoreRecordsChanged();
 
+    void currentData(IDBGetResult&);
+
 private:
     bool establishStatement();
     bool createSQLiteStatement(const String& sql);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to