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) |