Modern IDB: storage/indexeddb/delete-in-upgradeneeded-close-in-versionchange.html...
[WebKit-https.git] / Source / WebCore / Modules / indexeddb / client / IDBTransactionImpl.cpp
index 44593607b14ce6e93cdc557cbf0bf38687d1bd92..38d4f337307a6256e43e722d51c38b0ade0aabe8 100644 (file)
@@ -356,7 +356,7 @@ void IDBTransaction::notifyDidAbort(const IDBError& error)
 
     if (isVersionChange()) {
         ASSERT(m_openDBRequest);
-        m_openDBRequest->fireErrorAfterVersionChangeAbort();
+        m_openDBRequest->fireErrorAfterVersionChangeCompletion();
     }
 }
 
@@ -427,7 +427,11 @@ bool IDBTransaction::dispatchEvent(Event& event)
 
     if (isVersionChange() && event.type() == eventNames().completeEvent) {
         ASSERT(m_openDBRequest);
-        m_openDBRequest->fireSuccessAfterVersionChangeCommit();
+
+        if (m_database->isClosingOrClosed())
+            m_openDBRequest->fireErrorAfterVersionChangeCompletion();
+        else
+            m_openDBRequest->fireSuccessAfterVersionChangeCommit();
     }
 
     return result;