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

Side by Side 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, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/storage/indexeddb/idbcursor_continueprimarykey.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (key && !key->isValid()) { 153 if (key && !key->isValid()) {
154 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage); 154 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage);
155 return; 155 return;
156 } 156 }
157 continueFunction(key, 0, exceptionState); 157 continueFunction(key, 0, exceptionState);
158 } 158 }
159 159
160 void IDBCursor::continuePrimaryKey(ScriptState* scriptState, const ScriptValue& keyValue, const ScriptValue& primaryKeyValue, ExceptionState& exceptionState) 160 void IDBCursor::continuePrimaryKey(ScriptState* scriptState, const ScriptValue& keyValue, const ScriptValue& primaryKeyValue, ExceptionState& exceptionState)
161 { 161 {
162 IDB_TRACE("IDBCursor::continuePrimaryKey"); 162 IDB_TRACE("IDBCursor::continuePrimaryKey");
163 if (m_source->type() != IDBAny::IDBIndexType) {
164 exceptionState.throwDOMException(InvalidAccessError, "The cursor's sourc e is not an index.");
165 return;
166 }
167
163 IDBKey* key = ScriptValue::to<IDBKey*>(scriptState->isolate(), keyValue, exc eptionState); 168 IDBKey* key = ScriptValue::to<IDBKey*>(scriptState->isolate(), keyValue, exc eptionState);
164 IDBKey* primaryKey = ScriptValue::to<IDBKey*>(scriptState->isolate(), primar yKeyValue, exceptionState); 169 IDBKey* primaryKey = ScriptValue::to<IDBKey*>(scriptState->isolate(), primar yKeyValue, exceptionState);
165 if (!key->isValid() || !primaryKey->isValid()) { 170 if (!key->isValid() || !primaryKey->isValid()) {
166 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage); 171 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage);
167 return; 172 return;
168 } 173 }
169 continueFunction(key, primaryKey, exceptionState); 174 continueFunction(key, primaryKey, exceptionState);
170 } 175 }
171 176
172 void IDBCursor::continueFunction(IDBKey* key, IDBKey* primaryKey, ExceptionState & exceptionState) 177 void IDBCursor::continueFunction(IDBKey* key, IDBKey* primaryKey, ExceptionState & exceptionState)
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 case WebIDBCursorDirectionPrevNoDuplicate: 377 case WebIDBCursorDirectionPrevNoDuplicate:
373 return IndexedDBNames::prevunique; 378 return IndexedDBNames::prevunique;
374 379
375 default: 380 default:
376 ASSERT_NOT_REACHED(); 381 ASSERT_NOT_REACHED();
377 return IndexedDBNames::next; 382 return IndexedDBNames::next;
378 } 383 }
379 } 384 }
380 385
381 } // namespace blink 386 } // namespace blink
OLDNEW
« 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