Title: [193784] trunk
Revision
193784
Author
beid...@apple.com
Date
2015-12-08 14:12:34 -0800 (Tue, 08 Dec 2015)

Log Message

Modern IDB: Fire blocked events for upgrade requests that are blocked.
https://bugs.webkit.org/show_bug.cgi?id=152007

Reviewed by Alex Christensen.

Source/WebCore:

Test: storage/indexeddb/modern/blocked-open-db-requests.html
      And some that used to fail now pass.
      And some that used to timeout now complete.

* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::notifyOpenDBRequestBlocked):
* Modules/indexeddb/client/IDBConnectionToServer.h:

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

* Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
(WebCore::IDBClient::IDBOpenDBRequest::requestBlocked):
* Modules/indexeddb/client/IDBOpenDBRequestImpl.h:

* Modules/indexeddb/client/IDBRequestImpl.cpp:
(WebCore::IDBClient::IDBRequest::dispatchEvent):

* Modules/indexeddb/server/IDBConnectionToClient.cpp:
(WebCore::IDBServer::IDBConnectionToClient::notifyOpenDBRequestBlocked):
* Modules/indexeddb/server/IDBConnectionToClient.h:
* Modules/indexeddb/server/IDBConnectionToClientDelegate.h:

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::handleOpenDatabaseOperations): When a request that would
  result in a version change transaction is blocked by open connections, notify it.

* Modules/indexeddb/shared/InProcessIDBServer.cpp:
(WebCore::InProcessIDBServer::notifyOpenDBRequestBlocked):
* Modules/indexeddb/shared/InProcessIDBServer.h:

LayoutTests:

* platform/mac-wk1/TestExpectations:

* storage/indexeddb/modern/blocked-open-db-requests-expected.txt: Added.
* storage/indexeddb/modern/blocked-open-db-requests.html: Added.
* storage/indexeddb/modern/resources/blocked-open-db-requests.js: Added.

* storage/indexeddb/modern/deleteobjectstore-1.html: Fix subtly broken test.
* storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures.html: Ditto.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (193783 => 193784)


--- trunk/LayoutTests/ChangeLog	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/LayoutTests/ChangeLog	2015-12-08 22:12:34 UTC (rev 193784)
@@ -1,3 +1,19 @@
+2015-12-08  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: Fire blocked events for upgrade requests that are blocked.
+        https://bugs.webkit.org/show_bug.cgi?id=152007
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk1/TestExpectations:
+
+        * storage/indexeddb/modern/blocked-open-db-requests-expected.txt: Added.
+        * storage/indexeddb/modern/blocked-open-db-requests.html: Added.
+        * storage/indexeddb/modern/resources/blocked-open-db-requests.js: Added.
+        
+        * storage/indexeddb/modern/deleteobjectstore-1.html: Fix subtly broken test.
+        * storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures.html: Ditto.
+        
 2015-12-08  Mark Lam  <mark....@apple.com>
 
         Polymorphic operand types for DFG and FTL div.

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (193783 => 193784)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-12-08 22:12:34 UTC (rev 193784)
@@ -74,6 +74,7 @@
 storage/indexeddb/deleted-objects.html [ Skip ]
 storage/indexeddb/dont-wedge.html [ Skip ]
 storage/indexeddb/index-multientry.html [ Skip ]
+storage/indexeddb/intversion-long-queue.html [ Skip ]
 storage/indexeddb/intversion-two-opens-no-versions.html [ Skip ]
 storage/indexeddb/keypath-basics.html [ Skip ]
 storage/indexeddb/keypath-fetch-key.html [ Skip ]
@@ -92,17 +93,10 @@
 
 # IDB tests that timeout                                                               
 storage/indexeddb/database-closepending-flag.html [ Skip ]
-storage/indexeddb/delete-closed-database-object.html [ Skip ]
 storage/indexeddb/deletedatabase-blocked.html [ Skip ]
 storage/indexeddb/deletedatabase-delayed-by-versionchange.html [ Skip ] 
-storage/indexeddb/intversion-blocked.html [ Skip ]
-storage/indexeddb/intversion-long-queue.html [ Skip ]
 storage/indexeddb/intversion-pending-version-changes-ascending.html [ Skip ]
-storage/indexeddb/intversion-pending-version-changes-descending.html [ Skip ]
-storage/indexeddb/intversion-pending-version-changes-same.html [ Skip ]
-storage/indexeddb/objectstore-basics.html [ Skip ]
 storage/indexeddb/odd-strings.html [ Skip ]
-storage/indexeddb/set_version_blocked.html [ Skip ]
 storage/indexeddb/transaction-basics.html [ Skip ]
 storage/indexeddb/transaction-starvation.html [ Skip ]
 storage/indexeddb/unblocked-version-changes.html [ Skip ]
@@ -111,7 +105,7 @@
 storage/indexeddb/createIndex-after-failure.html [ Failure ]
 storage/indexeddb/cursor-continue.html [ Failure ]
 storage/indexeddb/database-deletepending-flag.html [ Failure ]
-storage/indexeddb/database-wrapper.html [ Failure ]
+storage/indexeddb/delete-closed-database-object.html [ Failure ]
 storage/indexeddb/delete-in-upgradeneeded-close-in-open-success.html [ Failure ]
 storage/indexeddb/delete-in-upgradeneeded-close-in-versionchange.html [ Failure ]
 storage/indexeddb/deletedatabase-delayed-by-open-and-versionchange.html [ Failure ]
@@ -126,12 +120,15 @@
 storage/indexeddb/intversion-close-in-upgradeneeded.html [ Failure ]
 storage/indexeddb/intversion-gated-on-delete.html [ Failure ]
 storage/indexeddb/intversion-open-in-upgradeneeded.html [ Failure ]
+storage/indexeddb/intversion-pending-version-changes-descending.html [ Failure ]
+storage/indexeddb/intversion-pending-version-changes-same.html [ Failure ]
 storage/indexeddb/intversion-upgrades.html [ Failure ]
 storage/indexeddb/key-type-array.html [ Failure ]
 storage/indexeddb/key-type-binary.html [ Failure ]
 storage/indexeddb/lazy-index-types.html [ Failure ]
 storage/indexeddb/metadata.html [ Failure ]
 storage/indexeddb/objectstore-autoincrement.html [ Failure ]
+storage/indexeddb/objectstore-basics.html [ Failure ]
 storage/indexeddb/objectstore-count.html [ Failure ]
 storage/indexeddb/objectstore-cursor.html [ Failure ]
 storage/indexeddb/open-ordering.html [ Failure ]
@@ -141,7 +138,6 @@
 storage/indexeddb/pending-version-change-stuck.html [ Failure ]
 storage/indexeddb/properties-disabled-at-runtime.html [ Failure ]
 storage/indexeddb/setversion-blocked-by-versionchange-close.html [ Failure ]
-storage/indexeddb/setversion-not-blocked.html [ Failure ]
 storage/indexeddb/transaction-scope-sequencing.html [ Failure ]
 storage/indexeddb/version-change-abort.html [ Failure ]
 

Added: trunk/LayoutTests/storage/indexeddb/modern/blocked-open-db-requests-expected.txt (0 => 193784)


--- trunk/LayoutTests/storage/indexeddb/modern/blocked-open-db-requests-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/blocked-open-db-requests-expected.txt	2015-12-08 22:12:34 UTC (rev 193784)
@@ -0,0 +1,33 @@
+Makes sure that an OpenDBRequest that would result in a version change is blocked because there are still open connections, it gets the blocked event. Also makes sure that request gets unblocked when the open connections close.
+
+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;
+
+dbname = "blocked-open-db-requests.html"
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
+connection = event.target.result;
+connection._onversionchange_ = firstVersionChange;
+objectStore = connection.createObjectStore('testObjectStore');
+First version change transaction complete
+firstTransaction = connection.transaction('testObjectStore', 'readwrite');
+objectStore = firstTransaction.objectStore('testObjectStore');
+objectStorePutLoop();
+secondRequest = indexedDB.open(dbname, 2);
+secondRequest._onblocked_ = secondBlocked;
+secondRequest._onupgradeneeded_ = secondUpgradeNeeded;
+receivedVersionChange = true;
+++blockedCount
+PASS blockedEvent.oldVersion is 1
+PASS blockedEvent.newVersion is 2
+PASS blockedEvent.target.readyState is 'pending'
+2nd upgradeNeeded
+PASS blockedCount is 1
+PASS event.target.result.version is 2
+event.target.result.close();
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/storage/indexeddb/modern/blocked-open-db-requests.html (0 => 193784)


--- trunk/LayoutTests/storage/indexeddb/modern/blocked-open-db-requests.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/blocked-open-db-requests.html	2015-12-08 22:12:34 UTC (rev 193784)
@@ -0,0 +1,9 @@
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/storage/indexeddb/modern/deleteobjectstore-1.html (193783 => 193784)


--- trunk/LayoutTests/storage/indexeddb/modern/deleteobjectstore-1.html	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteobjectstore-1.html	2015-12-08 22:12:34 UTC (rev 193784)
@@ -33,8 +33,8 @@
 
     versionTransaction._oncomplete_ = function(event) {
         alert("Initial upgrade versionchange transaction complete");
+        database.close();
         continueTest1();
-        database.close();
     }
 
     versionTransaction._onerror_ = function(event) {

Modified: trunk/LayoutTests/storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures.html (193783 => 193784)


--- trunk/LayoutTests/storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures.html	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures.html	2015-12-08 22:12:34 UTC (rev 193784)
@@ -62,8 +62,8 @@
 
     transaction._oncomplete_ = function(event) {
         alert("readwrite transaction complete");
+        database.close();
         continueTest2();
-        database.close();
     }
 
     transaction._onerror_ = function(event) {

Added: trunk/LayoutTests/storage/indexeddb/modern/resources/blocked-open-db-requests.js (0 => 193784)


--- trunk/LayoutTests/storage/indexeddb/modern/resources/blocked-open-db-requests.js	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/resources/blocked-open-db-requests.js	2015-12-08 22:12:34 UTC (rev 193784)
@@ -0,0 +1,58 @@
+description("Makes sure that an OpenDBRequest that would result in a version change is blocked because there are still open connections, it gets the blocked event. Also makes sure that request gets unblocked when the open connections close.");
+
+indexedDBTest(prepareDatabase, versionChangeSuccessCallback);
+
+blockedCount = 0;
+receivedVersionChange = false;
+function prepareDatabase()
+{
+    evalAndLog("connection = event.target.result;");
+    evalAndLog("connection._onversionchange_ = firstVersionChange;");
+    evalAndLog("objectStore = connection.createObjectStore('testObjectStore');");
+}
+
+function versionChangeSuccessCallback()
+{
+    debug("First version change transaction complete");
+    evalAndLog("firstTransaction = connection.transaction('testObjectStore', 'readwrite');");
+    evalAndLog("objectStore = firstTransaction.objectStore('testObjectStore');");
+    evalAndLog("objectStorePutLoop();");
+
+    evalAndLog("secondRequest = indexedDB.open(dbname, 2);");
+    evalAndLog("secondRequest._onblocked_ = secondBlocked;");
+    evalAndLog("secondRequest._onupgradeneeded_ = secondUpgradeNeeded;");
+}
+
+function firstVersionChange()
+{
+    evalAndLog("receivedVersionChange = true;");
+}
+
+function objectStorePutLoop()
+{
+    if (blockedCount == 1 && receivedVersionChange) {
+        connection.close();
+        return;
+    }
+
+    request = objectStore.put("bar", "foo");
+    request._onsuccess_ = objectStorePutLoop;
+}
+
+function secondBlocked()
+{
+    evalAndLog("++blockedCount");
+    blockedEvent = event;
+    shouldBe("blockedEvent.oldVersion", "1");
+    shouldBe("blockedEvent.newVersion", "2");
+    shouldEvaluateTo("blockedEvent.target.readyState", "'pending'");
+}
+
+function secondUpgradeNeeded()
+{
+    debug("2nd upgradeNeeded");
+    shouldBe("blockedCount", "1");
+    shouldBe("event.target.result.version", "2");
+    evalAndLog("event.target.result.close();");
+    finishJSTest();
+}

Modified: trunk/Source/WebCore/ChangeLog (193783 => 193784)


--- trunk/Source/WebCore/ChangeLog	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/Source/WebCore/ChangeLog	2015-12-08 22:12:34 UTC (rev 193784)
@@ -1,3 +1,41 @@
+2015-12-08  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: Fire blocked events for upgrade requests that are blocked.
+        https://bugs.webkit.org/show_bug.cgi?id=152007
+
+        Reviewed by Alex Christensen.
+
+        Test: storage/indexeddb/modern/blocked-open-db-requests.html
+              And some that used to fail now pass.
+              And some that used to timeout now complete.
+
+        * Modules/indexeddb/client/IDBConnectionToServer.cpp:
+        (WebCore::IDBClient::IDBConnectionToServer::notifyOpenDBRequestBlocked):
+        * Modules/indexeddb/client/IDBConnectionToServer.h:
+
+        * Modules/indexeddb/client/IDBDatabaseImpl.cpp:
+        (WebCore::IDBClient::IDBDatabase::IDBDatabase):
+
+        * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
+        (WebCore::IDBClient::IDBOpenDBRequest::requestBlocked):
+        * Modules/indexeddb/client/IDBOpenDBRequestImpl.h:
+
+        * Modules/indexeddb/client/IDBRequestImpl.cpp:
+        (WebCore::IDBClient::IDBRequest::dispatchEvent):
+
+        * Modules/indexeddb/server/IDBConnectionToClient.cpp:
+        (WebCore::IDBServer::IDBConnectionToClient::notifyOpenDBRequestBlocked):
+        * Modules/indexeddb/server/IDBConnectionToClient.h:
+        * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
+
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabase::handleOpenDatabaseOperations): When a request that would
+          result in a version change transaction is blocked by open connections, notify it.
+
+        * Modules/indexeddb/shared/InProcessIDBServer.cpp:
+        (WebCore::InProcessIDBServer::notifyOpenDBRequestBlocked):
+        * Modules/indexeddb/shared/InProcessIDBServer.h:
+
 2015-12-08  Per Arne Vollan  <pe...@outlook.com>
 
         [WinCairo] Compile error.

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp (193783 => 193784)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp	2015-12-08 22:12:34 UTC (rev 193784)
@@ -331,6 +331,16 @@
     transaction->didStart(error);
 }
 
+void IDBConnectionToServer::notifyOpenDBRequestBlocked(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion)
+{
+    LOG(IndexedDB, "IDBConnectionToServer::didStartTransaction");
+
+    auto openDBRequest = m_openDBRequestMap.get(requestIdentifier);
+    ASSERT(openDBRequest);
+
+    openDBRequest->requestBlocked(oldVersion, newVersion);
+}
+
 void IDBConnectionToServer::databaseConnectionClosed(IDBDatabase& database)
 {
     LOG(IndexedDB, "IDBConnectionToServer::databaseConnectionClosed");

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h (193783 => 193784)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h	2015-12-08 22:12:34 UTC (rev 193784)
@@ -103,6 +103,7 @@
 
     void fireVersionChangeEvent(uint64_t databaseConnectionIdentifier, uint64_t requestedVersion);
     void didStartTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&);
+    void notifyOpenDBRequestBlocked(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion);
 
     void establishTransaction(IDBTransaction&);
 

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp (193783 => 193784)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp	2015-12-08 22:12:34 UTC (rev 193784)
@@ -52,6 +52,7 @@
     , m_info(resultData.databaseInfo())
     , m_databaseConnectionIdentifier(resultData.databaseConnectionIdentifier())
 {
+    LOG(IndexedDB, "IDBDatabase::IDBDatabase - Creating database %s with version %" PRIu64, m_info.name().utf8().data(), m_info.version());
     suspendIfNeeded();
     relaxAdoptionRequirement();
     m_serverConnection->registerDatabaseConnection(*this);

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp (193783 => 193784)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp	2015-12-08 22:12:34 UTC (rev 193784)
@@ -168,6 +168,12 @@
     }
 }
 
+void IDBOpenDBRequest::requestBlocked(uint64_t oldVersion, uint64_t newVersion)
+{
+    LOG(IndexedDB, "IDBOpenDBRequest::requestBlocked");
+    enqueueEvent(IDBVersionChangeEvent::create(oldVersion, newVersion, eventNames().blockedEvent));
+}
+
 } // namespace IDBClient
 } // namespace WebCore
 

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h (193783 => 193784)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h	2015-12-08 22:12:34 UTC (rev 193784)
@@ -51,6 +51,7 @@
     uint64_t version() const { return m_version; }
 
     void requestCompleted(const IDBResultData&);
+    void requestBlocked(uint64_t oldVersion, uint64_t newVersion);
 
     void versionChangeTransactionWillFinish();
     void fireSuccessAfterVersionChangeCommit();

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp (193783 => 193784)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp	2015-12-08 22:12:34 UTC (rev 193784)
@@ -281,10 +281,10 @@
     // IDBEventDispatcher::dispatch() might have set the pending activity flag back to true, suggesting the request will be reused.
     // We might also re-use the request if this event was the upgradeneeded event for an IDBOpenDBRequest.
     if (!m_hasPendingActivity)
-        m_hasPendingActivity = isOpenDBRequest() && event.type() == eventNames().upgradeneededEvent;
+        m_hasPendingActivity = isOpenDBRequest() && (event.type() == eventNames().upgradeneededEvent || event.type() == eventNames().blockedEvent);
 
-    // The request should only remain in the transaction's request list if it represents a pending cursor operation.
-    if (m_transaction && !m_pendingCursor)
+    // The request should only remain in the transaction's request list if it represents a pending cursor operation, or this is an open request that was blocked.
+    if (m_transaction && !m_pendingCursor && event.type() != eventNames().blockedEvent)
         m_transaction->removeRequest(*this);
 
     if (dontPreventDefault && event.type() == eventNames().errorEvent && m_transaction && !m_transaction->isFinishedOrFinishing()) {

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp (193783 => 193784)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp	2015-12-08 22:12:34 UTC (rev 193784)
@@ -133,6 +133,11 @@
     m_delegate->didStartTransaction(transactionIdentifier, error);
 }
 
+void IDBConnectionToClient::notifyOpenDBRequestBlocked(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion)
+{
+    m_delegate->notifyOpenDBRequestBlocked(requestIdentifier, oldVersion, newVersion);
+}
+
 } // namespace IDBServer
 } // namespace WebCore
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h (193783 => 193784)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h	2015-12-08 22:12:34 UTC (rev 193784)
@@ -67,6 +67,8 @@
     void fireVersionChangeEvent(UniqueIDBDatabaseConnection&, uint64_t requestedVersion);
     void didStartTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&);
 
+    void notifyOpenDBRequestBlocked(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion);
+
 private:
     IDBConnectionToClient(IDBConnectionToClientDelegate&);
     

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h (193783 => 193784)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h	2015-12-08 22:12:34 UTC (rev 193784)
@@ -62,6 +62,7 @@
 
     virtual void fireVersionChangeEvent(UniqueIDBDatabaseConnection&, uint64_t requestedVersion) = 0;
     virtual void didStartTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&) = 0;
+    virtual void notifyOpenDBRequestBlocked(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion) = 0;
 
     virtual void ref() = 0;
     virtual void deref() = 0;

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (193783 => 193784)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp	2015-12-08 22:12:34 UTC (rev 193784)
@@ -170,6 +170,9 @@
 
     // Otherwise we have to notify all those open connections and wait for them to close.
     notifyConnectionsOfVersionChangeForUpgrade();
+
+    // And we notify this OpenDBRequest that it is blocked until those connections close.
+    m_versionChangeDatabaseConnection->connectionToClient().notifyOpenDBRequestBlocked(m_versionChangeOperation->requestData().requestIdentifier(), m_databaseInfo->version(), requestedVersion);
 }
 
 bool UniqueIDBDatabase::hasAnyOpenConnections() const

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp (193783 => 193784)


--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp	2015-12-08 22:12:34 UTC (rev 193784)
@@ -345,6 +345,14 @@
     });
 }
 
+void InProcessIDBServer::notifyOpenDBRequestBlocked(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion)
+{
+    RefPtr<InProcessIDBServer> self(this);
+    RunLoop::current().dispatch([this, self, requestIdentifier, oldVersion, newVersion] {
+        m_connectionToServer->notifyOpenDBRequestBlocked(requestIdentifier, oldVersion, newVersion);
+    });
+}
+
 void InProcessIDBServer::databaseConnectionClosed(uint64_t databaseConnectionIdentifier)
 {
     RefPtr<InProcessIDBServer> self(this);

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h (193783 => 193784)


--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h	2015-12-08 21:49:26 UTC (rev 193783)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h	2015-12-08 22:12:34 UTC (rev 193784)
@@ -91,6 +91,7 @@
     virtual void didIterateCursor(const IDBResultData&) override final;
     virtual void fireVersionChangeEvent(IDBServer::UniqueIDBDatabaseConnection&, uint64_t requestedVersion) override final;
     virtual void didStartTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&) override final;
+    virtual void notifyOpenDBRequestBlocked(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion) override final;
 
     virtual void ref() override { RefCounted<InProcessIDBServer>::ref(); }
     virtual void deref() override { RefCounted<InProcessIDBServer>::deref(); }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to