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

Unified 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: Update expected outputs Created 6 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/indexeddb/IDBCursor.cpp
diff --git a/Source/modules/indexeddb/IDBCursor.cpp b/Source/modules/indexeddb/IDBCursor.cpp
index 8ea735858c5ba2e5254bbb7ca3ec2074d93d6faa..ed68e84584ce7cb5e220a845a730adf99e6927d3 100644
--- a/Source/modules/indexeddb/IDBCursor.cpp
+++ b/Source/modules/indexeddb/IDBCursor.cpp
@@ -142,6 +142,10 @@ PassRefPtr<IDBRequest> IDBCursor::update(ScriptState* state, ScriptValue& value,
void IDBCursor::advance(unsigned long count, ExceptionState& exceptionState)
{
IDB_TRACE("IDBCursor::advance");
+ 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
+ exceptionState.throwTypeError("A count argument with value 0 (zero) was supplied, must be greater than 0.");
+ return;
+ }
if (!m_gotValue) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::noValueErrorMessage);
return;
@@ -160,11 +164,6 @@ void IDBCursor::advance(unsigned long count, ExceptionState& exceptionState)
return;
}
- if (!count) {
- exceptionState.throwUninformativeAndGenericTypeError();
- return;
- }
-
m_request->setPendingCursor(this);
m_gotValue = false;
m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).leakPtr());

Powered by Google App Engine
This is Rietveld 408576698