Index: Source/modules/indexeddb/IDBIndex.cpp |
diff --git a/Source/modules/indexeddb/IDBIndex.cpp b/Source/modules/indexeddb/IDBIndex.cpp |
index f9a30375c5f207d818643f086bfe854c649ce012..994699a61d3d43059688315b03e5344be68c7630 100644 |
--- a/Source/modules/indexeddb/IDBIndex.cpp |
+++ b/Source/modules/indexeddb/IDBIndex.cpp |
@@ -56,7 +56,7 @@ IDBIndex::~IDBIndex() |
{ |
} |
-PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, const String& directionString, ExceptionState& es) |
+PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, const ScriptValue& range, const String& directionString, ExceptionState& es) |
{ |
IDB_TRACE("IDBIndex::openCursor"); |
if (isDeleted()) { |
@@ -75,22 +75,22 @@ PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, Pas |
if (es.hadException()) |
return 0; |
+ RefPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, range, es); |
+ if (es.hadException()) |
+ return 0; |
+ |
+ return openCursor(context, keyRange, direction); |
+} |
+ |
+PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, IndexedDB::CursorDirection direction) |
+{ |
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); |
request->setCursorDetails(IndexedDB::CursorKeyAndValue, direction); |
backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, direction, false, IDBDatabaseBackendInterface::NormalTask, request); |
return request; |
} |
-PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, const ScriptValue& key, const String& direction, ExceptionState& es) |
-{ |
- IDB_TRACE("IDBIndex::openCursor"); |
- RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(context, key, es); |
- if (es.hadException()) |
- return 0; |
- return openCursor(context, keyRange.release(), direction, es); |
-} |
- |
-PassRefPtr<IDBRequest> IDBIndex::count(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionState& es) |
+PassRefPtr<IDBRequest> IDBIndex::count(ScriptExecutionContext* context, const ScriptValue& range, ExceptionState& es) |
{ |
IDB_TRACE("IDBIndex::count"); |
if (isDeleted()) { |
@@ -105,21 +105,17 @@ PassRefPtr<IDBRequest> IDBIndex::count(ScriptExecutionContext* context, PassRefP |
es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); |
return 0; |
} |
- RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); |
- backendDB()->count(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, request); |
- return request; |
-} |
-PassRefPtr<IDBRequest> IDBIndex::count(ScriptExecutionContext* context, const ScriptValue& key, ExceptionState& es) |
-{ |
- IDB_TRACE("IDBIndex::count"); |
- RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(context, key, es); |
+ RefPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, range, es); |
if (es.hadException()) |
return 0; |
- return count(context, keyRange.release(), es); |
+ |
+ RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); |
+ backendDB()->count(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, request); |
+ return request; |
} |
-PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, const String& directionString, ExceptionState& es) |
+PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, const ScriptValue& range, const String& directionString, ExceptionState& es) |
{ |
IDB_TRACE("IDBIndex::openKeyCursor"); |
if (isDeleted()) { |
@@ -138,33 +134,19 @@ PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, |
if (es.hadException()) |
return 0; |
+ RefPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, range, es); |
+ if (es.hadException()) |
+ return 0; |
+ |
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); |
request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); |
backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, direction, true, IDBDatabaseBackendInterface::NormalTask, request); |
return request; |
} |
-PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, const ScriptValue& key, const String& direction, ExceptionState& es) |
-{ |
- IDB_TRACE("IDBIndex::openKeyCursor"); |
- RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(context, key, es); |
- if (es.hadException()) |
- return 0; |
- return openKeyCursor(context, keyRange.release(), direction, es); |
-} |
- |
PassRefPtr<IDBRequest> IDBIndex::get(ScriptExecutionContext* context, const ScriptValue& key, ExceptionState& es) |
{ |
IDB_TRACE("IDBIndex::get"); |
- RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(context, key, es); |
- if (es.hadException()) |
- return 0; |
- return get(context, keyRange.release(), es); |
-} |
- |
-PassRefPtr<IDBRequest> IDBIndex::get(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionState& es) |
-{ |
- IDB_TRACE("IDBIndex::get"); |
if (isDeleted()) { |
es.throwDOMException(InvalidStateError, IDBDatabase::indexDeletedErrorMessage); |
return 0; |
@@ -177,6 +159,10 @@ PassRefPtr<IDBRequest> IDBIndex::get(ScriptExecutionContext* context, PassRefPtr |
es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); |
return 0; |
} |
+ |
+ RefPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, key, es); |
+ if (es.hadException()) |
+ return 0; |
if (!keyRange) { |
es.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRangeErrorMessage); |
return 0; |
@@ -190,16 +176,6 @@ PassRefPtr<IDBRequest> IDBIndex::get(ScriptExecutionContext* context, PassRefPtr |
PassRefPtr<IDBRequest> IDBIndex::getKey(ScriptExecutionContext* context, const ScriptValue& key, ExceptionState& es) |
{ |
IDB_TRACE("IDBIndex::getKey"); |
- RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(context, key, es); |
- if (es.hadException()) |
- return 0; |
- |
- return getKey(context, keyRange.release(), es); |
-} |
- |
-PassRefPtr<IDBRequest> IDBIndex::getKey(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionState& es) |
-{ |
- IDB_TRACE("IDBIndex::getKey"); |
if (isDeleted()) { |
es.throwDOMException(InvalidStateError, IDBDatabase::indexDeletedErrorMessage); |
return 0; |
@@ -212,6 +188,10 @@ PassRefPtr<IDBRequest> IDBIndex::getKey(ScriptExecutionContext* context, PassRef |
es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); |
return 0; |
} |
+ |
+ RefPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, key, es); |
+ if (es.hadException()) |
+ return 0; |
if (!keyRange) { |
es.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRangeErrorMessage); |
return 0; |