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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 if (m_transaction->isFinished()) { | 154 if (m_transaction->isFinished()) { |
155 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); | 155 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); |
156 return; | 156 return; |
157 } | 157 } |
158 if (!m_transaction->isActive()) { | 158 if (!m_transaction->isActive()) { |
159 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); | 159 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); |
160 return; | 160 return; |
161 } | 161 } |
162 | 162 |
163 if (!count) { | 163 if (!count) { |
164 exceptionState.throwUninformativeAndGenericTypeError(); | 164 exceptionState.throwTypeError("The count provided is 0."); |
165 return; | 165 return; |
166 } | 166 } |
167 | 167 |
168 m_request->setPendingCursor(this); | 168 m_request->setPendingCursor(this); |
169 m_gotValue = false; | 169 m_gotValue = false; |
170 m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).leakPtr()); | 170 m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).leakPtr()); |
171 } | 171 } |
172 | 172 |
173 void IDBCursor::continueFunction(ExecutionContext* context, const ScriptValue& k
eyValue, ExceptionState& exceptionState) | 173 void IDBCursor::continueFunction(ExecutionContext* context, const ScriptValue& k
eyValue, ExceptionState& exceptionState) |
174 { | 174 { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 { | 385 { |
386 if (directionString.isNull() || directionString == IDBCursor::directionNext(
)) | 386 if (directionString.isNull() || directionString == IDBCursor::directionNext(
)) |
387 return IndexedDB::CursorNext; | 387 return IndexedDB::CursorNext; |
388 if (directionString == IDBCursor::directionNextUnique()) | 388 if (directionString == IDBCursor::directionNextUnique()) |
389 return IndexedDB::CursorNextNoDuplicate; | 389 return IndexedDB::CursorNextNoDuplicate; |
390 if (directionString == IDBCursor::directionPrev()) | 390 if (directionString == IDBCursor::directionPrev()) |
391 return IndexedDB::CursorPrev; | 391 return IndexedDB::CursorPrev; |
392 if (directionString == IDBCursor::directionPrevUnique()) | 392 if (directionString == IDBCursor::directionPrevUnique()) |
393 return IndexedDB::CursorPrevNoDuplicate; | 393 return IndexedDB::CursorPrevNoDuplicate; |
394 | 394 |
395 exceptionState.throwUninformativeAndGenericTypeError(); | 395 exceptionState.throwTypeError("The direction provided ('" + directionString
+ "') is not one of 'next', 'nextunique', 'prev', or 'prevunique'."); |
396 return IndexedDB::CursorNext; | 396 return IndexedDB::CursorNext; |
397 } | 397 } |
398 | 398 |
399 const AtomicString& IDBCursor::directionToString(unsigned short direction) | 399 const AtomicString& IDBCursor::directionToString(unsigned short direction) |
400 { | 400 { |
401 switch (direction) { | 401 switch (direction) { |
402 case IndexedDB::CursorNext: | 402 case IndexedDB::CursorNext: |
403 return IDBCursor::directionNext(); | 403 return IDBCursor::directionNext(); |
404 | 404 |
405 case IndexedDB::CursorNextNoDuplicate: | 405 case IndexedDB::CursorNextNoDuplicate: |
406 return IDBCursor::directionNextUnique(); | 406 return IDBCursor::directionNextUnique(); |
407 | 407 |
408 case IndexedDB::CursorPrev: | 408 case IndexedDB::CursorPrev: |
409 return IDBCursor::directionPrev(); | 409 return IDBCursor::directionPrev(); |
410 | 410 |
411 case IndexedDB::CursorPrevNoDuplicate: | 411 case IndexedDB::CursorPrevNoDuplicate: |
412 return IDBCursor::directionPrevUnique(); | 412 return IDBCursor::directionPrevUnique(); |
413 | 413 |
414 default: | 414 default: |
415 ASSERT_NOT_REACHED(); | 415 ASSERT_NOT_REACHED(); |
416 return IDBCursor::directionNext(); | 416 return IDBCursor::directionNext(); |
417 } | 417 } |
418 } | 418 } |
419 | 419 |
420 } // namespace WebCore | 420 } // namespace WebCore |
OLD | NEW |