IndexedDB 2.0: W3C test IndexedDB/idbtransaction_objectStoreNames.html fails.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Nov 2016 23:34:41 +0000 (23:34 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Nov 2016 23:34:41 +0000 (23:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164528

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/idbtransaction_objectStoreNames-expected.txt:

Source/WebCore:

No new tests (Covered by existing test).

* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::transaction): De-dupe the input names.

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

LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbtransaction_objectStoreNames-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBDatabase.cpp

index e8fd50e..41d45a8 100644 (file)
@@ -1,5 +1,14 @@
 2016-11-09  Brady Eidson  <beidson@apple.com>
 
+        IndexedDB 2.0: W3C test IndexedDB/idbtransaction_objectStoreNames.html fails.
+        https://bugs.webkit.org/show_bug.cgi?id=164528
+
+        Reviewed by Alex Christensen.
+
+        * web-platform-tests/IndexedDB/idbtransaction_objectStoreNames-expected.txt:
+
+2016-11-09  Brady Eidson  <beidson@apple.com>
+
         IndexedDB 2.0: Implement new IDBCursor.continuePrimaryKey function.
         https://bugs.webkit.org/show_bug.cgi?id=164404
 
index 4023c0d..981259c 100644 (file)
@@ -5,6 +5,6 @@ PASS IDBTransaction.objectStoreNames - transaction scope
 PASS IDBTransaction.objectStoreNames - value after commit 
 PASS IDBTransaction.objectStoreNames - value after abort 
 PASS IDBTransaction.objectStoreNames - sorting 
-FAIL IDBTransaction.objectStoreNames - no duplicates assert_array_equals: transaction objectStoreNames should not have duplicates lengths differ, expected 2 got 3
-FAIL IDBTransaction.objectStoreNames - unusual names assert_array_equals: transaction should have names sorted with no duplicates lengths differ, expected 14 got 28
+PASS IDBTransaction.objectStoreNames - no duplicates 
+PASS IDBTransaction.objectStoreNames - unusual names 
 
index 4b8f726..a40d22e 100644 (file)
@@ -1,5 +1,17 @@
 2016-11-09  Brady Eidson  <beidson@apple.com>
 
+        IndexedDB 2.0: W3C test IndexedDB/idbtransaction_objectStoreNames.html fails.
+        https://bugs.webkit.org/show_bug.cgi?id=164528
+
+        Reviewed by Alex Christensen.
+
+        No new tests (Covered by existing test).
+
+        * Modules/indexeddb/IDBDatabase.cpp:
+        (WebCore::IDBDatabase::transaction): De-dupe the input names.
+
+2016-11-09  Brady Eidson  <beidson@apple.com>
+
         IndexedDB 2.0: Implement new IDBCursor.continuePrimaryKey function.
         https://bugs.webkit.org/show_bug.cgi?id=164404
 
index f8d206f..f03e1ed 100644 (file)
@@ -185,6 +185,15 @@ ExceptionOr<Ref<IDBTransaction>> IDBDatabase::transaction(StringOrVectorOfString
     if (m_versionChangeTransaction && !m_versionChangeTransaction->isFinishedOrFinishing())
         return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': A version change transaction is running.") };
 
+    // It is valid for javascript to pass in a list of object store names with the same name listed twice,
+    // so we need to put them all in a set to get a unique list.
+    HashSet<String> objectStoreSet;
+    for (auto& objectStore : objectStores)
+        objectStoreSet.add(objectStore);
+
+    objectStores.clear();
+    copyToVector(objectStoreSet, objectStores);
+
     for (auto& objectStoreName : objectStores) {
         if (m_info.hasObjectStore(objectStoreName))
             continue;