IndexedDB 2.0: Handle IDBIndex rename behavior properly when version change transacti...
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Nov 2016 06:37:09 +0000 (06:37 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Nov 2016 06:37:09 +0000 (06:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164403

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/idbindex-rename-abort-expected.txt: Updated to passing expectations.

Source/WebCore:

No new tests (Covered by existing test).

* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::rollbackInfoForVersionChangeAbort): Only rollback the info if this index
  already existed before this version change transaction.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208380 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex-rename-abort-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBIndex.cpp

index 97deedd..8d1cf24 100644 (file)
@@ -1,3 +1,12 @@
+2016-11-03  Brady Eidson  <beidson@apple.com>
+
+        IndexedDB 2.0: Handle IDBIndex rename behavior properly when version change transaction aborts.
+        https://bugs.webkit.org/show_bug.cgi?id=164403
+
+        Reviewed by Alex Christensen.
+
+        * web-platform-tests/IndexedDB/idbindex-rename-abort-expected.txt: Updated to passing expectations.
+
 2016-11-03  Ryosuke Niwa  <rniwa@webkit.org>
 
         Update custom elements tests
index a498757..3867981 100644 (file)
@@ -1,4 +1,4 @@
 
 PASS IndexedDB index rename in aborted transaction 
-FAIL IndexedDB index creation and rename in an aborted transaction assert_equals: IDBIndex.name should reflect the last rename immediately after transaction.abort() returns expected "by_author_renamed_again" but got "by_author"
+PASS IndexedDB index creation and rename in an aborted transaction 
 
index b58e64e..142a414 100644 (file)
@@ -1,3 +1,16 @@
+2016-11-03  Brady Eidson  <beidson@apple.com>
+
+        IndexedDB 2.0: Handle IDBIndex rename behavior properly when version change transaction aborts.
+        https://bugs.webkit.org/show_bug.cgi?id=164403
+
+        Reviewed by Alex Christensen.
+
+        No new tests (Covered by existing test).
+
+        * Modules/indexeddb/IDBIndex.cpp:
+        (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort): Only rollback the info if this index
+          already existed before this version change transaction.
+
 2016-11-03  Youenn Fablet  <youenn@apple.com>
 
         [WebRTC] Introduce asynchronous backend createOffer API
index baee13d..8e90874 100644 (file)
@@ -134,6 +134,15 @@ bool IDBIndex::multiEntry() const
 void IDBIndex::rollbackInfoForVersionChangeAbort()
 {
     ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID());
+
+    // Only rollback to the original info if this index still exists in the rolled-back database info.
+    auto* objectStoreInfo = m_objectStore.transaction().database().info().infoForExistingObjectStore(m_objectStore.info().identifier());
+    if (!objectStoreInfo)
+        return;
+
+    if (!objectStoreInfo->hasIndex(m_info.identifier()))
+        return;
+
     m_info = m_originalInfo;
 }