Title: [207821] trunk
Revision
207821
Author
[email protected]
Date
2016-10-25 09:25:27 -0700 (Tue, 25 Oct 2016)

Log Message

IndexedDB 2.0: Support new IDBTransaction interfaces.
<rdar://problem/28806928> and https://bugs.webkit.org/show_bug.cgi?id=163927

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/idbobjectstore-rename-abort-expected.txt:
* web-platform-tests/IndexedDB/idbobjectstore-rename-store-expected.txt:
* web-platform-tests/IndexedDB/idbtransaction_objectStoreNames-expected.txt:
* web-platform-tests/IndexedDB/transaction-abort-multiple-metadata-revert-expected.txt:
* web-platform-tests/IndexedDB/transaction-abort-object-store-metadata-revert-expected.txt:

Source/WebCore:

Tests: storage/indexeddb/modern/idbtransaction-objectstores-1-private.html
       storage/indexeddb/modern/idbtransaction-objectstores-1.html
       At least partially passing results on 5 previously failed W3C tests.

The "new IDBTransaction interfaces" really just means adding the property IDBTransaction.objectStoreNames.

* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::objectStoreNames):
* Modules/indexeddb/IDBTransaction.h:
* Modules/indexeddb/IDBTransaction.idl:

LayoutTests:

* storage/indexeddb/modern/idbtransaction-objectstores-1-expected.txt: Added.
* storage/indexeddb/modern/idbtransaction-objectstores-1-private-expected.txt: Added.
* storage/indexeddb/modern/idbtransaction-objectstores-1-private.html: Added.
* storage/indexeddb/modern/idbtransaction-objectstores-1.html: Added.
* storage/indexeddb/modern/resources/idbtransaction-objectstores-1.js: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (207820 => 207821)


--- trunk/LayoutTests/ChangeLog	2016-10-25 15:52:25 UTC (rev 207820)
+++ trunk/LayoutTests/ChangeLog	2016-10-25 16:25:27 UTC (rev 207821)
@@ -1,3 +1,16 @@
+2016-10-25  Brady Eidson  <[email protected]>
+
+        IndexedDB 2.0: Support new IDBTransaction interfaces.
+        <rdar://problem/28806928> and https://bugs.webkit.org/show_bug.cgi?id=163927
+
+        Reviewed by Sam Weinig.
+
+        * storage/indexeddb/modern/idbtransaction-objectstores-1-expected.txt: Added.
+        * storage/indexeddb/modern/idbtransaction-objectstores-1-private-expected.txt: Added.
+        * storage/indexeddb/modern/idbtransaction-objectstores-1-private.html: Added.
+        * storage/indexeddb/modern/idbtransaction-objectstores-1.html: Added.
+        * storage/indexeddb/modern/resources/idbtransaction-objectstores-1.js: Added.
+
 2016-10-25  Alex Christensen  <[email protected]>
 
         Rebase test after r207805

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (207820 => 207821)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-10-25 15:52:25 UTC (rev 207820)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-10-25 16:25:27 UTC (rev 207821)
@@ -1,3 +1,16 @@
+2016-10-25  Brady Eidson  <[email protected]>
+
+        IndexedDB 2.0: Support new IDBTransaction interfaces.
+        <rdar://problem/28806928> and https://bugs.webkit.org/show_bug.cgi?id=163927
+
+        Reviewed by Sam Weinig.
+
+        * web-platform-tests/IndexedDB/idbobjectstore-rename-abort-expected.txt:
+        * web-platform-tests/IndexedDB/idbobjectstore-rename-store-expected.txt:
+        * web-platform-tests/IndexedDB/idbtransaction_objectStoreNames-expected.txt:
+        * web-platform-tests/IndexedDB/transaction-abort-multiple-metadata-revert-expected.txt:
+        * web-platform-tests/IndexedDB/transaction-abort-object-store-metadata-revert-expected.txt:
+
 2016-10-24  Jiewen Tan  <[email protected]>
 
         Update SubtleCrypto::generateKey to match the latest spec

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-rename-abort-expected.txt (207820 => 207821)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-rename-abort-expected.txt	2016-10-25 15:52:25 UTC (rev 207820)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-rename-abort-expected.txt	2016-10-25 16:25:27 UTC (rev 207821)
@@ -1,6 +1,4 @@
 
-Harness Error (TIMEOUT), message = null
+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"
 
-FAIL IndexedDB object store rename in aborted transaction undefined is not an object (evaluating 'actual.length')
-TIMEOUT IndexedDB object store creation and rename in an aborted transaction Test timed out
-

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-rename-store-expected.txt (207820 => 207821)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-rename-store-expected.txt	2016-10-25 15:52:25 UTC (rev 207820)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-rename-store-expected.txt	2016-10-25 16:25:27 UTC (rev 207821)
@@ -1,6 +1,6 @@
 
-FAIL IndexedDB object store rename in new transaction undefined is not an object (evaluating 'actual.length')
-FAIL IndexedDB object store rename in the transaction where it is created undefined is not an object (evaluating 'actual.length')
+PASS IndexedDB object store rename in new transaction 
+PASS IndexedDB object store rename in the transaction where it is created 
 PASS IndexedDB object store rename covers index 
 FAIL IndexedDB object store rename covers key generator assert_equals: Renaming an object store should not change the state of its key generator expected 345680 but got 345679
 PASS IndexedDB object store rename to the same name succeeds 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbtransaction_objectStoreNames-expected.txt (207820 => 207821)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbtransaction_objectStoreNames-expected.txt	2016-10-25 15:52:25 UTC (rev 207820)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbtransaction_objectStoreNames-expected.txt	2016-10-25 16:25:27 UTC (rev 207821)
@@ -1,10 +1,10 @@
 
-FAIL IDBTransaction.objectStoreNames - during upgrade transaction undefined is not an object (evaluating 'actual.length')
-FAIL IDBTransaction.objectStoreNames - value after close undefined is not an object (evaluating 'actual.length')
-FAIL IDBTransaction.objectStoreNames - transaction scope undefined is not an object (evaluating 'actual.length')
-FAIL IDBTransaction.objectStoreNames - value after commit undefined is not an object (evaluating 'actual.length')
-FAIL IDBTransaction.objectStoreNames - value after abort undefined is not an object (evaluating 'actual.length')
-FAIL IDBTransaction.objectStoreNames - sorting undefined is not an object (evaluating 'actual.length')
-FAIL IDBTransaction.objectStoreNames - no duplicates undefined is not an object (evaluating 'actual.length')
-FAIL IDBTransaction.objectStoreNames - unusual names undefined is not an object (evaluating 'actual.length')
+PASS IDBTransaction.objectStoreNames - during upgrade transaction 
+PASS IDBTransaction.objectStoreNames - value after close 
+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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/transaction-abort-multiple-metadata-revert-expected.txt (207820 => 207821)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/transaction-abort-multiple-metadata-revert-expected.txt	2016-10-25 15:52:25 UTC (rev 207820)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/transaction-abort-multiple-metadata-revert-expected.txt	2016-10-25 16:25:27 UTC (rev 207821)
@@ -1,5 +1,5 @@
 
-FAIL Deleted indexes in newly created stores are still marked as deleted after the transaction aborts undefined is not an object (evaluating 'actual.length')
-FAIL Deleted indexes in deleted stores are still marked as not-deleted after the transaction aborts undefined is not an object (evaluating 'actual.length')
-FAIL Deleted indexes in created+deleted stores are still marked as deleted after their transaction aborts undefined is not an object (evaluating 'actual.length')
+FAIL Deleted indexes in newly created stores are still marked as deleted after the transaction aborts assert_throws: IDBObjectStore.get should throw InvalidStateError, indicating that the store is marked for deletion, immediately after IDBTransaction.abort() returns function "() => store.get('query')" threw object "TransactionInactiveError (DOM IDBDatabase Exception): Fai..." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
+FAIL Deleted indexes in deleted stores are still marked as not-deleted after the transaction aborts assert_array_equals: IDBObjectStore.indexNames for the deleted store should be empty immediately after IDBDatabase.deleteObjectStore() returns lengths differ, expected 0 got 1
+FAIL Deleted indexes in created+deleted stores are still marked as deleted after their transaction aborts assert_array_equals: IDBObjectStore.indexNames should be empty immediately after IDBDatabase.deleteObjectStore() returns lengths differ, expected 0 got 1
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/transaction-abort-object-store-metadata-revert-expected.txt (207820 => 207821)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/transaction-abort-object-store-metadata-revert-expected.txt	2016-10-25 15:52:25 UTC (rev 207820)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/transaction-abort-object-store-metadata-revert-expected.txt	2016-10-25 16:25:27 UTC (rev 207821)
@@ -1,6 +1,6 @@
 
-FAIL Created stores get marked as deleted after their transaction aborts undefined is not an object (evaluating 'actual.length')
-FAIL Deleted stores get marked as not-deleted after the transaction aborts undefined is not an object (evaluating 'actual.length')
-FAIL Created+deleted stores are still marked as deleted after their transaction aborts undefined is not an object (evaluating 'actual.length')
-FAIL Un-instantiated deleted stores get marked as not-deleted after the transaction aborts undefined is not an object (evaluating 'actual.length')
+FAIL Created stores get marked as deleted after their transaction aborts assert_throws: IDBObjectStore.get should throw InvalidStateError, indicating that the store is marked for deletion, immediately after IDBTransaction.abort() returns function "() => store.get('query')" threw object "TransactionInactiveError (DOM IDBDatabase Exception): Fai..." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
+PASS Deleted stores get marked as not-deleted after the transaction aborts 
+FAIL Created+deleted stores are still marked as deleted after their transaction aborts assert_throws: IDBObjectStore.get should throw InvalidStateError, indicating that the store is still marked for deletion, immediately after IDBTransaction.abort() returns function "() => store.get('query')" threw object "TransactionInactiveError (DOM IDBDatabase Exception): Fai..." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
+PASS Un-instantiated deleted stores get marked as not-deleted after the transaction aborts 
 

Added: trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstores-1-expected.txt (0 => 207821)


--- trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstores-1-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstores-1-expected.txt	2016-10-25 16:25:27 UTC (rev 207821)
@@ -0,0 +1,33 @@
+This tests the IDBTransaction.objectStoreNames API
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
+Upgrade needed: Old version - 0 New version - 1
+List has 1 entries
+Entry 0: ObjectStore1
+List has 2 entries
+Entry 0: ObjectStore1
+Entry 1: ObjectStore2
+List has 1 entries
+Entry 0: ObjectStore2
+List has 3 entries
+Entry 0: ObjectStore2
+Entry 1: ObjectStore3
+Entry 2: ObjectStore4
+Version change transaction complete
+List has 3 entries
+Entry 0: ObjectStore2
+Entry 1: ObjectStore3
+Entry 2: ObjectStore4
+List has 2 entries
+Entry 0: ObjectStore2
+Entry 1: ObjectStore4
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstores-1-private-expected.txt (0 => 207821)


--- trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstores-1-private-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstores-1-private-expected.txt	2016-10-25 16:25:27 UTC (rev 207821)
@@ -0,0 +1,33 @@
+This tests the IDBTransaction.objectStoreNames API
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
+Upgrade needed: Old version - 0 New version - 1
+List has 1 entries
+Entry 0: ObjectStore1
+List has 2 entries
+Entry 0: ObjectStore1
+Entry 1: ObjectStore2
+List has 1 entries
+Entry 0: ObjectStore2
+List has 3 entries
+Entry 0: ObjectStore2
+Entry 1: ObjectStore3
+Entry 2: ObjectStore4
+Version change transaction complete
+List has 3 entries
+Entry 0: ObjectStore2
+Entry 1: ObjectStore3
+Entry 2: ObjectStore4
+List has 2 entries
+Entry 0: ObjectStore2
+Entry 1: ObjectStore4
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstores-1-private.html (0 => 207821)


--- trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstores-1-private.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstores-1-private.html	2016-10-25 16:25:27 UTC (rev 207821)
@@ -0,0 +1,12 @@
+<html>
+<head>
+<script>
+enablePrivateBrowsing = true;
+</script>
+<script src=""
+<script src=""
+</head>
+<body>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstores-1.html (0 => 207821)


--- trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstores-1.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstores-1.html	2016-10-25 16:25:27 UTC (rev 207821)
@@ -0,0 +1,9 @@
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/storage/indexeddb/modern/resources/idbtransaction-objectstores-1.js (0 => 207821)


--- trunk/LayoutTests/storage/indexeddb/modern/resources/idbtransaction-objectstores-1.js	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/resources/idbtransaction-objectstores-1.js	2016-10-25 16:25:27 UTC (rev 207821)
@@ -0,0 +1,63 @@
+description("This tests the IDBTransaction.objectStoreNames API");
+
+indexedDBTest(prepareDatabase);
+
+function done()
+{
+    finishJSTest();
+}
+
+function dumpList(list)
+{
+	debug("List has " + list.length + " entries");
+	
+	for (i = 0; i < list.length; ++i)
+		debug("Entry " + i + ": " + list.item(i));
+}
+
+function prepareDatabase(event)
+{
+    debug("Upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+    
+    var tx = event.target.transaction;
+    db = event.target.result;
+
+	db.createObjectStore("ObjectStore1");
+	dumpList(tx.objectStoreNames);
+
+	db.createObjectStore("ObjectStore2");
+	dumpList(tx.objectStoreNames);
+
+	db.deleteObjectStore("ObjectStore1");
+	dumpList(tx.objectStoreNames);
+
+	db.createObjectStore("ObjectStore3");
+	db.createObjectStore("ObjectStore4");
+	dumpList(tx.objectStoreNames);
+	
+    tx._onabort_ = function(event) {
+        debug("Version change transaction unexpected abort");
+        done();
+    }
+
+    tx._oncomplete_ = function(event) {
+        debug("Version change transaction complete");
+        continueTest();
+    }
+
+    tx._onerror_ = function(event) {
+        debug("Version change transaction unexpected error");
+        done();
+    }
+}
+
+function continueTest()
+{
+	tx = db.transaction(["ObjectStore2", "ObjectStore3", "ObjectStore4"]);
+	dumpList(tx.objectStoreNames);
+
+	tx = db.transaction(["ObjectStore2", "ObjectStore4"]);
+	dumpList(tx.objectStoreNames);
+	
+	done();
+}

Modified: trunk/Source/WebCore/ChangeLog (207820 => 207821)


--- trunk/Source/WebCore/ChangeLog	2016-10-25 15:52:25 UTC (rev 207820)
+++ trunk/Source/WebCore/ChangeLog	2016-10-25 16:25:27 UTC (rev 207821)
@@ -1,3 +1,21 @@
+2016-10-25  Brady Eidson  <[email protected]>
+
+        IndexedDB 2.0: Support new IDBTransaction interfaces.
+        <rdar://problem/28806928> and https://bugs.webkit.org/show_bug.cgi?id=163927
+
+        Reviewed by Sam Weinig.
+
+        Tests: storage/indexeddb/modern/idbtransaction-objectstores-1-private.html
+               storage/indexeddb/modern/idbtransaction-objectstores-1.html
+               At least partially passing results on 5 previously failed W3C tests.
+
+        The "new IDBTransaction interfaces" really just means adding the property IDBTransaction.objectStoreNames.
+
+        * Modules/indexeddb/IDBTransaction.cpp:
+        (WebCore::IDBTransaction::objectStoreNames):
+        * Modules/indexeddb/IDBTransaction.h:
+        * Modules/indexeddb/IDBTransaction.idl:
+
 2016-10-25  Youenn Fablet  <[email protected]>
 
         MediaEndpointConfiguration does not need to be refcounted

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (207820 => 207821)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp	2016-10-25 15:52:25 UTC (rev 207820)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp	2016-10-25 16:25:27 UTC (rev 207821)
@@ -29,6 +29,7 @@
 #if ENABLE(INDEXED_DATABASE)
 
 #include "DOMError.h"
+#include "DOMStringList.h"
 #include "DOMWindow.h"
 #include "Event.h"
 #include "EventNames.h"
@@ -168,6 +169,20 @@
     return m_database->connectionProxy();
 }
 
+Ref<DOMStringList> IDBTransaction::objectStoreNames() const
+{
+    ASSERT(currentThread() == m_database->originThreadID());
+
+    const Vector<String> names = isVersionChange() ? m_database->info().objectStoreNames() : m_info.objectStores();
+
+    Ref<DOMStringList> objectStoreNames = DOMStringList::create();
+    for (auto& name : names)
+        objectStoreNames->append(name);
+
+    objectStoreNames->sort();
+    return objectStoreNames;
+}
+
 const String& IDBTransaction::mode() const
 {
     ASSERT(currentThread() == m_database->originThreadID());

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h (207820 => 207821)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h	2016-10-25 15:52:25 UTC (rev 207820)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h	2016-10-25 16:25:27 UTC (rev 207821)
@@ -42,6 +42,7 @@
 namespace WebCore {
 
 class DOMError;
+class DOMStringList;
 class IDBCursor;
 class IDBCursorInfo;
 class IDBDatabase;
@@ -78,6 +79,7 @@
     ~IDBTransaction() final;
 
     // IDBTransaction IDL
+    Ref<DOMStringList> objectStoreNames() const;
     const String& mode() const;
     IDBDatabase* db();
     DOMError* error() const;

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl (207820 => 207821)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl	2016-10-25 15:52:25 UTC (rev 207820)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl	2016-10-25 16:25:27 UTC (rev 207821)
@@ -30,6 +30,7 @@
     EnabledAtRuntime=IndexedDB,
     SkipVTableValidation,
 ] interface IDBTransaction : EventTarget {
+    readonly attribute DOMStringList objectStoreNames;
     readonly attribute DOMString mode;
     readonly attribute IDBDatabase db;
     readonly attribute DOMError error;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to