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

Side by Side Diff: Source/modules/indexeddb/IDBCursor.cpp

Issue 1188343002: IndexedDB: Disallow continuePrimaryKey on unique cursors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make assertion message more specific 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 continueFunction(key, nullptr, exceptionState); 159 continueFunction(key, nullptr, exceptionState);
160 } 160 }
161 161
162 void IDBCursor::continuePrimaryKey(ScriptState* scriptState, const ScriptValue& keyValue, const ScriptValue& primaryKeyValue, ExceptionState& exceptionState) 162 void IDBCursor::continuePrimaryKey(ScriptState* scriptState, const ScriptValue& keyValue, const ScriptValue& primaryKeyValue, ExceptionState& exceptionState)
163 { 163 {
164 IDB_TRACE("IDBCursor::continuePrimaryKey"); 164 IDB_TRACE("IDBCursor::continuePrimaryKey");
165 if (m_source->type() != IDBAny::IDBIndexType) { 165 if (m_source->type() != IDBAny::IDBIndexType) {
166 exceptionState.throwDOMException(InvalidAccessError, "The cursor's sourc e is not an index."); 166 exceptionState.throwDOMException(InvalidAccessError, "The cursor's sourc e is not an index.");
167 return; 167 return;
168 } 168 }
169 if (m_direction != WebIDBCursorDirectionNext && m_direction != WebIDBCursorD irectionPrev) {
170 exceptionState.throwDOMException(InvalidAccessError, "The cursor's direc tion is not 'next' or 'prev'.");
171 return;
172 }
169 173
170 IDBKey* key = ScriptValue::to<IDBKey*>(scriptState->isolate(), keyValue, exc eptionState); 174 IDBKey* key = ScriptValue::to<IDBKey*>(scriptState->isolate(), keyValue, exc eptionState);
171 if (exceptionState.hadException()) 175 if (exceptionState.hadException())
172 return; 176 return;
173 if (!key->isValid()) { 177 if (!key->isValid()) {
174 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage); 178 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage);
175 return; 179 return;
176 } 180 }
177 181
178 IDBKey* primaryKey = ScriptValue::to<IDBKey*>(scriptState->isolate(), primar yKeyValue, exceptionState); 182 IDBKey* primaryKey = ScriptValue::to<IDBKey*>(scriptState->isolate(), primar yKeyValue, exceptionState);
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 case WebIDBCursorDirectionPrevNoDuplicate: 393 case WebIDBCursorDirectionPrevNoDuplicate:
390 return IndexedDBNames::prevunique; 394 return IndexedDBNames::prevunique;
391 395
392 default: 396 default:
393 ASSERT_NOT_REACHED(); 397 ASSERT_NOT_REACHED();
394 return IndexedDBNames::next; 398 return IndexedDBNames::next;
395 } 399 }
396 } 400 }
397 401
398 } // namespace blink 402 } // 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