Title: [192825] trunk
Revision
192825
Author
beid...@apple.com
Date
2015-11-30 13:51:06 -0800 (Mon, 30 Nov 2015)

Log Message

Modern IDB: Correct handling of cursors finishing iteration.
https://bugs.webkit.org/show_bug.cgi?id=151664

Reviewed by Andy Estes.

Source/WebCore:

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

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

* Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
(WebCore::IDBClient::IDBObjectStore::putOrAdd):

LayoutTests:

* platform/mac-wk1/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (192824 => 192825)


--- trunk/LayoutTests/ChangeLog	2015-11-30 21:50:04 UTC (rev 192824)
+++ trunk/LayoutTests/ChangeLog	2015-11-30 21:51:06 UTC (rev 192825)
@@ -1,3 +1,12 @@
+2015-11-30  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: Correct handling of cursors finishing iteration.
+        https://bugs.webkit.org/show_bug.cgi?id=151664
+
+        Reviewed by Andy Estes.
+
+        * platform/mac-wk1/TestExpectations:
+
 2015-11-30  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Unify font-variant-* with font-variant shorthand

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (192824 => 192825)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-11-30 21:50:04 UTC (rev 192824)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-11-30 21:51:06 UTC (rev 192825)
@@ -72,6 +72,7 @@
 
 # But Modern IndexedDB is.
 storage/indexeddb/aborted-versionchange-closes.html [ Pass ]
+storage/indexeddb/cursor-finished.html [ Pass ]
 storage/indexeddb/modern [ Pass ]
 storage/indexeddb/mozilla/add-twice-failure.html [ Pass ]
 storage/indexeddb/mozilla/autoincrement-indexes.html [ Pass ]

Modified: trunk/Source/WebCore/ChangeLog (192824 => 192825)


--- trunk/Source/WebCore/ChangeLog	2015-11-30 21:50:04 UTC (rev 192824)
+++ trunk/Source/WebCore/ChangeLog	2015-11-30 21:51:06 UTC (rev 192825)
@@ -1,3 +1,18 @@
+2015-11-30  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: Correct handling of cursors finishing iteration.
+        https://bugs.webkit.org/show_bug.cgi?id=151664
+
+        Reviewed by Andy Estes.
+
+        No new tests (At least one previously failing test now passes).
+
+        * Modules/indexeddb/client/IDBCursorImpl.cpp:
+        (WebCore::IDBClient::IDBCursor::setGetResult):
+        
+        * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
+        (WebCore::IDBClient::IDBObjectStore::putOrAdd):
+
 2015-11-30  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Unify font-variant-* with font-variant shorthand

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


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.cpp	2015-11-30 21:50:04 UTC (rev 192824)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.cpp	2015-11-30 21:51:06 UTC (rev 192825)
@@ -288,6 +288,16 @@
     if (!context)
         return;
 
+    if (!getResult.isDefined()) {
+        m_deprecatedCurrentKey = { };
+        m_deprecatedCurrentPrimaryKey = { };
+        m_currentPrimaryKeyData = { };
+        m_deprecatedCurrentValue = { };
+
+        m_gotValue = false;
+        return;
+    }
+
     m_deprecatedCurrentKey = idbKeyDataToScriptValue(context, getResult.keyData());
     m_deprecatedCurrentPrimaryKey = idbKeyDataToScriptValue(context, getResult.primaryKeyData());
     m_currentPrimaryKeyData = getResult.primaryKeyData();

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp (192824 => 192825)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp	2015-11-30 21:50:04 UTC (rev 192824)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp	2015-11-30 21:51:06 UTC (rev 192825)
@@ -233,34 +233,34 @@
     LOG(IndexedDB, "IDBObjectStore::putOrAdd");
 
     if (m_transaction->isReadOnly()) {
-        ec = static_cast<ExceptionCode>(IDBExceptionCode::ReadOnlyError);
+        ec = IDBDatabaseException::ReadOnlyError;
         return nullptr;
     }
 
     if (!m_transaction->isActive()) {
-        ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+        ec = IDBDatabaseException::TransactionInactiveError;
         return nullptr;
     }
 
     if (m_deleted) {
-        ec = INVALID_STATE_ERR;
+        ec = IDBDatabaseException::InvalidStateError;
         return nullptr;
     }
 
     RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(&state, value, nullptr, nullptr);
     if (state.hadException()) {
-        ec = DATA_CLONE_ERR;
+        ec = IDBDatabaseException::DataCloneError;
         return nullptr;
     }
 
     if (serializedValue->hasBlobURLs()) {
         // FIXME: Add Blob/File/FileList support
-        ec = DATA_CLONE_ERR;
+        ec = IDBDatabaseException::DataCloneError;
         return nullptr;
     }
 
     if (key && key->type() == KeyType::Invalid) {
-        ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+        ec = IDBDatabaseException::DataError;
         return nullptr;
     }
 
@@ -268,24 +268,24 @@
     bool usesKeyGenerator = autoIncrement();
     if (usesInlineKeys && inlineKeyCheck == InlineKeyCheck::Perform) {
         if (key) {
-            ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+            ec = IDBDatabaseException::DataError;
             return nullptr;
         }
 
         RefPtr<IDBKey> keyPathKey = maybeCreateIDBKeyFromScriptValueAndKeyPath(state, value, m_info.keyPath());
         if (keyPathKey && !keyPathKey->isValid()) {
-            ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+            ec = IDBDatabaseException::DataError;
             return nullptr;
         }
 
         if (!keyPathKey) {
             if (usesKeyGenerator) {
                 if (!canInjectIDBKeyIntoScriptValue(state, value, m_info.keyPath())) {
-                    ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+                    ec = IDBDatabaseException::DataError;
                     return nullptr;
                 }
             } else {
-                ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+                ec = IDBDatabaseException::DataError;
                 return nullptr;
             }
         }
@@ -295,13 +295,13 @@
             key = keyPathKey;
         }
     } else if (!usesKeyGenerator && !key) {
-        ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+        ec = IDBDatabaseException::DataError;
         return nullptr;
     }
 
     auto context = scriptExecutionContextFromExecState(&state);
     if (!context) {
-        ec = static_cast<ExceptionCode>(IDBExceptionCode::Unknown);
+        ec = IDBDatabaseException::UnknownError;
         return nullptr;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to