Unreviewed, rolling out r191156.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Oct 2015 00:34:38 +0000 (00:34 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Oct 2015 00:34:38 +0000 (00:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150215

Introduced crashing test (Requested by bradee-oh on #webkit).

Reverted changeset:

"Modern IDB: Support IDBDatabase.close()."
https://bugs.webkit.org/show_bug.cgi?id=150150
http://trac.webkit.org/changeset/191156

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

18 files changed:
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/modern/opendatabase-versions-expected.txt
LayoutTests/storage/indexeddb/modern/opendatabase-versions.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h
Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp
Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h
Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp
Source/WebCore/Modules/indexeddb/server/IDBServer.cpp
Source/WebCore/Modules/indexeddb/server/IDBServer.h
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h
Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp
Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h

index cda9812..909546a 100644 (file)
@@ -1,3 +1,16 @@
+2015-10-15  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r191156.
+        https://bugs.webkit.org/show_bug.cgi?id=150215
+
+        Introduced crashing test (Requested by bradee-oh on #webkit).
+
+        Reverted changeset:
+
+        "Modern IDB: Support IDBDatabase.close()."
+        https://bugs.webkit.org/show_bug.cgi?id=150150
+        http://trac.webkit.org/changeset/191156
+
 2015-10-15  Brady Eidson  <beidson@apple.com>
 
         Modern IDB: Support IDBDatabase.close().
index 7250b95..ebcc163 100644 (file)
@@ -4,10 +4,6 @@ ALERT: [object IDBTransaction]
 ALERT: Version change complete (firstPhase). Database version is now - 1
 ALERT: [object IDBOpenDBRequest] (secondPhase)
 ALERT: Successfully opened database at version 1 (secondPhase)
-ALERT: [object IDBOpenDBRequest] (thirdPhase)
-ALERT: upgradeneeded (thirdPhase): old version - 1 new version - 2
-ALERT: [object IDBTransaction]
-ALERT: Version change complete (thirdPhase). Database version is now - 2
 ALERT: Done
 This test creates a new database with the default version, commits that versionchange transaction, and then reopens it at different versions to make sure the IDBOpenDBRequests behave appropriately.
 
index fb1d806..7be934c 100644 (file)
@@ -34,7 +34,6 @@ request.onupgradeneeded = function(e)
     request.transaction.oncomplete = function()
     {
         alert("Version change complete (firstPhase). Database version is now - " + request.transaction.db.version);
-        request.transaction.db.close();
         secondPhase();
     }
     request.transaction.onabort = function()
@@ -56,9 +55,10 @@ function secondPhase()
     request.onsuccess = function()
     {
         alert("Successfully opened database at version 1 (secondPhase)");
-        request.result.close();
-        request.result.close(); // Close it twice just for the heck of it
-        thirdPhase();
+
+        // FIXME: The following call will be used once bugs 150147-150150 are resolved.
+        // thirdPhase();
+        done();
     }
     request.onerror = function(e)
     {
@@ -78,13 +78,13 @@ function thirdPhase()
     alert(request + " (thirdPhase)");
     request.onsuccess = function()
     {
-        alert("Unexpected success (thirdPhase)");
-        done();
+     alert("Unexpected success (thirdPhase)");
+     done();
     }
     request.onerror = function(e)
     {
-        alert("Unexpected error (thirdPhase)");
-        done();
+     alert("Unexpected error (thirdPhase)");
+     done();
     }
     request.onupgradeneeded = function(e)
     {
@@ -93,7 +93,6 @@ function thirdPhase()
         request.transaction.oncomplete = function()
         {
             alert("Version change complete (thirdPhase). Database version is now - " + request.transaction.db.version);
-            request.transaction.db.close();
             fourthPhase();
         }
         request.transaction.onabort = function()
index e3a6067..dfb2399 100644 (file)
@@ -1,3 +1,16 @@
+2015-10-15  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r191156.
+        https://bugs.webkit.org/show_bug.cgi?id=150215
+
+        Introduced crashing test (Requested by bradee-oh on #webkit).
+
+        Reverted changeset:
+
+        "Modern IDB: Support IDBDatabase.close()."
+        https://bugs.webkit.org/show_bug.cgi?id=150150
+        http://trac.webkit.org/changeset/191156
+
 2015-10-15  Brady Eidson  <beidson@apple.com>
 
         Modern IDB: Support IDBDatabase.close().
index ddd0fff..018fc0e 100644 (file)
@@ -120,13 +120,6 @@ void IDBConnectionToServer::fireVersionChangeEvent(uint64_t /*databaseConnection
     // FIXME: Implement versionchange events firing on already-open transactions.
 }
 
-void IDBConnectionToServer::databaseConnectionClosed(IDBDatabase& database)
-{
-    LOG(IndexedDB, "IDBConnectionToServer::databaseConnectionClosed");
-
-    m_delegate->databaseConnectionClosed(database.databaseConnectionIdentifier());
-}
-
 void IDBConnectionToServer::registerDatabaseConnection(IDBDatabase& database)
 {
     ASSERT(!m_databaseConnections.contains(&database));
index 41ad432..4468f98 100644 (file)
@@ -63,7 +63,6 @@ public:
 
     void fireVersionChangeEvent(uint64_t databaseConnectionIdentifier, uint64_t requestedVersion);
 
-    void databaseConnectionClosed(IDBDatabase&);
     void registerDatabaseConnection(IDBDatabase&);
     void unregisterDatabaseConnection(IDBDatabase&);
 
index 5607bbb..6d2288e 100644 (file)
@@ -43,7 +43,6 @@ public:
     virtual void deleteDatabase(IDBRequestData&) = 0;
     virtual void openDatabase(IDBRequestData&) = 0;
     virtual void commitTransaction(IDBResourceIdentifier&) = 0;
-    virtual void databaseConnectionClosed(uint64_t databaseConnectionIdentifier) = 0;
 
     virtual void ref() = 0;
     virtual void deref() = 0;
index 7e7f548..6034b3f 100644 (file)
@@ -44,18 +44,17 @@ Ref<IDBDatabase> IDBDatabase::create(ScriptExecutionContext& context, IDBConnect
 
 IDBDatabase::IDBDatabase(ScriptExecutionContext& context, IDBConnectionToServer& connection, const IDBResultData& resultData)
     : WebCore::IDBDatabase(&context)
-    , m_serverConnection(connection)
+    , m_connection(connection)
     , m_info(resultData.databaseInfo())
-    , m_databaseConnectionIdentifier(resultData.databaseConnectionIdentifier())
 {
     suspendIfNeeded();
     relaxAdoptionRequirement();
-    m_serverConnection->registerDatabaseConnection(*this);
+    m_connection->registerDatabaseConnection(*this);
 }
 
 IDBDatabase::~IDBDatabase()
 {
-    m_serverConnection->unregisterDatabaseConnection(*this);
+    m_connection->unregisterDatabaseConnection(*this);
 }
 
 const String IDBDatabase::name() const
@@ -105,23 +104,7 @@ void IDBDatabase::deleteObjectStore(const String&, ExceptionCode&)
 
 void IDBDatabase::close()
 {
-    m_closePending = true;
-    maybeCloseInServer();
-}
-
-void IDBDatabase::maybeCloseInServer()
-{
-    if (m_closedInServer)
-        return;
-
-    // 3.3.9 Database closing steps
-    // Wait for all transactions created using this connection to complete.
-    // Once they are complete, this connection is closed.
-    if (!m_activeTransactions.isEmpty() || !m_committingTransactions.isEmpty())
-        return;
-
-    m_closedInServer = true;
-    m_serverConnection->databaseConnectionClosed(*this);
+    ASSERT_NOT_REACHED();
 }
 
 const char* IDBDatabase::activeDOMObjectName() const
@@ -159,7 +142,7 @@ void IDBDatabase::commitTransaction(IDBTransaction& transaction)
     ASSERT(refTransaction);
     m_committingTransactions.set(transaction.info().identifier(), WTF::move(refTransaction));
 
-    m_serverConnection->commitTransaction(transaction);
+    m_connection->commitTransaction(transaction);
 }
 
 void IDBDatabase::didCommitTransaction(IDBTransaction& transaction)
index 5ff67ac..fe31c2f 100644 (file)
@@ -70,7 +70,6 @@ public:
     virtual bool canSuspendForPageCache() const override final;
 
     const IDBDatabaseInfo& info() const { return m_info; }
-    uint64_t databaseConnectionIdentifier() const { return m_databaseConnectionIdentifier; }
 
     Ref<IDBTransaction> startVersionChangeTransaction(const IDBTransactionInfo&);
     void commitTransaction(IDBTransaction&);
@@ -81,15 +80,9 @@ private:
     IDBDatabase(ScriptExecutionContext&, IDBConnectionToServer&, const IDBResultData&);
 
     void didCommitOrAbortTransaction(IDBTransaction&);
-
-    void maybeCloseInServer();
-
-    Ref<IDBConnectionToServer> m_serverConnection;
+    
+    Ref<IDBConnectionToServer> m_connection;
     IDBDatabaseInfo m_info;
-    uint64_t m_databaseConnectionIdentifier { 0 };
-
-    bool m_closePending { false };
-    bool m_closedInServer { false };
 
     RefPtr<IDBTransaction> m_versionChangeTransaction;
     HashMap<IDBResourceIdentifier, RefPtr<IDBTransaction>> m_activeTransactions;
index 4a9369c..664e082 100644 (file)
@@ -44,7 +44,7 @@ IDBRequest::IDBRequest(IDBConnectionToServer& connection, ScriptExecutionContext
 
 RefPtr<WebCore::IDBAny> IDBRequest::result(ExceptionCode&) const
 {
-    return m_result;
+    return nullptr;
 }
 
 unsigned short IDBRequest::errorCode(ExceptionCode&) const
index 45e16fe..6e91285 100644 (file)
@@ -156,17 +156,6 @@ void IDBServer::commitTransaction(const IDBResourceIdentifier& transactionIdenti
     transaction->commit();
 }
 
-void IDBServer::databaseConnectionClosed(uint64_t databaseConnectionIdentifier)
-{
-    LOG(IndexedDB, "IDBServer::databaseConnectionClosed");
-
-    auto databaseConnection = m_databaseConnections.get(databaseConnectionIdentifier);
-    if (!databaseConnection)
-        return;
-
-    databaseConnection->connectionClosedFromClient();
-}
-
 void IDBServer::postDatabaseTask(std::unique_ptr<CrossThreadTask>&& task)
 {
     ASSERT(isMainThread());
index f07e87d..00d71ae 100644 (file)
@@ -58,7 +58,6 @@ public:
     void openDatabase(const IDBRequestData&);
     void deleteDatabase(const IDBRequestData&);
     void commitTransaction(const IDBResourceIdentifier&);
-    void databaseConnectionClosed(uint64_t databaseConnectionIdentifier);
 
     void postDatabaseTask(std::unique_ptr<CrossThreadTask>&&);
     void postDatabaseTaskReply(std::unique_ptr<CrossThreadTask>&&);
index a6c2f3d..9ff1c8e 100644 (file)
@@ -92,6 +92,7 @@ void UniqueIDBDatabase::handleOpenDatabaseOperations()
 
     Ref<UniqueIDBDatabaseConnection> connection = UniqueIDBDatabaseConnection::create(*this, operation->connection());
     UniqueIDBDatabaseConnection* rawConnection = &connection.get();
+    m_server.registerDatabaseConnection(*rawConnection);
 
     if (requestedVersion == m_databaseInfo->version()) {
         addOpenDatabaseConnection(WTF::move(connection));
@@ -250,26 +251,6 @@ void UniqueIDBDatabase::transactionDestroyed(UniqueIDBDatabaseTransaction& trans
         m_versionChangeTransaction = nullptr;
 }
 
-void UniqueIDBDatabase::connectionClosedFromClient(UniqueIDBDatabaseConnection& connection)
-{
-    ASSERT(isMainThread());
-    LOG(IndexedDB, "(main) UniqueIDBDatabase::connectionClosedFromClient");
-
-    if (m_versionChangeDatabaseConnection == &connection)
-        m_versionChangeDatabaseConnection = nullptr;
-
-    ASSERT(m_openDatabaseConnections.contains(&connection));
-
-    auto removedConnection = m_openDatabaseConnections.take(&connection);
-    if (removedConnection->hasNonFinishedTransactions()) {
-        m_closePendingDatabaseConnections.add(WTF::move(removedConnection));
-        return;
-    }
-
-    // FIXME: Now that a database connection has closed, previously blocked transactions might be runnable.
-    // Try to run them now.
-}
-
 void UniqueIDBDatabase::performErrorCallback(uint64_t callbackIdentifier, const IDBError& error)
 {
     auto callback = m_errorCallbacks.take(callbackIdentifier);
index 4dcf308..ce68452 100644 (file)
@@ -65,7 +65,6 @@ public:
 
     void commitTransaction(UniqueIDBDatabaseTransaction&, ErrorCallback);
     void transactionDestroyed(UniqueIDBDatabaseTransaction&);
-    void connectionClosedFromClient(UniqueIDBDatabaseConnection&);
 
 private:
     UniqueIDBDatabase(IDBServer&, const IDBDatabaseIdentifier&);
@@ -95,7 +94,6 @@ private:
     Deque<Ref<IDBServerOperation>> m_pendingOpenDatabaseOperations;
 
     HashSet<RefPtr<UniqueIDBDatabaseConnection>> m_openDatabaseConnections;
-    HashSet<RefPtr<UniqueIDBDatabaseConnection>> m_closePendingDatabaseConnections;
 
     RefPtr<IDBServerOperation> m_versionChangeOperation;
     RefPtr<UniqueIDBDatabaseConnection> m_versionChangeDatabaseConnection;
index 2b0bbc6..d7c4ac2 100644 (file)
 #if ENABLE(INDEXED_DATABASE)
 
 #include "IDBConnectionToClient.h"
-#include "IDBServer.h"
 #include "IDBTransactionInfo.h"
 #include "Logging.h"
-#include "UniqueIDBDatabase.h"
 
 namespace WebCore {
 namespace IDBServer {
@@ -53,25 +51,6 @@ UniqueIDBDatabaseConnection::UniqueIDBDatabaseConnection(UniqueIDBDatabase& data
     , m_database(database)
     , m_connectionToClient(connection)
 {
-    m_database.server().registerDatabaseConnection(*this);
-}
-
-UniqueIDBDatabaseConnection::~UniqueIDBDatabaseConnection()
-{
-    m_database.server().unregisterDatabaseConnection(*this);
-}
-
-bool UniqueIDBDatabaseConnection::hasNonFinishedTransactions() const
-{
-    return !m_transactionMap.isEmpty();
-}
-
-void UniqueIDBDatabaseConnection::connectionClosedFromClient()
-{
-    LOG(IndexedDB, "UniqueIDBDatabaseConnection::connectionClosedFromClient");
-
-    m_closePending = true;
-    m_database.connectionClosedFromClient(*this);
 }
 
 void UniqueIDBDatabaseConnection::fireVersionChangeEvent(uint64_t requestedVersion)
index 6ee8e7f..59850a8 100644 (file)
@@ -47,18 +47,12 @@ class UniqueIDBDatabaseConnection : public RefCounted<UniqueIDBDatabaseConnectio
 public:
     static Ref<UniqueIDBDatabaseConnection> create(UniqueIDBDatabase&, IDBConnectionToClient&);
 
-    ~UniqueIDBDatabaseConnection();
-
     uint64_t identifier() const { return m_identifier; }
     UniqueIDBDatabase& database() { return m_database; }
     IDBConnectionToClient& connectionToClient() { return m_connectionToClient; }
 
-    void connectionClosedFromClient();
-
     bool closePending() const { return m_closePending; }
 
-    bool hasNonFinishedTransactions() const;
-
     void fireVersionChangeEvent(uint64_t requestedVersion);
     UniqueIDBDatabaseTransaction& createVersionChangeTransaction(uint64_t newVersion);
 
index 7c2f9bf..080a186 100644 (file)
@@ -127,14 +127,6 @@ void InProcessIDBServer::fireVersionChangeEvent(IDBServer::UniqueIDBDatabaseConn
     });
 }
 
-void InProcessIDBServer::databaseConnectionClosed(uint64_t databaseConnectionIdentifier)
-{
-    RefPtr<InProcessIDBServer> self(this);
-    RunLoop::current().dispatch([this, self, databaseConnectionIdentifier] {
-        m_server->databaseConnectionClosed(databaseConnectionIdentifier);
-    });
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(INDEXED_DATABASE)
index dc09451..0f1c393 100644 (file)
@@ -57,7 +57,6 @@ public:
     virtual void deleteDatabase(IDBRequestData&) override final;
     virtual void openDatabase(IDBRequestData&) override final;
     virtual void commitTransaction(IDBResourceIdentifier&) override final;
-    virtual void databaseConnectionClosed(uint64_t databaseConnectionIdentifier) override final;
 
     // IDBConnectionToClient
     virtual uint64_t identifier() const override;