| Index: Source/modules/indexeddb/IDBCursor.cpp
|
| diff --git a/Source/modules/indexeddb/IDBCursor.cpp b/Source/modules/indexeddb/IDBCursor.cpp
|
| index a4eec9b77e80a6319f53fd698c72cce878a5c806..7f87f1040378d2ef5b6ec87491d33829307ea3a7 100644
|
| --- a/Source/modules/indexeddb/IDBCursor.cpp
|
| +++ b/Source/modules/indexeddb/IDBCursor.cpp
|
| @@ -126,8 +126,20 @@ PassRefPtr<IDBRequest> IDBCursor::update(ScriptState* state, ScriptValue& value,
|
| {
|
| IDB_TRACE("IDBCursor::update");
|
|
|
| - if (!m_gotValue || isKeyCursor() || isDeleted()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + if (!m_gotValue) {
|
| + es.throwDOMException(InvalidStateError, IDBDatabase::notGotValueErrorMessage);
|
| + return 0;
|
| + }
|
| + if (isKeyCursor()) {
|
| + es.throwDOMException(InvalidStateError, IDBDatabase::isKeyCursorErrorMessage);
|
| + return 0;
|
| + }
|
| + if (isDeleted()) {
|
| + es.throwDOMException(InvalidStateError, IDBDatabase::sourceDeletedErrorMessage);
|
| + return 0;
|
| + }
|
| + if (m_transaction->isFinished()) {
|
| + es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
|
| return 0;
|
| }
|
| if (!m_transaction->isActive()) {
|
| @@ -145,7 +157,7 @@ PassRefPtr<IDBRequest> IDBCursor::update(ScriptState* state, ScriptValue& value,
|
| if (usesInLineKeys) {
|
| RefPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(m_request->requestState(), value, keyPath);
|
| if (!keyPathKey || !keyPathKey->isEqual(m_currentPrimaryKey.get())) {
|
| - es.throwDOMException(DataError);
|
| + es.throwDOMException(DataError, "The effective object store of this cursor uses in-line keys and evaluating the key path of the value parameter results in a different value than the cursor's effective key.");
|
| return 0;
|
| }
|
| }
|
| @@ -156,11 +168,19 @@ PassRefPtr<IDBRequest> IDBCursor::update(ScriptState* state, ScriptValue& value,
|
| void IDBCursor::advance(unsigned long count, ExceptionState& es)
|
| {
|
| IDB_TRACE("IDBCursor::advance");
|
| - if (!m_gotValue || isDeleted()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + if (!m_gotValue) {
|
| + es.throwDOMException(InvalidStateError, IDBDatabase::notGotValueErrorMessage);
|
| + return;
|
| + }
|
| + if (isDeleted()) {
|
| + es.throwDOMException(InvalidStateError, IDBDatabase::sourceDeletedErrorMessage);
|
| return;
|
| }
|
|
|
| + if (m_transaction->isFinished()) {
|
| + es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
|
| + return;
|
| + }
|
| if (!m_transaction->isActive()) {
|
| es.throwDOMException(TransactionInactiveError);
|
| return;
|
| @@ -187,17 +207,26 @@ void IDBCursor::continueFunction(PassRefPtr<IDBKey> key, ExceptionState& es)
|
| {
|
| IDB_TRACE("IDBCursor::continue");
|
| if (key && !key->isValid()) {
|
| - es.throwDOMException(DataError);
|
| + es.throwDOMException(DataError, IDBDatabase::notValidKeyErrorMessage);
|
| return;
|
| }
|
|
|
| + if (m_transaction->isFinished()) {
|
| + es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
|
| + return;
|
| + }
|
| if (!m_transaction->isActive()) {
|
| es.throwDOMException(TransactionInactiveError);
|
| return;
|
| }
|
|
|
| - if (!m_gotValue || isDeleted()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + if (!m_gotValue) {
|
| + es.throwDOMException(InvalidStateError, IDBDatabase::notGotValueErrorMessage);
|
| + return;
|
| + }
|
| +
|
| + if (isDeleted()) {
|
| + es.throwDOMException(InvalidStateError, IDBDatabase::sourceDeletedErrorMessage);
|
| return;
|
| }
|
|
|
| @@ -205,12 +234,12 @@ void IDBCursor::continueFunction(PassRefPtr<IDBKey> key, ExceptionState& es)
|
| ASSERT(m_currentKey);
|
| if (m_direction == IndexedDB::CursorNext || m_direction == IndexedDB::CursorNextNoDuplicate) {
|
| if (!m_currentKey->isLessThan(key.get())) {
|
| - es.throwDOMException(DataError);
|
| + es.throwDOMException(DataError, "The parameter is less than or equal to this cursor's position.");
|
| return;
|
| }
|
| } else {
|
| if (!key->isLessThan(m_currentKey.get())) {
|
| - es.throwDOMException(DataError);
|
| + es.throwDOMException(DataError, "The parameter is greater than or equal to this cursor's position.");
|
| return;
|
| }
|
| }
|
| @@ -226,6 +255,10 @@ void IDBCursor::continueFunction(PassRefPtr<IDBKey> key, ExceptionState& es)
|
| PassRefPtr<IDBRequest> IDBCursor::deleteFunction(ScriptExecutionContext* context, ExceptionState& es)
|
| {
|
| IDB_TRACE("IDBCursor::delete");
|
| + if (m_transaction->isFinished()) {
|
| + es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
|
| + return 0;
|
| + }
|
| if (!m_transaction->isActive()) {
|
| es.throwDOMException(TransactionInactiveError);
|
| return 0;
|
| @@ -235,8 +268,16 @@ PassRefPtr<IDBRequest> IDBCursor::deleteFunction(ScriptExecutionContext* context
|
| return 0;
|
| }
|
|
|
| - if (!m_gotValue || isKeyCursor() || isDeleted()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + if (!m_gotValue) {
|
| + es.throwDOMException(InvalidStateError, IDBDatabase::notGotValueErrorMessage);
|
| + return 0;
|
| + }
|
| + if (isKeyCursor()) {
|
| + es.throwDOMException(InvalidStateError, IDBDatabase::isKeyCursorErrorMessage);
|
| + return 0;
|
| + }
|
| + if (isDeleted()) {
|
| + es.throwDOMException(InvalidStateError, IDBDatabase::sourceDeletedErrorMessage);
|
| return 0;
|
| }
|
|
|
|
|