https://bugs.webkit.org/show_bug.cgi?id=150735
Reviewed by Darin Adler.
Source/WebCore:
No new tests (Covered by existing tests).
Transactions were liable to commit too early because IDBRequests could be waiting
to dispatch their error/success events but their operations would no longer be
registered with the transaction.
Having outstanding requests should also keep a transaction from committing, just
like having outstanding operations should.
* Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
(WebCore::IDBClient::IDBOpenDBRequest::onUpgradeNeeded):
* Modules/indexeddb/client/IDBRequestImpl.cpp:
(WebCore::IDBClient::IDBRequest::dispatchEvent):
* Modules/indexeddb/client/IDBTransactionImpl.cpp:
(WebCore::IDBClient::IDBTransaction::addRequest):
(WebCore::IDBClient::IDBTransaction::removeRequest):
(WebCore::IDBClient::IDBTransaction::operationTimerFired):
(WebCore::IDBClient::IDBTransaction::requestGetRecord):
(WebCore::IDBClient::IDBTransaction::requestClearObjectStore):
(WebCore::IDBClient::IDBTransaction::requestPutOrAdd):
(WebCore::IDBClient::IDBTransaction::operationDidComplete):
* Modules/indexeddb/client/IDBTransactionImpl.h:
* Modules/indexeddb/client/TransactionOperation.h:
(WebCore::IDBClient::TransactionOperation::completed):
LayoutTests:
* platform/mac-wk1/TestExpectations: Reenable the test.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191847
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-10-31 Brady Eidson <beidson@apple.com>
+
+ storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures.html is flaky.
+ https://bugs.webkit.org/show_bug.cgi?id=150735
+
+ Reviewed by Darin Adler.
+
+ * platform/mac-wk1/TestExpectations: Reenable the test.
+
2015-10-30 Joseph Pecoraro <pecoraro@apple.com>
Web Inspector: Test Debugger.scriptParsed events received after opening inspector frontend
webkit.org/b/150564 svg/repaint/add-background-property-on-root.html [ Pass Timeout ]
-webkit.org/b/150735 storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures.html [ Pass Failure ]
-
### END OF (1) Failures with bug reports
########################################
+2015-10-31 Brady Eidson <beidson@apple.com>
+
+ storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures.html is flaky.
+ https://bugs.webkit.org/show_bug.cgi?id=150735
+
+ Reviewed by Darin Adler.
+
+ No new tests (Covered by existing tests).
+
+ Transactions were liable to commit too early because IDBRequests could be waiting
+ to dispatch their error/success events but their operations would no longer be
+ registered with the transaction.
+
+ Having outstanding requests should also keep a transaction from committing, just
+ like having outstanding operations should.
+
+ * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
+ (WebCore::IDBClient::IDBOpenDBRequest::onUpgradeNeeded):
+
+ * Modules/indexeddb/client/IDBRequestImpl.cpp:
+ (WebCore::IDBClient::IDBRequest::dispatchEvent):
+
+ * Modules/indexeddb/client/IDBTransactionImpl.cpp:
+ (WebCore::IDBClient::IDBTransaction::addRequest):
+ (WebCore::IDBClient::IDBTransaction::removeRequest):
+ (WebCore::IDBClient::IDBTransaction::operationTimerFired):
+ (WebCore::IDBClient::IDBTransaction::requestGetRecord):
+ (WebCore::IDBClient::IDBTransaction::requestClearObjectStore):
+ (WebCore::IDBClient::IDBTransaction::requestPutOrAdd):
+ (WebCore::IDBClient::IDBTransaction::operationDidComplete):
+ * Modules/indexeddb/client/IDBTransactionImpl.h:
+
+ * Modules/indexeddb/client/TransactionOperation.h:
+ (WebCore::IDBClient::TransactionOperation::completed):
+
2015-10-31 Philippe Normand <pnormand@igalia.com>
[GStreamer][Mac] Fix WebAudio build
m_result = IDBAny::create(WTF::move(database));
m_readyState = IDBRequestReadyState::Done;
m_transaction = adoptRef(&transaction.leakRef());
+ m_transaction->addRequest(*this);
enqueueEvent(IDBVersionChangeEvent::create(oldVersion, newVersion, eventNames().upgradeneededEvent));
}
m_hasPendingActivity = false;
+ // FIXME: When we implement reusable requests (for cursors) it will be incorrect to always remove the request from the transaction.
+ if (m_transaction)
+ m_transaction->removeRequest(*this);
+
return dontPreventDefault;
}
|| m_state == IndexedDB::TransactionState::Finished;
}
+void IDBTransaction::addRequest(IDBRequest& request)
+{
+ ASSERT(!m_openRequests.contains(&request));
+ m_openRequests.add(&request);
+}
+
+void IDBTransaction::removeRequest(IDBRequest& request)
+{
+ ASSERT(m_openRequests.contains(&request));
+ m_openRequests.remove(&request);
+}
+
void IDBTransaction::scheduleOperation(RefPtr<TransactionOperation>&& operation)
{
ASSERT(!m_transactionOperationMap.contains(operation->identifier()));
return;
}
+ if (!m_transactionOperationMap.isEmpty() || !m_openRequests.isEmpty())
+ return;
+
if (!isFinishedOrFinishing())
commit();
}
ASSERT(!keyRangeData.isNull);
Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
+ addRequest(request.get());
auto operation = createTransactionOperation(*this, request.get(), &IDBTransaction::didGetRecordOnServer, &IDBTransaction::getRecordOnServer, keyRangeData);
scheduleOperation(WTF::move(operation));
ASSERT(isActive());
Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
+ addRequest(request.get());
uint64_t objectStoreIdentifier = objectStore.info().identifier();
auto operation = createTransactionOperation(*this, request.get(), &IDBTransaction::didClearObjectStoreOnServer, &IDBTransaction::clearObjectStoreOnServer, objectStoreIdentifier);
ASSERT(objectStore.info().autoIncrement() || key);
Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
+ addRequest(request.get());
auto operation = createTransactionOperation(*this, request.get(), &IDBTransaction::didPutOrAddOnServer, &IDBTransaction::putOrAddOnServer, key, &value, overwriteMode);
scheduleOperation(WTF::move(operation));
ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::DeleteObjectStoreSuccess);
}
+void IDBTransaction::operationDidComplete(TransactionOperation& operation)
+{
+ ASSERT(m_transactionOperationMap.get(operation.identifier()) == &operation);
+ m_transactionOperationMap.remove(operation.identifier());
+
+ scheduleOperationTimer();
+}
+
void IDBTransaction::establishOnServer()
{
LOG(IndexedDB, "IDBTransaction::establishOnServer");
void deleteObjectStore(const String& objectStoreName);
+ void addRequest(IDBRequest&);
+ void removeRequest(IDBRequest&);
+
IDBConnectionToServer& serverConnection();
void activate();
void deactivate();
- void scheduleOperationTimer();
+ void operationDidComplete(TransactionOperation&);
private:
IDBTransaction(IDBDatabase&, const IDBTransactionInfo&);
void establishOnServer();
+ void scheduleOperationTimer();
+
Ref<IDBDatabase> m_database;
IDBTransactionInfo m_info;
std::unique_ptr<IDBDatabaseInfo> m_originalDatabaseInfo;
HashMap<IDBResourceIdentifier, RefPtr<TransactionOperation>> m_transactionOperationMap;
HashMap<String, RefPtr<IDBObjectStore>> m_referencedObjectStores;
+
+ HashSet<RefPtr<IDBRequest>> m_openRequests;
};
class TransactionActivator {
void completed(const IDBResultData& data)
{
m_completeFunction(data);
- m_transaction->scheduleOperationTimer();
+ m_transaction->operationDidComplete(*this);
}
const IDBResourceIdentifier& identifier() const { return m_identifier; }