Chromium Code Reviews| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 return 0; | 135 return 0; |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 return objectStore->put(WebIDBDatabase::CursorUpdate, IDBAny::create(this), state, value, m_primaryKey, exceptionState); | 139 return objectStore->put(WebIDBDatabase::CursorUpdate, IDBAny::create(this), state, value, m_primaryKey, exceptionState); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void IDBCursor::advance(unsigned long count, ExceptionState& exceptionState) | 142 void IDBCursor::advance(unsigned long count, ExceptionState& exceptionState) |
| 143 { | 143 { |
| 144 IDB_TRACE("IDBCursor::advance"); | 144 IDB_TRACE("IDBCursor::advance"); |
| 145 if (!count) { | |
|
jsbell
2014/01/02 18:03:23
Any particular reason for changing the order? lgtm
sof
2014/01/02 19:30:31
The spec was the motivation for moving it up, but
| |
| 146 exceptionState.throwTypeError("A count argument with value 0 (zero) was supplied, must be greater than 0."); | |
| 147 return; | |
| 148 } | |
| 145 if (!m_gotValue) { | 149 if (!m_gotValue) { |
| 146 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::noValue ErrorMessage); | 150 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::noValue ErrorMessage); |
| 147 return; | 151 return; |
| 148 } | 152 } |
| 149 if (isDeleted()) { | 153 if (isDeleted()) { |
| 150 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::sourceD eletedErrorMessage); | 154 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::sourceD eletedErrorMessage); |
| 151 return; | 155 return; |
| 152 } | 156 } |
| 153 | 157 |
| 154 if (m_transaction->isFinished()) { | 158 if (m_transaction->isFinished()) { |
| 155 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage); | 159 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage); |
| 156 return; | 160 return; |
| 157 } | 161 } |
| 158 if (!m_transaction->isActive()) { | 162 if (!m_transaction->isActive()) { |
| 159 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionInactiveErrorMessage); | 163 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionInactiveErrorMessage); |
| 160 return; | 164 return; |
| 161 } | 165 } |
| 162 | 166 |
| 163 if (!count) { | |
| 164 exceptionState.throwUninformativeAndGenericTypeError(); | |
| 165 return; | |
| 166 } | |
| 167 | |
| 168 m_request->setPendingCursor(this); | 167 m_request->setPendingCursor(this); |
| 169 m_gotValue = false; | 168 m_gotValue = false; |
| 170 m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).leakPtr()); | 169 m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).leakPtr()); |
| 171 } | 170 } |
| 172 | 171 |
| 173 void IDBCursor::continueFunction(ExecutionContext* context, const ScriptValue& k eyValue, ExceptionState& exceptionState) | 172 void IDBCursor::continueFunction(ExecutionContext* context, const ScriptValue& k eyValue, ExceptionState& exceptionState) |
| 174 { | 173 { |
| 175 IDB_TRACE("IDBCursor::continue"); | 174 IDB_TRACE("IDBCursor::continue"); |
| 176 DOMRequestState requestState(context); | 175 DOMRequestState requestState(context); |
| 177 RefPtr<IDBKey> key = keyValue.isUndefined() || keyValue.isNull() ? 0 : scrip tValueToIDBKey(&requestState, keyValue); | 176 RefPtr<IDBKey> key = keyValue.isUndefined() || keyValue.isNull() ? 0 : scrip tValueToIDBKey(&requestState, keyValue); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 411 case IndexedDB::CursorPrevNoDuplicate: | 410 case IndexedDB::CursorPrevNoDuplicate: |
| 412 return IDBCursor::directionPrevUnique(); | 411 return IDBCursor::directionPrevUnique(); |
| 413 | 412 |
| 414 default: | 413 default: |
| 415 ASSERT_NOT_REACHED(); | 414 ASSERT_NOT_REACHED(); |
| 416 return IDBCursor::directionNext(); | 415 return IDBCursor::directionNext(); |
| 417 } | 416 } |
| 418 } | 417 } |
| 419 | 418 |
| 420 } // namespace WebCore | 419 } // namespace WebCore |
| OLD | NEW |