Index: Source/modules/indexeddb/IDBIndex.cpp |
diff --git a/Source/modules/indexeddb/IDBIndex.cpp b/Source/modules/indexeddb/IDBIndex.cpp |
index fad31a9ab8d8887d71ee64e4892fd1fc50010ac2..2ec9aa1c3099acf214ea43b0eda243e15e684b61 100644 |
--- a/Source/modules/indexeddb/IDBIndex.cpp |
+++ b/Source/modules/indexeddb/IDBIndex.cpp |
@@ -155,35 +155,17 @@ PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ExecutionContext* context, const |
PassRefPtr<IDBRequest> IDBIndex::get(ExecutionContext* context, const ScriptValue& key, ExceptionState& exceptionState) |
{ |
IDB_TRACE("IDBIndex::get"); |
- if (isDeleted()) { |
- exceptionState.throwDOMException(InvalidStateError, IDBDatabase::indexDeletedErrorMessage); |
- return 0; |
- } |
- if (m_transaction->isFinished()) { |
- exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); |
- return 0; |
- } |
- if (!m_transaction->isActive()) { |
- exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); |
- return 0; |
- } |
- |
- RefPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, key, exceptionState); |
- if (exceptionState.hadException()) |
- return 0; |
- if (!keyRange) { |
- exceptionState.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRangeErrorMessage); |
- return 0; |
- } |
- |
- RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); |
- backendDB()->get(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange.release(), false, WebIDBCallbacksImpl::create(request).leakPtr()); |
- return request; |
+ return getInternal(context, key, exceptionState, false); |
} |
PassRefPtr<IDBRequest> IDBIndex::getKey(ExecutionContext* context, const ScriptValue& key, ExceptionState& exceptionState) |
{ |
IDB_TRACE("IDBIndex::getKey"); |
+ return getInternal(context, key, exceptionState, true); |
+} |
+ |
+PassRefPtr<IDBRequest> IDBIndex::getInternal(ExecutionContext* context, const ScriptValue& key, ExceptionState& exceptionState, bool keyOnly) |
+{ |
if (isDeleted()) { |
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::indexDeletedErrorMessage); |
return 0; |
@@ -206,7 +188,7 @@ PassRefPtr<IDBRequest> IDBIndex::getKey(ExecutionContext* context, const ScriptV |
} |
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); |
- backendDB()->get(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange.release(), true, WebIDBCallbacksImpl::create(request).leakPtr()); |
+ backendDB()->get(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange.release(), keyOnly, WebIDBCallbacksImpl::create(request).leakPtr()); |
return request; |
} |