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

Side by Side Diff: Source/WebCore/Modules/indexeddb/IDBCursor.cpp

Issue 11184033: Merge 131658 - IndexedDB: Enforce unsigned long/unsigned long long ranges (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1271/
Patch Set: Created 8 years, 2 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
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 RefPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(value, keyPath); 148 RefPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(value, keyPath);
149 if (!keyPathKey || !keyPathKey->isEqual(m_currentPrimaryKey.get())) { 149 if (!keyPathKey || !keyPathKey->isEqual(m_currentPrimaryKey.get())) {
150 ec = IDBDatabaseException::DATA_ERR; 150 ec = IDBDatabaseException::DATA_ERR;
151 return 0; 151 return 0;
152 } 152 }
153 } 153 }
154 154
155 return objectStore->put(IDBObjectStoreBackendInterface::CursorUpdate, IDBAny ::create(this), context, value, m_currentPrimaryKey, ec); 155 return objectStore->put(IDBObjectStoreBackendInterface::CursorUpdate, IDBAny ::create(this), context, value, m_currentPrimaryKey, ec);
156 } 156 }
157 157
158 void IDBCursor::advance(unsigned long count, ExceptionCode& ec) 158 void IDBCursor::advance(long count, ExceptionCode& ec)
159 { 159 {
160 IDB_TRACE("IDBCursor::advance"); 160 IDB_TRACE("IDBCursor::advance");
161 if (!m_gotValue) { 161 if (!m_gotValue) {
162 ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; 162 ec = IDBDatabaseException::IDB_INVALID_STATE_ERR;
163 return; 163 return;
164 } 164 }
165 165
166 if (!m_transaction->isActive()) { 166 if (!m_transaction->isActive()) {
167 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; 167 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;
168 return; 168 return;
169 } 169 }
170 170
171 if (!count) { 171 // FIXME: This should only need to check for 0 once webkit.org/b/96798 lands .
172 const int64_t maxECMAScriptInteger = 0x20000000000000LL - 1;
173 if (count < 1 || count > maxECMAScriptInteger) {
172 ec = NATIVE_TYPE_ERR; 174 ec = NATIVE_TYPE_ERR;
173 return; 175 return;
174 } 176 }
175 177
176 m_request->setPendingCursor(this); 178 m_request->setPendingCursor(this);
177 m_gotValue = false; 179 m_gotValue = false;
178 m_backend->advance(count, m_request, ec); 180 m_backend->advance(count, m_request, ec);
179 if (ec) 181 if (ec)
180 m_request->markEarlyDeath(); 182 m_request->markEarlyDeath();
181 } 183 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 325
324 default: 326 default:
325 ec = NATIVE_TYPE_ERR; 327 ec = NATIVE_TYPE_ERR;
326 return IDBCursor::directionNext(); 328 return IDBCursor::directionNext();
327 } 329 }
328 } 330 }
329 331
330 } // namespace WebCore 332 } // namespace WebCore
331 333
332 #endif // ENABLE(INDEXED_DATABASE) 334 #endif // ENABLE(INDEXED_DATABASE)
OLDNEW
« no previous file with comments | « Source/WebCore/Modules/indexeddb/IDBCursor.h ('k') | Source/WebCore/Modules/indexeddb/IDBCursor.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698