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

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

Issue 121113004: Improve handling of failed integer type conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 11 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
« no previous file with comments | « Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp ('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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) {
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
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
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698