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

Unified Diff: Source/modules/indexeddb/IDBKeyRange.cpp

Issue 22893058: IndexedDB: Replace IDL operation overloading with ScriptValue handling (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove assert, per review feedback Created 7 years, 4 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/modules/indexeddb/IDBKeyRange.h ('k') | Source/modules/indexeddb/IDBObjectStore.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/indexeddb/IDBKeyRange.cpp
diff --git a/Source/modules/indexeddb/IDBKeyRange.cpp b/Source/modules/indexeddb/IDBKeyRange.cpp
index f646387a2a3dc3acee7ea3d1f8fdf05b9b864c29..b3e4feb2d8576d1527e31d9543e4353529325f5f 100644
--- a/Source/modules/indexeddb/IDBKeyRange.cpp
+++ b/Source/modules/indexeddb/IDBKeyRange.cpp
@@ -41,6 +41,25 @@ PassRefPtr<IDBKeyRange> IDBKeyRange::create(PassRefPtr<IDBKey> prpKey)
return adoptRef(new IDBKeyRange(key, key, LowerBoundClosed, UpperBoundClosed));
}
+PassRefPtr<IDBKeyRange> IDBKeyRange::fromScriptValue(ScriptExecutionContext* context, const ScriptValue& value, ExceptionState& es)
+{
+ DOMRequestState requestState(context);
+ if (value.isUndefined() || value.isNull())
+ return 0;
+
+ RefPtr<IDBKeyRange> range = scriptValueToIDBKeyRange(&requestState, value);
+ if (range)
+ return range.release();
+
+ RefPtr<IDBKey> key = scriptValueToIDBKey(&requestState, value);
+ if (!key || !key->isValid()) {
+ es.throwDOMException(DataError, IDBDatabase::notValidKeyErrorMessage);
+ return 0;
+ }
+
+ return adoptRef(new IDBKeyRange(key, key, LowerBoundClosed, UpperBoundClosed));
+}
+
IDBKeyRange::IDBKeyRange(PassRefPtr<IDBKey> lower, PassRefPtr<IDBKey> upper, LowerBoundType lowerType, UpperBoundType upperType)
: m_lower(lower)
, m_upper(upper)
« no previous file with comments | « Source/modules/indexeddb/IDBKeyRange.h ('k') | Source/modules/indexeddb/IDBObjectStore.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698