- Revision
- 123275
- Author
- [email protected]
- Date
- 2012-07-20 16:51:24 -0700 (Fri, 20 Jul 2012)
Log Message
IndexedDB: "ASSERTION FAILED: !m_requestFinished" hit in IDBRequest::dispatchEvent
https://bugs.webkit.org/show_bug.cgi?id=86911
Reviewed by Tony Chang.
Source/WebCore:
Clean up the IDBRequest/IDBCursor relationship and the IDBRequest lifecycle.
The IDBRequest's m_cursor/setCursor() calls are renamed to m_pendingCursor/setPendingCursor() to
clarify that the request will move between two states - either there's a cursor request in-flight
c/o a continue() or advance() call, or the result has come in (cursor, null-for-done, or error).
Since they were only ever used together, resetReadyState() is merged into setResultCursor(). The
m_requestFinished flag becomes redundant and is dropped - the ASSERT reported in the bug
becomes an ASSERT(m_readyState == PENDING) and m_readyState tracking is already correct.
Test: storage/indexeddb/request-continue-abort.html
* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::advance): Unreachable code path now dead and gone.
(WebCore::IDBCursor::continueFunction): Ditto.
* Modules/indexeddb/IDBRequest.cpp: Most functions just add state assertions.
(WebCore::IDBRequest::IDBRequest):
(WebCore::IDBRequest::abort):
(WebCore::IDBRequest::setCursorDetails):
(WebCore::IDBRequest::setPendingCursor): Merge with old resetReadyState().
(WebCore):
(WebCore::IDBRequest::getResultCursor): Helper, since digging cursor out of IDBAny is pesky.
(WebCore::IDBRequest::setResultCursor): Just moved in the file to be with its friends.
(WebCore::IDBRequest::finishCursor):
(WebCore::IDBRequest::onError): Just assertions, re-ordering, re-naming.
(WebCore::IDBRequest::onSuccess):
(WebCore::IDBRequest::onSuccessWithContinuation):
(WebCore::IDBRequest::hasPendingActivity):
(WebCore::IDBRequest::dispatchEvent): Simplify!
(WebCore::IDBRequest::enqueueEvent):
* Modules/indexeddb/IDBRequest.h:
(IDBRequest):
LayoutTests:
Added regression test based on repro steps in the bug.
* storage/indexeddb/request-continue-abort-expected.txt: Added.
* storage/indexeddb/request-continue-abort.html: Added.
* storage/indexeddb/resources/request-continue-abort.js: Added.
(test.request.onsuccess.request.onsuccess.request.onsuccess):
(test.request.onsuccess.request.onsuccess):
(test.request.onsuccess):
(test):
(onUpgrade):
(testCursor.request.onsuccess):
(testCursor.request.onerror):
(testCursor.transaction.onabort):
(testCursor):
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (123274 => 123275)
--- trunk/LayoutTests/ChangeLog 2012-07-20 23:39:32 UTC (rev 123274)
+++ trunk/LayoutTests/ChangeLog 2012-07-20 23:51:24 UTC (rev 123275)
@@ -1,3 +1,25 @@
+2012-07-20 Joshua Bell <[email protected]>
+
+ IndexedDB: "ASSERTION FAILED: !m_requestFinished" hit in IDBRequest::dispatchEvent
+ https://bugs.webkit.org/show_bug.cgi?id=86911
+
+ Reviewed by Tony Chang.
+
+ Added regression test based on repro steps in the bug.
+
+ * storage/indexeddb/request-continue-abort-expected.txt: Added.
+ * storage/indexeddb/request-continue-abort.html: Added.
+ * storage/indexeddb/resources/request-continue-abort.js: Added.
+ (test.request.onsuccess.request.onsuccess.request.onsuccess):
+ (test.request.onsuccess.request.onsuccess):
+ (test.request.onsuccess):
+ (test):
+ (onUpgrade):
+ (testCursor.request.onsuccess):
+ (testCursor.request.onerror):
+ (testCursor.transaction.onabort):
+ (testCursor):
+
2012-07-20 Caio Marcelo de Oliveira Filho <[email protected]>
[Qt] svg/text rebaseline after new test fonts (part 3)
Added: trunk/LayoutTests/storage/indexeddb/request-continue-abort-expected.txt (0 => 123275)
--- trunk/LayoutTests/storage/indexeddb/request-continue-abort-expected.txt (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/request-continue-abort-expected.txt 2012-07-20 23:51:24 UTC (rev 123275)
@@ -0,0 +1,38 @@
+Regression test for IDBRequest issue calling continue on a cursor then aborting.
+
+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 = self.location.pathname
+indexedDB.deleteDatabase('dbname')
+request = indexedDB.open('dbname')
+db = request.result
+db.setVersion('1')
+
+onUpgrade:
+db.createObjectStore('store')
+
+testCursor:
+transaction = db.transaction('store', 'readwrite')
+store = transaction.objectStore('store')
+store.add('value1', 'key1')
+store.add('value2', 'key2')
+
+state = 0
+request = store.openCursor()
+
+'success' event fired at request.
+PASS ++state is 1
+request.result.continue()
+
+'error' event fired at request.
+PASS ++state is 2
+
+'abort' event fired at transaction.
+PASS ++state is 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/storage/indexeddb/request-continue-abort.html (0 => 123275)
--- trunk/LayoutTests/storage/indexeddb/request-continue-abort.html (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/request-continue-abort.html 2012-07-20 23:51:24 UTC (rev 123275)
@@ -0,0 +1,10 @@
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/storage/indexeddb/resources/request-continue-abort.js (0 => 123275)
--- trunk/LayoutTests/storage/indexeddb/resources/request-continue-abort.js (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/resources/request-continue-abort.js 2012-07-20 23:51:24 UTC (rev 123275)
@@ -0,0 +1,77 @@
+if (this.importScripts) {
+ importScripts('../../../fast/js/resources/js-test-pre.js');
+ importScripts('shared.js');
+}
+
+description("Regression test for IDBRequest issue calling continue on a cursor then aborting.");
+
+function test()
+{
+ removeVendorPrefixes();
+
+ evalAndLog('dbname = self.location.pathname');
+ request = evalAndLog("indexedDB.deleteDatabase('dbname')");
+ request._onerror_ = unexpectedErrorCallback;
+ request._onsuccess_ = function() {
+ request = evalAndLog("request = indexedDB.open('dbname')");
+ request._onerror_ = unexpectedErrorCallback;
+ request._onsuccess_ = function() {
+ evalAndLog("db = request.result");
+ request = evalAndLog("db.setVersion('1')");
+ request._onerror_ = unexpectedErrorCallback;
+ request._onblocked_ = unexpectedBlockedCallback;
+ request._onsuccess_ = function() {
+ var transaction = request.result;
+ transaction._onabort_ = unexpectedAbortCallback;
+ onUpgrade();
+ transaction._oncomplete_ = testCursor;
+ };
+ };
+ };
+}
+
+function onUpgrade()
+{
+ debug("");
+ debug("onUpgrade:");
+ evalAndLog("db.createObjectStore('store')");
+}
+
+
+function testCursor()
+{
+ debug("");
+ debug("testCursor:");
+ evalAndLog("transaction = db.transaction('store', 'readwrite')");
+
+ evalAndLog("store = transaction.objectStore('store')");
+ request = evalAndLog("store.add('value1', 'key1')");
+ request._onerror_ = unexpectedErrorCallback;
+ request = evalAndLog("store.add('value2', 'key2')");
+ request._onerror_ = unexpectedErrorCallback;
+
+ debug("");
+ evalAndLog("state = 0");
+ evalAndLog("request = store.openCursor()");
+ request._onsuccess_ = function() {
+ debug("");
+ debug("'success' event fired at request.");
+ shouldBe("++state", "1");
+ evalAndLog("request.result.continue()");
+ transaction.abort();
+ };
+ request._onerror_ = function() {
+ debug("");
+ debug("'error' event fired at request.");
+ shouldBe("++state", "2");
+ };
+ transaction._oncomplete_ = unexpectedCompleteCallback;
+ transaction._onabort_ = function() {
+ debug("");
+ debug("'abort' event fired at transaction.");
+ shouldBe("++state", "3");
+ finishJSTest();
+ };
+}
+
+test();
Modified: trunk/Source/WebCore/ChangeLog (123274 => 123275)
--- trunk/Source/WebCore/ChangeLog 2012-07-20 23:39:32 UTC (rev 123274)
+++ trunk/Source/WebCore/ChangeLog 2012-07-20 23:51:24 UTC (rev 123275)
@@ -1,3 +1,42 @@
+2012-07-20 Joshua Bell <[email protected]>
+
+ IndexedDB: "ASSERTION FAILED: !m_requestFinished" hit in IDBRequest::dispatchEvent
+ https://bugs.webkit.org/show_bug.cgi?id=86911
+
+ Reviewed by Tony Chang.
+
+ Clean up the IDBRequest/IDBCursor relationship and the IDBRequest lifecycle.
+
+ The IDBRequest's m_cursor/setCursor() calls are renamed to m_pendingCursor/setPendingCursor() to
+ clarify that the request will move between two states - either there's a cursor request in-flight
+ c/o a continue() or advance() call, or the result has come in (cursor, null-for-done, or error).
+ Since they were only ever used together, resetReadyState() is merged into setResultCursor(). The
+ m_requestFinished flag becomes redundant and is dropped - the ASSERT reported in the bug
+ becomes an ASSERT(m_readyState == PENDING) and m_readyState tracking is already correct.
+
+ Test: storage/indexeddb/request-continue-abort.html
+
+ * Modules/indexeddb/IDBCursor.cpp:
+ (WebCore::IDBCursor::advance): Unreachable code path now dead and gone.
+ (WebCore::IDBCursor::continueFunction): Ditto.
+ * Modules/indexeddb/IDBRequest.cpp: Most functions just add state assertions.
+ (WebCore::IDBRequest::IDBRequest):
+ (WebCore::IDBRequest::abort):
+ (WebCore::IDBRequest::setCursorDetails):
+ (WebCore::IDBRequest::setPendingCursor): Merge with old resetReadyState().
+ (WebCore):
+ (WebCore::IDBRequest::getResultCursor): Helper, since digging cursor out of IDBAny is pesky.
+ (WebCore::IDBRequest::setResultCursor): Just moved in the file to be with its friends.
+ (WebCore::IDBRequest::finishCursor):
+ (WebCore::IDBRequest::onError): Just assertions, re-ordering, re-naming.
+ (WebCore::IDBRequest::onSuccess):
+ (WebCore::IDBRequest::onSuccessWithContinuation):
+ (WebCore::IDBRequest::hasPendingActivity):
+ (WebCore::IDBRequest::dispatchEvent): Simplify!
+ (WebCore::IDBRequest::enqueueEvent):
+ * Modules/indexeddb/IDBRequest.h:
+ (IDBRequest):
+
2012-07-20 Andrew Scherkus <[email protected]>
[chromium] Don't display fullscreen button for video elements not containing video
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp (123274 => 123275)
--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp 2012-07-20 23:39:32 UTC (rev 123274)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp 2012-07-20 23:51:24 UTC (rev 123275)
@@ -186,12 +186,7 @@
return;
}
- if (!m_request->resetReadyState(m_transaction.get())) {
- ASSERT_NOT_REACHED();
- ec = IDBDatabaseException::IDB_INVALID_STATE_ERR;
- return;
- }
- m_request->setCursor(this);
+ m_request->setPendingCursor(this);
m_gotValue = false;
m_backend->advance(count, m_request, ec);
}
@@ -216,14 +211,9 @@
// FIXME: We're not using the context from when continue was called, which means the callback
// will be on the original context openCursor was called on. Is this right?
- if (m_request->resetReadyState(m_transaction.get())) {
- m_request->setCursor(this);
- m_gotValue = false;
- m_backend->continueFunction(key, m_request, ec);
- } else {
- ASSERT_NOT_REACHED();
- ec = IDBDatabaseException::IDB_INVALID_STATE_ERR;
- }
+ m_request->setPendingCursor(this);
+ m_gotValue = false;
+ m_backend->continueFunction(key, m_request, ec);
}
PassRefPtr<IDBRequest> IDBCursor::deleteFunction(ScriptExecutionContext* context, ExceptionCode& ec)
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (123274 => 123275)
--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp 2012-07-20 23:39:32 UTC (rev 123274)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp 2012-07-20 23:51:24 UTC (rev 123275)
@@ -58,12 +58,11 @@
, m_transaction(transaction)
, m_readyState(PENDING)
, m_requestAborted(false)
- , m_requestFinished(false)
, m_cursorFinished(false)
, m_contextStopped(false)
, m_cursorType(IDBCursorBackendInterface::InvalidCursorType)
, m_cursorDirection(IDBCursor::NEXT)
- , m_cursor(0)
+ , m_pendingCursor(0)
{
if (m_transaction) {
m_transaction->registerRequest(this);
@@ -141,40 +140,14 @@
m_transaction->unregisterRequest(this);
}
-bool IDBRequest::resetReadyState(IDBTransaction* transaction)
-{
- ASSERT(!m_requestFinished);
- ASSERT(scriptExecutionContext());
- ASSERT_UNUSED(transaction, transaction == m_transaction);
- if (m_readyState != DONE)
- return false;
-
- m_readyState = PENDING;
- m_result.clear();
- m_errorCode = 0;
- m_error.clear();
- m_errorMessage = String();
- ASSERT(m_transaction);
- m_transaction->registerRequest(this);
-
- return true;
-}
-
-IDBAny* IDBRequest::source()
-{
- return m_source.get();
-}
-
void IDBRequest::abort()
{
+ ASSERT(m_readyState == PENDING || m_readyState == DONE);
ASSERT(!m_requestAborted);
if (m_contextStopped || !scriptExecutionContext())
return;
-
- if (m_readyState != PENDING) {
- ASSERT(m_readyState == DONE);
+ if (m_readyState == DONE)
return;
- }
EventQueue* eventQueue = scriptExecutionContext()->eventQueue();
for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) {
@@ -193,34 +166,68 @@
void IDBRequest::setCursorDetails(IDBCursorBackendInterface::CursorType cursorType, IDBCursor::Direction direction)
{
+ ASSERT(m_readyState == PENDING);
ASSERT(m_cursorType == IDBCursorBackendInterface::InvalidCursorType);
m_cursorType = cursorType;
m_cursorDirection = direction;
}
-void IDBRequest::setCursor(PassRefPtr<IDBCursor> cursor)
+void IDBRequest::setPendingCursor(PassRefPtr<IDBCursor> cursor)
{
- ASSERT(!m_cursor);
- m_cursor = cursor;
+ ASSERT(m_readyState == DONE);
+ ASSERT(scriptExecutionContext());
+ ASSERT(m_transaction);
+ ASSERT(!m_pendingCursor);
+ ASSERT(cursor == getResultCursor());
+
+ m_pendingCursor = cursor;
+ m_result.clear();
+ m_readyState = PENDING;
+ m_errorCode = 0;
+ m_error.clear();
+ m_errorMessage = String();
+ m_transaction->registerRequest(this);
}
+PassRefPtr<IDBCursor> IDBRequest::getResultCursor()
+{
+ if (!m_result)
+ return 0;
+ if (m_result->type() == IDBAny::IDBCursorType)
+ return m_result->idbCursor();
+ if (m_result->type() == IDBAny::IDBCursorWithValueType)
+ return m_result->idbCursorWithValue();
+ return 0;
+}
+
+void IDBRequest::setResultCursor(PassRefPtr<IDBCursor> prpCursor)
+{
+ ASSERT(m_readyState == PENDING);
+ if (m_cursorType == IDBCursorBackendInterface::IndexKeyCursor) {
+ m_result = IDBAny::create(prpCursor);
+ return;
+ }
+
+ m_result = IDBAny::create(IDBCursorWithValue::fromCursor(prpCursor));
+}
+
void IDBRequest::finishCursor()
{
+ ASSERT(m_readyState == PENDING || m_readyState == DONE);
m_cursorFinished = true;
- if (m_readyState != PENDING)
- m_requestFinished = true;
}
void IDBRequest::onError(PassRefPtr<IDBDatabaseError> error)
{
+ ASSERT(m_readyState == PENDING || m_readyState == DONE);
if (m_requestAborted)
return;
- ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_result);
+ ASSERT(m_readyState == PENDING);
+ ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
m_errorCode = error->code();
- ASSERT(!m_error);
+ m_errorMessage = error->message();
m_error = DOMError::create(IDBDatabaseException::getErrorName(error->idbCode()));
- m_errorMessage = error->message();
- m_cursor.clear();
+ m_pendingCursor.clear();
enqueueEvent(Event::create(eventNames().errorEvent, true, true));
}
@@ -232,8 +239,10 @@
void IDBRequest::onSuccess(PassRefPtr<DOMStringList> domStringList)
{
IDB_TRACE("IDBRequest::onSuccess(DOMStringList)");
+ ASSERT(m_readyState == PENDING || m_readyState == DONE);
if (m_requestAborted)
return;
+ ASSERT(m_readyState == PENDING);
ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
m_result = IDBAny::create(domStringList);
enqueueEvent(createSuccessEvent());
@@ -242,8 +251,10 @@
void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend)
{
IDB_TRACE("IDBRequest::onSuccess(IDBCursor)");
+ ASSERT(m_readyState == PENDING || m_readyState == DONE);
if (m_requestAborted)
return;
+ ASSERT(m_readyState == PENDING);
ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
ASSERT(m_cursorType != IDBCursorBackendInterface::InvalidCursorType);
RefPtr<IDBCursor> cursor;
@@ -251,7 +262,7 @@
cursor = IDBCursor::create(backend, m_cursorDirection, this, m_source.get(), m_transaction.get());
else
cursor = IDBCursorWithValue::create(backend, m_cursorDirection, this, m_source.get(), m_transaction.get());
- setResultCursor(cursor, m_cursorType);
+ setResultCursor(cursor);
enqueueEvent(createSuccessEvent());
}
@@ -259,8 +270,10 @@
void IDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend)
{
IDB_TRACE("IDBRequest::onSuccess(IDBDatabase)");
+ ASSERT(m_readyState == PENDING || m_readyState == DONE);
if (m_requestAborted)
return;
+ ASSERT(m_readyState == PENDING);
ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
if (m_contextStopped || !scriptExecutionContext())
return;
@@ -275,8 +288,10 @@
void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey)
{
IDB_TRACE("IDBRequest::onSuccess(IDBKey)");
+ ASSERT(m_readyState == PENDING || m_readyState == DONE);
if (m_requestAborted)
return;
+ ASSERT(m_readyState == PENDING);
ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
if (idbKey && idbKey->isValid())
m_result = IDBAny::create(idbKey);
@@ -288,8 +303,10 @@
void IDBRequest::onSuccess(PassRefPtr<IDBTransactionBackendInterface> prpBackend)
{
IDB_TRACE("IDBRequest::onSuccess(IDBTransaction)");
+ ASSERT(m_readyState == PENDING || m_readyState == DONE);
if (m_requestAborted)
return;
+ ASSERT(m_readyState == PENDING);
ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
RefPtr<IDBTransactionBackendInterface> backend = prpBackend;
@@ -312,11 +329,13 @@
void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue)
{
IDB_TRACE("IDBRequest::onSuccess(SerializedScriptValue)");
+ ASSERT(m_readyState == PENDING || m_readyState == DONE);
if (m_requestAborted)
return;
+ ASSERT(m_readyState == PENDING);
ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
m_result = IDBAny::create(serializedScriptValue);
- m_cursor.clear();
+ m_pendingCursor.clear();
enqueueEvent(createSuccessEvent());
}
@@ -324,8 +343,10 @@
void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> prpSerializedScriptValue, PassRefPtr<IDBKey> prpPrimaryKey, const IDBKeyPath& keyPath)
{
LOG_ERROR("CHECKING: onSuccess(value, key, keypath)");
+ ASSERT(m_readyState == PENDING || m_readyState == DONE);
if (m_requestAborted)
return;
+ ASSERT(m_readyState == PENDING);
RefPtr<SerializedScriptValue> serializedScriptValue = prpSerializedScriptValue;
#ifndef NDEBUG
// FIXME: Assert until we can actually inject the right value.
@@ -341,12 +362,12 @@
void IDBRequest::onSuccessWithContinuation()
{
IDB_TRACE("IDBRequest::onSuccessWithContinuation");
+ ASSERT(m_readyState == PENDING || m_readyState == DONE);
if (m_requestAborted)
return;
ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
- ASSERT(m_cursor);
- setResultCursor(m_cursor, m_cursorType);
- m_cursor.clear();
+ ASSERT(m_pendingCursor);
+ setResultCursor(m_pendingCursor.release());
enqueueEvent(createSuccessEvent());
}
@@ -355,7 +376,7 @@
// FIXME: In an ideal world, we should return true as long as anyone has a or can
// get a handle to us and we have event listeners. This is order to handle
// user generated events properly.
- return !m_requestFinished || ActiveDOMObject::hasPendingActivity();
+ return m_readyState == PENDING || ActiveDOMObject::hasPendingActivity();
}
void IDBRequest::stop()
@@ -387,12 +408,13 @@
bool IDBRequest::dispatchEvent(PassRefPtr<Event> event)
{
IDB_TRACE("IDBRequest::dispatchEvent");
- ASSERT(!m_requestFinished);
+ ASSERT(m_readyState == PENDING);
ASSERT(!m_contextStopped);
ASSERT(m_enqueuedEvents.size());
ASSERT(scriptExecutionContext());
ASSERT(event->target() == this);
ASSERT_WITH_MESSAGE(m_readyState < DONE, "m_readyState < DONE(%d), was %d", DONE, m_readyState);
+
if (event->type() != eventNames().blockedEvent)
m_readyState = DONE;
@@ -412,12 +434,10 @@
targets.append(m_transaction->db());
}
+ // Cursor properties should not updated until the success event is being dispatched.
RefPtr<IDBCursor> cursorToNotify;
- if (m_result) {
- if (m_result->type() == IDBAny::IDBCursorType)
- cursorToNotify = m_result->idbCursor();
- else if (m_result->type() == IDBAny::IDBCursorWithValueType)
- cursorToNotify = m_result->idbCursorWithValue();
+ if (event->type() == eventNames().successEvent) {
+ cursorToNotify = getResultCursor();
if (cursorToNotify)
cursorToNotify->setValueReady();
}
@@ -432,15 +452,11 @@
if (setTransactionActive)
m_transaction->setActive(false);
- // If the result was of type IDBCursor, or a onBlocked event, then we'll fire again.
- if (event->type() != eventNames().blockedEvent && (!cursorToNotify || m_cursorFinished))
- m_requestFinished = true;
-
if (cursorToNotify)
cursorToNotify->postSuccessHandlerCallback();
if (m_transaction) {
- if (event->type() == eventNames().errorEvent && dontPreventDefault && !m_requestAborted) {
+ if (event->type() == eventNames().errorEvent && dontPreventDefault && !m_requestAborted) {
m_transaction->setError(m_error);
m_transaction->abort();
}
@@ -465,12 +481,12 @@
void IDBRequest::enqueueEvent(PassRefPtr<Event> event)
{
- ASSERT(!m_requestFinished);
+ ASSERT(m_readyState == PENDING || m_readyState == DONE);
if (m_contextStopped || !scriptExecutionContext())
return;
- ASSERT(m_readyState < DONE);
+ ASSERT(m_readyState == PENDING);
EventQueue* eventQueue = scriptExecutionContext()->eventQueue();
event->setTarget(this);
@@ -489,16 +505,6 @@
return &m_eventTargetData;
}
-void IDBRequest::setResultCursor(PassRefPtr<IDBCursor> prpCursor, IDBCursorBackendInterface::CursorType type)
-{
- if (type == IDBCursorBackendInterface::IndexKeyCursor) {
- m_result = IDBAny::create(prpCursor);
- return;
- }
-
- m_result = IDBAny::create(IDBCursorWithValue::fromCursor(prpCursor));
-}
-
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h (123274 => 123275)
--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h 2012-07-20 23:39:32 UTC (rev 123274)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h 2012-07-20 23:51:24 UTC (rev 123275)
@@ -73,11 +73,9 @@
DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
void markEarlyDeath();
- bool resetReadyState(IDBTransaction*);
void setCursorDetails(IDBCursorBackendInterface::CursorType, IDBCursor::Direction);
- void setCursor(PassRefPtr<IDBCursor>);
+ void setPendingCursor(PassRefPtr<IDBCursor>);
void finishCursor();
- IDBAny* source();
void abort();
// IDBCallbacks
@@ -122,14 +120,14 @@
virtual EventTargetData* eventTargetData();
virtual EventTargetData* ensureEventTargetData();
- void setResultCursor(PassRefPtr<IDBCursor>, IDBCursorBackendInterface::CursorType);
+ PassRefPtr<IDBCursor> getResultCursor();
+ void setResultCursor(PassRefPtr<IDBCursor>);
RefPtr<IDBAny> m_source;
RefPtr<IDBTransaction> m_transaction;
ReadyState m_readyState;
bool m_requestAborted; // May be aborted by transaction then receive async onsuccess; ignore vs. assert.
- bool m_requestFinished; // Is it possible that we'll fire any more events? If not, we're finished.
bool m_cursorFinished;
bool m_contextStopped;
Vector<RefPtr<Event> > m_enqueuedEvents;
@@ -137,7 +135,7 @@
// Only used if the result type will be a cursor.
IDBCursorBackendInterface::CursorType m_cursorType;
IDBCursor::Direction m_cursorDirection;
- RefPtr<IDBCursor> m_cursor;
+ RefPtr<IDBCursor> m_pendingCursor;
EventTargetData m_eventTargetData;
};