OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |