| Index: Source/modules/indexeddb/IDBCursor.cpp
|
| diff --git a/Source/modules/indexeddb/IDBCursor.cpp b/Source/modules/indexeddb/IDBCursor.cpp
|
| index 95b7a33ab315851d786a48f0e2645b7344cdd45c..a4eec9b77e80a6319f53fd698c72cce878a5c806 100644
|
| --- a/Source/modules/indexeddb/IDBCursor.cpp
|
| +++ b/Source/modules/indexeddb/IDBCursor.cpp
|
| @@ -26,6 +26,7 @@
|
| #include "config.h"
|
| #include "modules/indexeddb/IDBCursor.h"
|
|
|
| +#include "bindings/v8/ExceptionState.h"
|
| #include "bindings/v8/IDBBindingUtilities.h"
|
| #include "core/dom/ExceptionCode.h"
|
| #include "core/dom/ScriptExecutionContext.h"
|
| @@ -121,20 +122,20 @@ IDBAny* IDBCursor::source() const
|
| return m_source.get();
|
| }
|
|
|
| -PassRefPtr<IDBRequest> IDBCursor::update(ScriptState* state, ScriptValue& value, ExceptionCode& ec)
|
| +PassRefPtr<IDBRequest> IDBCursor::update(ScriptState* state, ScriptValue& value, ExceptionState& es)
|
| {
|
| IDB_TRACE("IDBCursor::update");
|
|
|
| if (!m_gotValue || isKeyCursor() || isDeleted()) {
|
| - ec = InvalidStateError;
|
| + es.throwDOMException(InvalidStateError);
|
| return 0;
|
| }
|
| if (!m_transaction->isActive()) {
|
| - ec = TransactionInactiveError;
|
| + es.throwDOMException(TransactionInactiveError);
|
| return 0;
|
| }
|
| if (m_transaction->isReadOnly()) {
|
| - ec = ReadOnlyError;
|
| + es.throwDOMException(ReadOnlyError);
|
| return 0;
|
| }
|
|
|
| @@ -144,30 +145,29 @@ 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())) {
|
| - ec = DataError;
|
| + es.throwDOMException(DataError);
|
| return 0;
|
| }
|
| }
|
|
|
| - return objectStore->put(IDBDatabaseBackendInterface::CursorUpdate, IDBAny::create(this), state, value, m_currentPrimaryKey, ec);
|
| + return objectStore->put(IDBDatabaseBackendInterface::CursorUpdate, IDBAny::create(this), state, value, m_currentPrimaryKey, es);
|
| }
|
|
|
| -void IDBCursor::advance(unsigned long count, ExceptionCode& ec)
|
| +void IDBCursor::advance(unsigned long count, ExceptionState& es)
|
| {
|
| - ec = 0;
|
| IDB_TRACE("IDBCursor::advance");
|
| if (!m_gotValue || isDeleted()) {
|
| - ec = InvalidStateError;
|
| + es.throwDOMException(InvalidStateError);
|
| return;
|
| }
|
|
|
| if (!m_transaction->isActive()) {
|
| - ec = TransactionInactiveError;
|
| + es.throwDOMException(TransactionInactiveError);
|
| return;
|
| }
|
|
|
| if (!count) {
|
| - ec = TypeError;
|
| + es.throwTypeError();
|
| return;
|
| }
|
|
|
| @@ -176,29 +176,28 @@ void IDBCursor::advance(unsigned long count, ExceptionCode& ec)
|
| m_backend->advance(count, m_request);
|
| }
|
|
|
| -void IDBCursor::continueFunction(ScriptExecutionContext* context, const ScriptValue& keyValue, ExceptionCode& ec)
|
| +void IDBCursor::continueFunction(ScriptExecutionContext* context, const ScriptValue& keyValue, ExceptionState& es)
|
| {
|
| DOMRequestState requestState(context);
|
| RefPtr<IDBKey> key = keyValue.isUndefined() ? 0 : scriptValueToIDBKey(&requestState, keyValue);
|
| - continueFunction(key.release(), ec);
|
| + continueFunction(key.release(), es);
|
| }
|
|
|
| -void IDBCursor::continueFunction(PassRefPtr<IDBKey> key, ExceptionCode& ec)
|
| +void IDBCursor::continueFunction(PassRefPtr<IDBKey> key, ExceptionState& es)
|
| {
|
| - ec = 0;
|
| IDB_TRACE("IDBCursor::continue");
|
| if (key && !key->isValid()) {
|
| - ec = DataError;
|
| + es.throwDOMException(DataError);
|
| return;
|
| }
|
|
|
| if (!m_transaction->isActive()) {
|
| - ec = TransactionInactiveError;
|
| + es.throwDOMException(TransactionInactiveError);
|
| return;
|
| }
|
|
|
| if (!m_gotValue || isDeleted()) {
|
| - ec = InvalidStateError;
|
| + es.throwDOMException(InvalidStateError);
|
| return;
|
| }
|
|
|
| @@ -206,12 +205,12 @@ void IDBCursor::continueFunction(PassRefPtr<IDBKey> key, ExceptionCode& ec)
|
| ASSERT(m_currentKey);
|
| if (m_direction == IndexedDB::CursorNext || m_direction == IndexedDB::CursorNextNoDuplicate) {
|
| if (!m_currentKey->isLessThan(key.get())) {
|
| - ec = DataError;
|
| + es.throwDOMException(DataError);
|
| return;
|
| }
|
| } else {
|
| if (!key->isLessThan(m_currentKey.get())) {
|
| - ec = DataError;
|
| + es.throwDOMException(DataError);
|
| return;
|
| }
|
| }
|
| @@ -224,26 +223,25 @@ void IDBCursor::continueFunction(PassRefPtr<IDBKey> key, ExceptionCode& ec)
|
| m_backend->continueFunction(key, m_request);
|
| }
|
|
|
| -PassRefPtr<IDBRequest> IDBCursor::deleteFunction(ScriptExecutionContext* context, ExceptionCode& ec)
|
| +PassRefPtr<IDBRequest> IDBCursor::deleteFunction(ScriptExecutionContext* context, ExceptionState& es)
|
| {
|
| - ec = 0;
|
| IDB_TRACE("IDBCursor::delete");
|
| if (!m_transaction->isActive()) {
|
| - ec = TransactionInactiveError;
|
| + es.throwDOMException(TransactionInactiveError);
|
| return 0;
|
| }
|
| if (m_transaction->isReadOnly()) {
|
| - ec = ReadOnlyError;
|
| + es.throwDOMException(ReadOnlyError);
|
| return 0;
|
| }
|
|
|
| if (!m_gotValue || isKeyCursor() || isDeleted()) {
|
| - ec = InvalidStateError;
|
| + es.throwDOMException(InvalidStateError);
|
| return 0;
|
| }
|
|
|
| - RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(m_currentPrimaryKey, ec);
|
| - ASSERT(!ec);
|
| + RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(m_currentPrimaryKey, es);
|
| + ASSERT(!es);
|
|
|
| RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
|
| m_transaction->backendDB()->deleteRange(m_transaction->id(), effectiveObjectStore()->id(), keyRange, request);
|
| @@ -305,7 +303,7 @@ bool IDBCursor::isDeleted() const
|
| return m_source->idbIndex()->isDeleted();
|
| }
|
|
|
| -IndexedDB::CursorDirection IDBCursor::stringToDirection(const String& directionString, ExceptionCode& ec)
|
| +IndexedDB::CursorDirection IDBCursor::stringToDirection(const String& directionString, ExceptionState& es)
|
| {
|
| if (directionString.isNull() || directionString == IDBCursor::directionNext())
|
| return IndexedDB::CursorNext;
|
| @@ -316,7 +314,7 @@ IndexedDB::CursorDirection IDBCursor::stringToDirection(const String& directionS
|
| if (directionString == IDBCursor::directionPrevUnique())
|
| return IndexedDB::CursorPrevNoDuplicate;
|
|
|
| - ec = TypeError;
|
| + es.throwTypeError();
|
| return IndexedDB::CursorNext;
|
| }
|
|
|
|
|