Title: [193657] trunk
Revision
193657
Author
beid...@apple.com
Date
2015-12-07 15:07:03 -0800 (Mon, 07 Dec 2015)

Log Message

Modern IDB: storage/indexeddb/cursor-continue-validity.html fails.
https://bugs.webkit.org/show_bug.cgi?id=151961

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (At least one failing test now passes).

When an index cursor's iterator was invalidated, there were some cases where it did
not correctly find the next iterator to pick up where it left off.

* Modules/indexeddb/client/IDBCursorImpl.cpp:
(WebCore::IDBClient::IDBCursor::update):
(WebCore::IDBClient::IDBCursor::deleteFunction):

* Modules/indexeddb/server/IndexValueStore.cpp:
(WebCore::IDBServer::IndexValueStore::find):
(WebCore::IDBServer::IndexValueStore::loggingString):
* Modules/indexeddb/server/IndexValueStore.h:

LayoutTests:

* platform/mac-wk1/TestExpectations:
* storage/indexeddb/cursor-finished-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (193656 => 193657)


--- trunk/LayoutTests/ChangeLog	2015-12-07 23:01:13 UTC (rev 193656)
+++ trunk/LayoutTests/ChangeLog	2015-12-07 23:07:03 UTC (rev 193657)
@@ -1,3 +1,13 @@
+2015-12-07  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: storage/indexeddb/cursor-continue-validity.html fails.
+        https://bugs.webkit.org/show_bug.cgi?id=151961
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk1/TestExpectations:
+        * storage/indexeddb/cursor-finished-expected.txt:
+
 2015-12-07  Xabier Rodriguez Calvar  <calva...@igalia.com>
 
         [Streams API] pipeTo tests are failing

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (193656 => 193657)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-12-07 23:01:13 UTC (rev 193656)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-12-07 23:07:03 UTC (rev 193657)
@@ -110,7 +110,6 @@
 # IDB tests with text failures                                                             
 storage/indexeddb/createIndex-after-failure.html [ Failure ]
 storage/indexeddb/cursor-continue.html [ Failure ]
-storage/indexeddb/cursor-continue-validity.html [ Failure ]
 storage/indexeddb/cursor-continueprimarykey.html [ Failure ]
 storage/indexeddb/cursor-leak.html [ Failure ]
 storage/indexeddb/cursor-request-cycle.html [ Failure ]

Modified: trunk/LayoutTests/storage/indexeddb/cursor-finished-expected.txt (193656 => 193657)


--- trunk/LayoutTests/storage/indexeddb/cursor-finished-expected.txt	2015-12-07 23:01:13 UTC (rev 193656)
+++ trunk/LayoutTests/storage/indexeddb/cursor-finished-expected.txt	2015-12-07 23:07:03 UTC (rev 193657)
@@ -49,7 +49,7 @@
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
 PASS ename is 'InvalidStateError'
-Exception message: An operation was called on an object on which it is not allowed or at a time when it is not allowed.
+Exception message: Failed to execute 'update' on 'IDBCursor': The cursor is being iterated or has iterated past its end.
 Expecting exception from savedCursor.advance(1)
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
@@ -69,7 +69,7 @@
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
 PASS ename is 'InvalidStateError'
-Exception message: An operation was called on an object on which it is not allowed or at a time when it is not allowed.
+Exception message: Failed to execute 'delete' on 'IDBCursor': The cursor is being iterated or has iterated past its end.
 
 PASS successfullyParsed is true
 

Modified: trunk/Source/WebCore/ChangeLog (193656 => 193657)


--- trunk/Source/WebCore/ChangeLog	2015-12-07 23:01:13 UTC (rev 193656)
+++ trunk/Source/WebCore/ChangeLog	2015-12-07 23:07:03 UTC (rev 193657)
@@ -1,3 +1,24 @@
+2015-12-07  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: storage/indexeddb/cursor-continue-validity.html fails.
+        https://bugs.webkit.org/show_bug.cgi?id=151961
+
+        Reviewed by Alex Christensen.
+
+        No new tests (At least one failing test now passes).
+
+        When an index cursor's iterator was invalidated, there were some cases where it did 
+        not correctly find the next iterator to pick up where it left off.
+
+        * Modules/indexeddb/client/IDBCursorImpl.cpp:
+        (WebCore::IDBClient::IDBCursor::update):
+        (WebCore::IDBClient::IDBCursor::deleteFunction):
+        
+        * Modules/indexeddb/server/IndexValueStore.cpp:
+        (WebCore::IDBServer::IndexValueStore::find):
+        (WebCore::IDBServer::IndexValueStore::loggingString):
+        * Modules/indexeddb/server/IndexValueStore.h:
+
 2015-12-07  Zalan Bujtas  <za...@apple.com>
 
         Refactor TextPainter::paintText() into sub methods.

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.cpp (193656 => 193657)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.cpp	2015-12-07 23:01:13 UTC (rev 193656)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.cpp	2015-12-07 23:07:03 UTC (rev 193657)
@@ -133,6 +133,7 @@
 
     if (!m_gotValue) {
         ec.code = IDBDatabaseException::InvalidStateError;
+        ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The cursor is being iterated or has iterated past its end.");
         return nullptr;
     }
 
@@ -306,6 +307,7 @@
 
     if (!m_gotValue) {
         ec.code = IDBDatabaseException::InvalidStateError;
+        ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The cursor is being iterated or has iterated past its end.");
         return nullptr;
     }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp (193656 => 193657)


--- trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp	2015-12-07 23:01:13 UTC (rev 193656)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp	2015-12-07 23:07:03 UTC (rev 193657)
@@ -212,6 +212,15 @@
     auto record = m_records.get(*iterator);
     ASSERT(record);
 
+    // If the main record iterator is not equal to the key we were looking for,
+    // we know the primary key record should be the first.
+    if (*iterator != key) {
+        auto primaryIterator = record->begin();
+        ASSERT(primaryIterator.isValid());
+
+        return { *this, iterator, primaryIterator };
+    }
+
     auto primaryIterator = record->find(primaryKey);
     if (primaryIterator.isValid())
         return { *this, iterator, primaryIterator };
@@ -374,6 +383,18 @@
     return m_primaryKeyIterator.key();
 }
 
+#ifndef NDEBUG
+String IndexValueStore::loggingString() const
+{
+    String result;
+    for (auto& key : m_orderedKeys) {
+        result.append(makeString("Key: ", key.loggingString()));
+        result.append(makeString("  Entry has ", String::number(m_records.get(key)->getCount()), " entries"));
+    }
+    return result;
+}
+#endif
+
 } // namespace IDBServer
 } // namespace WebCore
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.h (193656 => 193657)


--- trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.h	2015-12-07 23:01:13 UTC (rev 193656)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.h	2015-12-07 23:07:03 UTC (rev 193657)
@@ -98,6 +98,10 @@
     Iterator find(const IDBKeyData&, const IDBKeyData& primaryKey);
     Iterator reverseFind(const IDBKeyData&, const IDBKeyData& primaryKey, CursorDuplicity);
 
+#ifndef NDEBUG
+    String loggingString() const;
+#endif
+
 private:
     std::set<IDBKeyData>::iterator lowestIteratorInRange(const IDBKeyRangeData&) const;
     std::set<IDBKeyData>::reverse_iterator highestReverseIteratorInRange(const IDBKeyRangeData&) const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to