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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 { | 384 { |
385 if (directionString.isNull() || directionString == IDBCursor::directionNext(
)) | 385 if (directionString.isNull() || directionString == IDBCursor::directionNext(
)) |
386 return IndexedDB::CursorNext; | 386 return IndexedDB::CursorNext; |
387 if (directionString == IDBCursor::directionNextUnique()) | 387 if (directionString == IDBCursor::directionNextUnique()) |
388 return IndexedDB::CursorNextNoDuplicate; | 388 return IndexedDB::CursorNextNoDuplicate; |
389 if (directionString == IDBCursor::directionPrev()) | 389 if (directionString == IDBCursor::directionPrev()) |
390 return IndexedDB::CursorPrev; | 390 return IndexedDB::CursorPrev; |
391 if (directionString == IDBCursor::directionPrevUnique()) | 391 if (directionString == IDBCursor::directionPrevUnique()) |
392 return IndexedDB::CursorPrevNoDuplicate; | 392 return IndexedDB::CursorPrevNoDuplicate; |
393 | 393 |
394 exceptionState.throwUninformativeAndGenericTypeError(); | 394 exceptionState.throwTypeError("The direction provided ('" + directionString
+ "') is not one of 'next', 'nextunique', 'prev', or 'prevunique'."); |
395 return IndexedDB::CursorNext; | 395 return IndexedDB::CursorNext; |
396 } | 396 } |
397 | 397 |
398 const AtomicString& IDBCursor::directionToString(unsigned short direction) | 398 const AtomicString& IDBCursor::directionToString(unsigned short direction) |
399 { | 399 { |
400 switch (direction) { | 400 switch (direction) { |
401 case IndexedDB::CursorNext: | 401 case IndexedDB::CursorNext: |
402 return IDBCursor::directionNext(); | 402 return IDBCursor::directionNext(); |
403 | 403 |
404 case IndexedDB::CursorNextNoDuplicate: | 404 case IndexedDB::CursorNextNoDuplicate: |
405 return IDBCursor::directionNextUnique(); | 405 return IDBCursor::directionNextUnique(); |
406 | 406 |
407 case IndexedDB::CursorPrev: | 407 case IndexedDB::CursorPrev: |
408 return IDBCursor::directionPrev(); | 408 return IDBCursor::directionPrev(); |
409 | 409 |
410 case IndexedDB::CursorPrevNoDuplicate: | 410 case IndexedDB::CursorPrevNoDuplicate: |
411 return IDBCursor::directionPrevUnique(); | 411 return IDBCursor::directionPrevUnique(); |
412 | 412 |
413 default: | 413 default: |
414 ASSERT_NOT_REACHED(); | 414 ASSERT_NOT_REACHED(); |
415 return IDBCursor::directionNext(); | 415 return IDBCursor::directionNext(); |
416 } | 416 } |
417 } | 417 } |
418 | 418 |
419 } // namespace WebCore | 419 } // namespace WebCore |
OLD | NEW |