Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1029)

Unified Diff: Source/modules/indexeddb/IDBCursor.cpp

Issue 1160853004: IndexedDB: continuePrimaryKey() on object store cursor should throw (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: eschew assert_true Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/storage/indexeddb/idbcursor_continueprimarykey.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/indexeddb/IDBCursor.cpp
diff --git a/Source/modules/indexeddb/IDBCursor.cpp b/Source/modules/indexeddb/IDBCursor.cpp
index 8ec7e528b4bc5d8b32b786f4f497d8ceb3cd05a6..6385679fad0352761f878aec17e4441d8e30e23a 100644
--- a/Source/modules/indexeddb/IDBCursor.cpp
+++ b/Source/modules/indexeddb/IDBCursor.cpp
@@ -160,6 +160,11 @@ void IDBCursor::continueFunction(ScriptState* scriptState, const ScriptValue& ke
void IDBCursor::continuePrimaryKey(ScriptState* scriptState, const ScriptValue& keyValue, const ScriptValue& primaryKeyValue, ExceptionState& exceptionState)
{
IDB_TRACE("IDBCursor::continuePrimaryKey");
+ if (m_source->type() != IDBAny::IDBIndexType) {
+ exceptionState.throwDOMException(InvalidAccessError, "The cursor's source is not an index.");
+ return;
+ }
+
IDBKey* key = ScriptValue::to<IDBKey*>(scriptState->isolate(), keyValue, exceptionState);
IDBKey* primaryKey = ScriptValue::to<IDBKey*>(scriptState->isolate(), primaryKeyValue, exceptionState);
if (!key->isValid() || !primaryKey->isValid()) {
« no previous file with comments | « LayoutTests/storage/indexeddb/idbcursor_continueprimarykey.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698