Title: [192806] trunk
Revision
192806
Author
beid...@apple.com
Date
2015-11-30 11:05:05 -0800 (Mon, 30 Nov 2015)

Log Message

Modern IDB: Support updating cursor values when the object store uses inline keys.
https://bugs.webkit.org/show_bug.cgi?id=151647

Reviewed by Andy Estes.

Source/WebCore:

No new tests (At least two previously failing tests now pass and are unskipped).

* Modules/indexeddb/client/IDBCursorImpl.cpp:
(WebCore::IDBClient::IDBCursor::update): Use putForCursorUpdate() instead of put()

* Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
(WebCore::IDBClient::IDBObjectStore::add):
(WebCore::IDBClient::IDBObjectStore::put):
(WebCore::IDBClient::IDBObjectStore::putForCursorUpdate): Use the flag to skip the inline-key check.
(WebCore::IDBClient::IDBObjectStore::putOrAdd): Add a flag to skip the inline-key check.
* Modules/indexeddb/client/IDBObjectStoreImpl.h:

LayoutTests:

* platform/mac-wk1/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (192805 => 192806)


--- trunk/LayoutTests/ChangeLog	2015-11-30 18:46:13 UTC (rev 192805)
+++ trunk/LayoutTests/ChangeLog	2015-11-30 19:05:05 UTC (rev 192806)
@@ -1,5 +1,14 @@
 2015-11-30  Brady Eidson  <beid...@apple.com>
 
+        Modern IDB: Support updating cursor values when the object store uses inline keys.
+        https://bugs.webkit.org/show_bug.cgi?id=151647
+
+        Reviewed by Andy Estes.
+
+        * platform/mac-wk1/TestExpectations:
+
+2015-11-30  Brady Eidson  <beid...@apple.com>
+
         Modern IDB: openCursor() fix resulting in at least 4 more passing tests.
         https://bugs.webkit.org/show_bug.cgi?id=151630
 

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (192805 => 192806)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-11-30 18:46:13 UTC (rev 192805)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-11-30 19:05:05 UTC (rev 192806)
@@ -82,6 +82,7 @@
 storage/indexeddb/mozilla/create-objectstore-null-name.html [ Pass ]
 storage/indexeddb/mozilla/cursor-mutation-objectstore-only.html [ Pass ]
 storage/indexeddb/mozilla/cursor-mutation.html [ Pass ]
+storage/indexeddb/mozilla/cursor-update-updates-indexes.html [ Pass ]
 storage/indexeddb/mozilla/delete-result.html [ Pass ]
 storage/indexeddb/mozilla/event-source.html [ Pass ]
 storage/indexeddb/mozilla/global-data.html [ Pass ]
@@ -92,6 +93,7 @@
 storage/indexeddb/mozilla/key-requirements.html [ Pass ]
 storage/indexeddb/mozilla/object-cursors.html [ Pass ]
 storage/indexeddb/mozilla/object-identity.html [ Pass ]
+storage/indexeddb/mozilla/object-store-inline-autoincrement-key-added-on-put.html [ Pass ]
 storage/indexeddb/mozilla/object-store-remove-values.html [ Pass ]
 storage/indexeddb/mozilla/objectstorenames.html [ Pass ]
 storage/indexeddb/mozilla/odd-result-order.html [ Pass ]

Modified: trunk/Source/WebCore/ChangeLog (192805 => 192806)


--- trunk/Source/WebCore/ChangeLog	2015-11-30 18:46:13 UTC (rev 192805)
+++ trunk/Source/WebCore/ChangeLog	2015-11-30 19:05:05 UTC (rev 192806)
@@ -1,5 +1,24 @@
 2015-11-30  Brady Eidson  <beid...@apple.com>
 
+        Modern IDB: Support updating cursor values when the object store uses inline keys.
+        https://bugs.webkit.org/show_bug.cgi?id=151647
+
+        Reviewed by Andy Estes.
+
+        No new tests (At least two previously failing tests now pass and are unskipped).
+
+        * Modules/indexeddb/client/IDBCursorImpl.cpp:
+        (WebCore::IDBClient::IDBCursor::update): Use putForCursorUpdate() instead of put()
+        
+        * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
+        (WebCore::IDBClient::IDBObjectStore::add):
+        (WebCore::IDBClient::IDBObjectStore::put):
+        (WebCore::IDBClient::IDBObjectStore::putForCursorUpdate): Use the flag to skip the inline-key check.
+        (WebCore::IDBClient::IDBObjectStore::putOrAdd): Add a flag to skip the inline-key check.
+        * Modules/indexeddb/client/IDBObjectStoreImpl.h:
+
+2015-11-30  Brady Eidson  <beid...@apple.com>
+
         Modern IDB: Resolve flaky GC-vs-wrapper issue with IDBOpenDBRequest.
         https://bugs.webkit.org/show_bug.cgi?id=151645
 

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


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.cpp	2015-11-30 18:46:13 UTC (rev 192805)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.cpp	2015-11-30 19:05:05 UTC (rev 192806)
@@ -139,7 +139,7 @@
         return nullptr;
     }
 
-    return effectiveObjectStore().put(exec, value.jsValue(), m_deprecatedCurrentPrimaryKey.jsValue(), ec);
+    return effectiveObjectStore().putForCursorUpdate(exec, value.jsValue(), m_deprecatedCurrentPrimaryKey.jsValue(), ec);
 }
 
 void IDBCursor::advance(unsigned long count, ExceptionCode& ec)

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


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp	2015-11-30 18:46:13 UTC (rev 192805)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp	2015-11-30 19:05:05 UTC (rev 192806)
@@ -203,28 +203,33 @@
 
 RefPtr<WebCore::IDBRequest> IDBObjectStore::add(JSC::ExecState& state, JSC::JSValue value, ExceptionCode& ec)
 {
-    return putOrAdd(state, value, nullptr, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, ec);
+    return putOrAdd(state, value, nullptr, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, InlineKeyCheck::Perform, ec);
 }
 
 RefPtr<WebCore::IDBRequest> IDBObjectStore::add(JSC::ExecState& execState, JSC::JSValue value, JSC::JSValue key, ExceptionCode& ec)
 {
     auto idbKey = scriptValueToIDBKey(execState, key);
-    return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, ec);
+    return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, InlineKeyCheck::Perform, ec);
 }
 
 RefPtr<WebCore::IDBRequest> IDBObjectStore::put(JSC::ExecState& execState, JSC::JSValue value, JSC::JSValue key, ExceptionCode& ec)
 {
     auto idbKey = scriptValueToIDBKey(execState, key);
-    return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::Overwrite, ec);
+    return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::Overwrite, InlineKeyCheck::Perform, ec);
 }
 
 RefPtr<WebCore::IDBRequest> IDBObjectStore::put(JSC::ExecState& state, JSC::JSValue value, ExceptionCode& ec)
 {
-    return putOrAdd(state, value, nullptr, IndexedDB::ObjectStoreOverwriteMode::Overwrite, ec);
+    return putOrAdd(state, value, nullptr, IndexedDB::ObjectStoreOverwriteMode::Overwrite, InlineKeyCheck::Perform, ec);
 }
 
-RefPtr<WebCore::IDBRequest> IDBObjectStore::putOrAdd(JSC::ExecState& state, JSC::JSValue value, RefPtr<IDBKey> key, IndexedDB::ObjectStoreOverwriteMode overwriteMode, ExceptionCode& ec)
+RefPtr<WebCore::IDBRequest> IDBObjectStore::putForCursorUpdate(JSC::ExecState& state, JSC::JSValue value, JSC::JSValue key, ExceptionCode& ec)
 {
+    return putOrAdd(state, value, scriptValueToIDBKey(state, key), IndexedDB::ObjectStoreOverwriteMode::Overwrite, InlineKeyCheck::DoNotPerform, ec);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::putOrAdd(JSC::ExecState& state, JSC::JSValue value, RefPtr<IDBKey> key, IndexedDB::ObjectStoreOverwriteMode overwriteMode, InlineKeyCheck inlineKeyCheck, ExceptionCode& ec)
+{
     LOG(IndexedDB, "IDBObjectStore::putOrAdd");
 
     if (m_transaction->isReadOnly()) {
@@ -261,7 +266,7 @@
 
     bool usesInlineKeys = !m_info.keyPath().isNull();
     bool usesKeyGenerator = autoIncrement();
-    if (usesInlineKeys) {
+    if (usesInlineKeys && inlineKeyCheck == InlineKeyCheck::Perform) {
         if (key) {
             ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
             return nullptr;

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h (192805 => 192806)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h	2015-11-30 18:46:13 UTC (rev 192805)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h	2015-11-30 19:05:05 UTC (rev 192806)
@@ -78,6 +78,8 @@
     virtual RefPtr<WebCore::IDBRequest> count(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&) override final;
     virtual RefPtr<WebCore::IDBRequest> count(ScriptExecutionContext*, const Deprecated::ScriptValue& key, ExceptionCode&) override final;
 
+    RefPtr<WebCore::IDBRequest> putForCursorUpdate(JSC::ExecState&, JSC::JSValue, JSC::JSValue key, ExceptionCode&);
+
     RefPtr<WebCore::IDBRequest> deleteFunction(ScriptExecutionContext*, JSC::JSValue key, ExceptionCode&);
 
     void markAsDeleted();
@@ -92,7 +94,12 @@
 private:
     IDBObjectStore(const IDBObjectStoreInfo&, IDBTransaction&);
 
-    RefPtr<WebCore::IDBRequest> putOrAdd(JSC::ExecState&, JSC::JSValue, RefPtr<IDBKey>, IndexedDB::ObjectStoreOverwriteMode, ExceptionCode&);
+    enum class InlineKeyCheck {
+        Perform,
+        DoNotPerform,
+    };
+
+    RefPtr<WebCore::IDBRequest> putOrAdd(JSC::ExecState&, JSC::JSValue, RefPtr<IDBKey>, IndexedDB::ObjectStoreOverwriteMode, InlineKeyCheck, ExceptionCode&);
     RefPtr<WebCore::IDBRequest> doCount(ScriptExecutionContext&, const IDBKeyRangeData&, ExceptionCode&);
 
     IDBObjectStoreInfo m_info;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to