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

Unified Diff: Source/WebCore/Modules/indexeddb/IDBFactory.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/Modules/indexeddb/IDBFactory.h ('k') | Source/WebCore/Modules/indexeddb/IDBFactory.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/Modules/indexeddb/IDBFactory.cpp
===================================================================
--- Source/WebCore/Modules/indexeddb/IDBFactory.cpp (revision 131667)
+++ Source/WebCore/Modules/indexeddb/IDBFactory.cpp (working copy)
@@ -108,13 +108,19 @@
PassRefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext* context, const String& name, int64_t version, ExceptionCode& ec)
{
- if (name.isNull()) {
+ // FIXME: This should only need to check for 0 once webkit.org/b/96798 lands.
+ const int64_t maxECMAScriptInteger = 0x20000000000000LL - 1;
+ if (version < 1 || version > maxECMAScriptInteger) {
ec = NATIVE_TYPE_ERR;
return 0;
}
- // FIXME: We need to throw an error if script passes -1. Somehow refactor
- // this to avoid wanting to throw an error with the sentinel.
- if (!version || version < IDBDatabaseMetadata::NoIntVersion) {
+ return openInternal(context, name, version, ec);
+}
+
+PassRefPtr<IDBOpenDBRequest> IDBFactory::openInternal(ScriptExecutionContext* context, const String& name, int64_t version, ExceptionCode& ec)
+{
+ ASSERT(version >= 1 || version == IDBDatabaseMetadata::NoIntVersion);
+ if (name.isNull()) {
ec = NATIVE_TYPE_ERR;
return 0;
}
@@ -129,7 +135,7 @@
PassRefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext* context, const String& name, ExceptionCode& ec)
{
- return open(context, name, IDBDatabaseMetadata::NoIntVersion, ec);
+ return openInternal(context, name, IDBDatabaseMetadata::NoIntVersion, ec);
}
PassRefPtr<IDBVersionChangeRequest> IDBFactory::deleteDatabase(ScriptExecutionContext* context, const String& name, ExceptionCode& ec)
« no previous file with comments | « Source/WebCore/Modules/indexeddb/IDBFactory.h ('k') | Source/WebCore/Modules/indexeddb/IDBFactory.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698