Modern IDB: Unskip storage/indexeddb/mozilla/global-data.html.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Nov 2015 19:41:05 +0000 (19:41 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Nov 2015 19:41:05 +0000 (19:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151557

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (Unskipping existing test storage/indexeddb/mozilla/global-data.html).

- Reworking some invalid ASSERTS
- Actually opening pending open-database-requests after a version change transaction completes
- Allow starting new transactions when the version change transaction has *started* finishing,
  but before it finishes finishing.

* Modules/indexeddb/client/IDBDatabaseImpl.cpp:
(WebCore::IDBClient::IDBDatabase::transaction):

* Modules/indexeddb/client/IDBTransactionImpl.h:

* Modules/indexeddb/server/MemoryObjectStore.cpp:
(WebCore::IDBServer::MemoryObjectStore::~MemoryObjectStore):

* Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
(WebCore::IDBServer::MemoryObjectStoreCursor::keyAdded): Deleted.

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::UniqueIDBDatabase):
(WebCore::IDBServer::UniqueIDBDatabase::handleOpenDatabaseOperations):
(WebCore::IDBServer::UniqueIDBDatabase::commitTransaction):
* Modules/indexeddb/server/UniqueIDBDatabase.h:

LayoutTests:

* platform/mac-wk1/TestExpectations:

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

LayoutTests/ChangeLog
LayoutTests/platform/mac-wk1/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp
Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h
Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp
Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h

index a6b7178..57bad36 100644 (file)
@@ -1,3 +1,12 @@
+2015-11-23  Brady Eidson  <beidson@apple.com>
+
+        Modern IDB: Unskip storage/indexeddb/mozilla/global-data.html.
+        https://bugs.webkit.org/show_bug.cgi?id=151557
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk1/TestExpectations:
+
 2015-11-17  Sergio Villar Senin  <svillar@igalia.com>
 
         ASSERTION FAILED: freeSpace >= 0 in WebCore::RenderGrid::computeTrackSizesForDirection
index 9ec44ef..87fe6b4 100644 (file)
@@ -72,6 +72,7 @@ inspector/indexeddb
 
 # But Modern IndexedDB is.
 storage/indexeddb/modern [ Pass ]
+storage/indexeddb/mozilla/global-data.html [ Pass ]
 
 # Fails with WebKit1 only.
 editing/secure-input/reset-state-on-navigation.html [ Failure ]
index d5f6a8a..acf6bd5 100644 (file)
@@ -1,3 +1,34 @@
+2015-11-23  Brady Eidson  <beidson@apple.com>
+
+        Modern IDB: Unskip storage/indexeddb/mozilla/global-data.html.
+        https://bugs.webkit.org/show_bug.cgi?id=151557
+
+        Reviewed by Alex Christensen.
+
+        No new tests (Unskipping existing test storage/indexeddb/mozilla/global-data.html).
+
+        - Reworking some invalid ASSERTS
+        - Actually opening pending open-database-requests after a version change transaction completes
+        - Allow starting new transactions when the version change transaction has *started* finishing, 
+          but before it finishes finishing.
+
+        * Modules/indexeddb/client/IDBDatabaseImpl.cpp:
+        (WebCore::IDBClient::IDBDatabase::transaction):
+        
+        * Modules/indexeddb/client/IDBTransactionImpl.h:
+        
+        * Modules/indexeddb/server/MemoryObjectStore.cpp:
+        (WebCore::IDBServer::MemoryObjectStore::~MemoryObjectStore):
+        
+        * Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
+        (WebCore::IDBServer::MemoryObjectStoreCursor::keyAdded): Deleted.
+        
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabase::UniqueIDBDatabase):
+        (WebCore::IDBServer::UniqueIDBDatabase::handleOpenDatabaseOperations):
+        (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction):
+        * Modules/indexeddb/server/UniqueIDBDatabase.h:
+
 2015-11-23  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         Remove DOMPromiseWithCallback
index 02c4853..ad7ac30 100644 (file)
@@ -156,7 +156,7 @@ RefPtr<WebCore::IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext*
         return nullptr;
     }
 
-    if (m_versionChangeTransaction) {
+    if (m_versionChangeTransaction && !m_versionChangeTransaction->isFinishedOrFinishing()) {
         ec = INVALID_STATE_ERR;
         return nullptr;
     }
index d370480..8928185 100644 (file)
@@ -123,11 +123,11 @@ public:
 
     void operationDidComplete(TransactionOperation&);
 
+    bool isFinishedOrFinishing() const;
+
 private:
     IDBTransaction(IDBDatabase&, const IDBTransactionInfo&, IDBOpenDBRequest*);
 
-    bool isFinishedOrFinishing() const;
-
     void commit();
 
     void finishAbortOrCommit();
index 4b0be48..f320c70 100644 (file)
@@ -55,7 +55,7 @@ MemoryObjectStore::MemoryObjectStore(const IDBObjectStoreInfo& info)
 
 MemoryObjectStore::~MemoryObjectStore()
 {
-    ASSERT(!m_writeTransaction);
+    m_writeTransaction = nullptr;
 }
 
 MemoryIndex* MemoryObjectStore::indexForIdentifier(uint64_t identifier)
index fb13630..93410d2 100644 (file)
@@ -62,8 +62,6 @@ void MemoryObjectStoreCursor::keyDeleted(const IDBKeyData& key)
 
 void MemoryObjectStoreCursor::keyAdded(std::set<IDBKeyData>::iterator iterator)
 {
-    ASSERT(m_currentPositionKey.isValid());
-
     if (hasIterators())
         return;
 
index 8a25133..8f91d73 100644 (file)
@@ -45,6 +45,7 @@ UniqueIDBDatabase::UniqueIDBDatabase(IDBServer& server, const IDBDatabaseIdentif
     : m_server(server)
     , m_identifier(identifier)
     , m_deleteOrRunTransactionsTimer(*this, &UniqueIDBDatabase::deleteOrRunTransactionsTimerFired)
+    , m_handleOpenDatabaseOperationsTimer(*this, &UniqueIDBDatabase::handleOpenDatabaseOperations)
 {
 }
 
@@ -115,6 +116,9 @@ void UniqueIDBDatabase::handleOpenDatabaseOperations()
     if (m_versionChangeDatabaseConnection)
         return;
 
+    if (m_pendingOpenDatabaseOperations.isEmpty())
+        return;
+
     auto operation = m_pendingOpenDatabaseOperations.takeFirst();
 
     // 3.3.1 Opening a database
@@ -713,6 +717,9 @@ void UniqueIDBDatabase::commitTransaction(UniqueIDBDatabaseTransaction& transact
         m_databaseInfo->setVersion(transaction.info().newVersion());
         m_versionChangeTransaction = nullptr;
         m_versionChangeDatabaseConnection = nullptr;
+
+        if (!m_handleOpenDatabaseOperationsTimer.isActive())
+            m_handleOpenDatabaseOperationsTimer.startOneShot(0);
     }
 
     uint64_t callbackID = storeCallback(callback);
index 3ac1c7a..9557648 100644 (file)
@@ -186,6 +186,7 @@ private:
     HashMap<uint64_t, CountCallback> m_countCallbacks;
 
     Timer m_deleteOrRunTransactionsTimer;
+    Timer m_handleOpenDatabaseOperationsTimer;
 
     Deque<RefPtr<UniqueIDBDatabaseTransaction>> m_pendingTransactions;
     HashMap<IDBResourceIdentifier, RefPtr<UniqueIDBDatabaseTransaction>> m_inProgressTransactions;