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

Reviewed by Beth Dakin.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/idbobjectstore-rename-abort-expected.txt:

Source/WebCore:

No new tests (Covered by existing tests).

* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::rollbackForVersionChangeAbort):

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

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

index 613053f..06fff3f 100644 (file)
@@ -1,5 +1,14 @@
 2016-11-04  Brady Eidson  <beidson@apple.com>
 
+        IndexedDB 2.0: Handle IDBObjectStore rename behavior properly when version change transaction aborts.
+        https://bugs.webkit.org/show_bug.cgi?id=164416
+
+        Reviewed by Beth Dakin.
+
+        * web-platform-tests/IndexedDB/idbobjectstore-rename-abort-expected.txt:
+
+2016-11-04  Brady Eidson  <beidson@apple.com>
+
         IndexedDB 2.0: Use IDB-specific exceptions in places where the generic exceptions are currently used.
         https://bugs.webkit.org/show_bug.cgi?id=164406
 
index 4795218..7b2462f 100644 (file)
@@ -1,4 +1,4 @@
 
 PASS IndexedDB object store rename in aborted transaction 
-FAIL IndexedDB object store creation and rename in an aborted transaction assert_equals: IDBObjectStore.name should reflect the last rename immediately after transaction.abort() returns expected "not_books_renamed_again" but got "not_books"
+PASS IndexedDB object store creation and rename in an aborted transaction 
 
index 1106416..ec6d7f3 100644 (file)
@@ -1,3 +1,15 @@
+2016-11-04  Brady Eidson  <beidson@apple.com>
+
+        IndexedDB 2.0: Handle IDBObjectStore rename behavior properly when version change transaction aborts.
+        https://bugs.webkit.org/show_bug.cgi?id=164416
+
+        Reviewed by Beth Dakin.
+
+        No new tests (Covered by existing tests).
+
+        * Modules/indexeddb/IDBObjectStore.cpp:
+        (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
+
 2016-11-04  Keith Rollin  <krollin@apple.com>
 
         NetworkSession: Add NetworkDataTask implementation for blobs
index b967d19..408e25d 100644 (file)
@@ -603,8 +603,13 @@ void IDBObjectStore::markAsDeleted()
 void IDBObjectStore::rollbackForVersionChangeAbort()
 {
     ASSERT(currentThread() == m_transaction->database().originThreadID());
+
+    String currentName = m_info.name();
     m_info = m_originalInfo;
 
+    if (!transaction().database().info().infoForExistingObjectStore(m_info.identifier()))
+        m_info.rename(currentName);
+
     Locker<Lock> locker(m_referencedIndexLock);
     for (auto& index : m_referencedIndexes.values())
         index->rollbackInfoForVersionChangeAbort();