2010-06-23 23:46:08 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-06-23 23:46:08 +04:00
|
|
|
|
|
|
|
#include "IDBKeyRange.h"
|
|
|
|
|
2010-11-11 02:26:00 +03:00
|
|
|
#include "Key.h"
|
2014-09-27 03:21:57 +04:00
|
|
|
#include "mozilla/ErrorResult.h"
|
|
|
|
#include "mozilla/dom/BindingUtils.h"
|
2013-09-28 15:25:46 +04:00
|
|
|
#include "mozilla/dom/IDBKeyRangeBinding.h"
|
2014-09-27 03:21:57 +04:00
|
|
|
#include "mozilla/dom/indexedDB/PBackgroundIDBSharedTypes.h"
|
2012-06-01 21:21:12 +04:00
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
namespace indexedDB {
|
2010-06-23 23:46:08 +04:00
|
|
|
|
2013-08-02 13:38:49 +04:00
|
|
|
namespace {
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
nsresult
|
2011-11-03 19:57:30 +04:00
|
|
|
GetKeyFromJSVal(JSContext* aCx,
|
2014-01-23 23:49:40 +04:00
|
|
|
JS::Handle<JS::Value> aVal,
|
2011-11-03 19:57:30 +04:00
|
|
|
Key& aKey,
|
|
|
|
bool aAllowUnset = false)
|
|
|
|
{
|
|
|
|
nsresult rv = aKey.SetFromJSVal(aCx, aVal);
|
|
|
|
if (NS_FAILED(rv)) {
|
2014-09-27 03:21:57 +04:00
|
|
|
MOZ_ASSERT(NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM_INDEXEDDB);
|
2011-11-03 19:57:30 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aKey.IsUnset() && !aAllowUnset) {
|
|
|
|
return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-08-02 13:38:49 +04:00
|
|
|
} // anonymous namespace
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
IDBKeyRange::IDBKeyRange(nsISupports* aGlobal,
|
|
|
|
bool aLowerOpen,
|
|
|
|
bool aUpperOpen,
|
|
|
|
bool aIsOnly)
|
|
|
|
: mGlobal(aGlobal)
|
2015-01-14 10:59:06 +03:00
|
|
|
, mCachedLowerVal(JS::UndefinedValue())
|
|
|
|
, mCachedUpperVal(JS::UndefinedValue())
|
2014-09-27 03:21:57 +04:00
|
|
|
, mLowerOpen(aLowerOpen)
|
|
|
|
, mUpperOpen(aUpperOpen)
|
|
|
|
, mIsOnly(aIsOnly)
|
|
|
|
, mHaveCachedLowerVal(false)
|
|
|
|
, mHaveCachedUpperVal(false)
|
|
|
|
, mRooted(false)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
mOwningThread = PR_GetCurrentThread();
|
|
|
|
#endif
|
|
|
|
AssertIsOnOwningThread();
|
|
|
|
}
|
|
|
|
|
|
|
|
IDBKeyRange::~IDBKeyRange()
|
|
|
|
{
|
|
|
|
DropJSObjects();
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
void
|
|
|
|
IDBKeyRange::AssertIsOnOwningThread() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mOwningThread);
|
|
|
|
MOZ_ASSERT(PR_GetCurrentThread() == mOwningThread);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // DEBUG
|
|
|
|
|
2010-06-23 23:46:08 +04:00
|
|
|
// static
|
2011-11-03 19:57:30 +04:00
|
|
|
nsresult
|
|
|
|
IDBKeyRange::FromJSVal(JSContext* aCx,
|
2014-01-23 23:49:40 +04:00
|
|
|
JS::Handle<JS::Value> aVal,
|
2011-11-03 19:57:30 +04:00
|
|
|
IDBKeyRange** aKeyRange)
|
2010-06-23 23:46:08 +04:00
|
|
|
{
|
2011-11-03 19:57:30 +04:00
|
|
|
nsRefPtr<IDBKeyRange> keyRange;
|
|
|
|
|
2013-09-28 15:25:46 +04:00
|
|
|
if (aVal.isNullOrUndefined()) {
|
2011-11-03 19:57:30 +04:00
|
|
|
// undefined and null returns no IDBKeyRange.
|
2013-09-28 15:25:46 +04:00
|
|
|
keyRange.forget(aKeyRange);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2013-08-02 13:38:49 +04:00
|
|
|
|
2013-11-11 12:04:41 +04:00
|
|
|
JS::Rooted<JSObject*> obj(aCx, aVal.isObject() ? &aVal.toObject() : nullptr);
|
2013-09-28 15:25:46 +04:00
|
|
|
if (aVal.isPrimitive() || JS_IsArrayObject(aCx, obj) ||
|
|
|
|
JS_ObjectIsDate(aCx, obj)) {
|
|
|
|
// A valid key returns an 'only' IDBKeyRange.
|
|
|
|
keyRange = new IDBKeyRange(nullptr, false, false, true);
|
2013-08-02 13:38:49 +04:00
|
|
|
|
2013-09-28 15:25:46 +04:00
|
|
|
nsresult rv = GetKeyFromJSVal(aCx, aVal, keyRange->Lower());
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
2013-09-19 11:54:01 +04:00
|
|
|
}
|
2013-09-28 15:25:46 +04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
MOZ_ASSERT(aVal.isObject());
|
|
|
|
// An object is not permitted unless it's another IDBKeyRange.
|
2013-11-21 16:51:16 +04:00
|
|
|
if (NS_FAILED(UNWRAP_OBJECT(IDBKeyRange, obj, keyRange))) {
|
2013-09-28 15:25:46 +04:00
|
|
|
return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
|
2013-09-19 11:54:01 +04:00
|
|
|
}
|
2011-11-03 19:57:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
keyRange.forget(aKeyRange);
|
|
|
|
return NS_OK;
|
2010-06-23 23:46:08 +04:00
|
|
|
}
|
|
|
|
|
2012-06-01 21:21:12 +04:00
|
|
|
// static
|
|
|
|
already_AddRefed<IDBKeyRange>
|
2014-09-27 03:21:57 +04:00
|
|
|
IDBKeyRange::FromSerialized(const SerializedKeyRange& aKeyRange)
|
2012-06-01 21:21:12 +04:00
|
|
|
{
|
|
|
|
nsRefPtr<IDBKeyRange> keyRange =
|
2013-09-28 15:25:46 +04:00
|
|
|
new IDBKeyRange(nullptr, aKeyRange.lowerOpen(), aKeyRange.upperOpen(),
|
2012-06-01 21:21:12 +04:00
|
|
|
aKeyRange.isOnly());
|
|
|
|
keyRange->Lower() = aKeyRange.lower();
|
|
|
|
if (!keyRange->IsOnly()) {
|
|
|
|
keyRange->Upper() = aKeyRange.upper();
|
|
|
|
}
|
|
|
|
return keyRange.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-09-27 03:21:57 +04:00
|
|
|
IDBKeyRange::ToSerialized(SerializedKeyRange& aKeyRange) const
|
2012-06-01 21:21:12 +04:00
|
|
|
{
|
2014-09-27 03:21:57 +04:00
|
|
|
aKeyRange.lowerOpen() = LowerOpen();
|
|
|
|
aKeyRange.upperOpen() = UpperOpen();
|
2012-06-01 21:21:12 +04:00
|
|
|
aKeyRange.isOnly() = IsOnly();
|
|
|
|
|
|
|
|
aKeyRange.lower() = Lower();
|
|
|
|
if (!IsOnly()) {
|
|
|
|
aKeyRange.upper() = Upper();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
void
|
|
|
|
IDBKeyRange::GetBindingClause(const nsACString& aKeyColumnName,
|
|
|
|
nsACString& _retval) const
|
|
|
|
{
|
|
|
|
NS_NAMED_LITERAL_CSTRING(andStr, " AND ");
|
|
|
|
NS_NAMED_LITERAL_CSTRING(spacecolon, " :");
|
|
|
|
NS_NAMED_LITERAL_CSTRING(lowerKey, "lower_key");
|
|
|
|
|
|
|
|
if (IsOnly()) {
|
|
|
|
// Both keys are set and they're equal.
|
|
|
|
_retval = andStr + aKeyColumnName + NS_LITERAL_CSTRING(" =") +
|
|
|
|
spacecolon + lowerKey;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAutoCString clause;
|
|
|
|
|
|
|
|
if (!Lower().IsUnset()) {
|
|
|
|
// Lower key is set.
|
|
|
|
clause.Append(andStr + aKeyColumnName);
|
|
|
|
clause.AppendLiteral(" >");
|
|
|
|
if (!LowerOpen()) {
|
|
|
|
clause.Append('=');
|
|
|
|
}
|
|
|
|
clause.Append(spacecolon + lowerKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Upper().IsUnset()) {
|
|
|
|
// Upper key is set.
|
|
|
|
clause.Append(andStr + aKeyColumnName);
|
|
|
|
clause.AppendLiteral(" <");
|
|
|
|
if (!UpperOpen()) {
|
|
|
|
clause.Append('=');
|
|
|
|
}
|
|
|
|
clause.Append(spacecolon + NS_LITERAL_CSTRING("upper_key"));
|
|
|
|
}
|
|
|
|
|
|
|
|
_retval = clause;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
IDBKeyRange::BindToStatement(mozIStorageStatement* aStatement) const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aStatement);
|
|
|
|
|
|
|
|
NS_NAMED_LITERAL_CSTRING(lowerKey, "lower_key");
|
|
|
|
|
|
|
|
if (IsOnly()) {
|
|
|
|
return Lower().BindToStatement(aStatement, lowerKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
if (!Lower().IsUnset()) {
|
|
|
|
rv = Lower().BindToStatement(aStatement, lowerKey);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Upper().IsUnset()) {
|
|
|
|
rv = Upper().BindToStatement(aStatement, NS_LITERAL_CSTRING("upper_key"));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-08-02 05:29:05 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(IDBKeyRange)
|
2013-08-02 11:09:15 +04:00
|
|
|
|
2011-11-03 19:57:30 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(IDBKeyRange)
|
2013-09-28 15:25:46 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGlobal)
|
2011-11-03 19:57:30 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(IDBKeyRange)
|
2012-06-11 03:44:50 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK(mCachedLowerVal)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK(mCachedUpperVal)
|
2011-11-03 19:57:30 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(IDBKeyRange)
|
2013-09-28 15:25:46 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mGlobal)
|
2012-11-28 05:37:57 +04:00
|
|
|
tmp->DropJSObjects();
|
2011-11-03 19:57:30 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
2010-06-23 23:46:08 +04:00
|
|
|
|
2011-11-03 19:57:30 +04:00
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IDBKeyRange)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
2010-06-23 23:46:08 +04:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
2011-11-03 19:57:30 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(IDBKeyRange)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(IDBKeyRange)
|
|
|
|
|
2012-11-28 05:37:57 +04:00
|
|
|
void
|
|
|
|
IDBKeyRange::DropJSObjects()
|
2012-03-28 18:40:52 +04:00
|
|
|
{
|
2012-11-28 05:37:57 +04:00
|
|
|
if (!mRooted) {
|
|
|
|
return;
|
2012-03-28 18:40:52 +04:00
|
|
|
}
|
2014-09-27 03:21:57 +04:00
|
|
|
mCachedLowerVal.setUndefined();
|
|
|
|
mCachedUpperVal.setUndefined();
|
2012-11-28 05:37:57 +04:00
|
|
|
mHaveCachedLowerVal = false;
|
|
|
|
mHaveCachedUpperVal = false;
|
|
|
|
mRooted = false;
|
2013-08-17 00:10:17 +04:00
|
|
|
mozilla::DropJSObjects(this);
|
2012-11-28 05:37:57 +04:00
|
|
|
}
|
|
|
|
|
2015-01-09 00:56:42 +03:00
|
|
|
bool
|
|
|
|
IDBKeyRange::WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector)
|
2013-09-28 15:25:46 +04:00
|
|
|
{
|
2015-01-09 00:56:42 +03:00
|
|
|
return IDBKeyRangeBinding::Wrap(aCx, this, aReflector);
|
2013-09-28 15:25:46 +04:00
|
|
|
}
|
|
|
|
|
2014-06-12 00:26:52 +04:00
|
|
|
void
|
|
|
|
IDBKeyRange::GetLower(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
|
|
|
|
ErrorResult& aRv)
|
2010-06-23 23:46:08 +04:00
|
|
|
{
|
2014-09-27 03:21:57 +04:00
|
|
|
AssertIsOnOwningThread();
|
2010-06-23 23:46:08 +04:00
|
|
|
|
2011-11-03 19:57:30 +04:00
|
|
|
if (!mHaveCachedLowerVal) {
|
|
|
|
if (!mRooted) {
|
2013-08-17 00:10:17 +04:00
|
|
|
mozilla::HoldJSObjects(this);
|
2011-11-03 19:57:30 +04:00
|
|
|
mRooted = true;
|
|
|
|
}
|
|
|
|
|
2013-09-28 15:25:46 +04:00
|
|
|
aRv = Lower().ToJSVal(aCx, mCachedLowerVal);
|
|
|
|
if (aRv.Failed()) {
|
2014-06-12 00:26:52 +04:00
|
|
|
return;
|
2013-09-28 15:25:46 +04:00
|
|
|
}
|
2011-11-03 19:57:30 +04:00
|
|
|
|
|
|
|
mHaveCachedLowerVal = true;
|
|
|
|
}
|
|
|
|
|
2014-06-12 00:26:52 +04:00
|
|
|
JS::ExposeValueToActiveJS(mCachedLowerVal);
|
|
|
|
aResult.set(mCachedLowerVal);
|
2010-06-23 23:46:08 +04:00
|
|
|
}
|
|
|
|
|
2014-06-12 00:26:52 +04:00
|
|
|
void
|
|
|
|
IDBKeyRange::GetUpper(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
|
|
|
|
ErrorResult& aRv)
|
2010-06-23 23:46:08 +04:00
|
|
|
{
|
2014-09-27 03:21:57 +04:00
|
|
|
AssertIsOnOwningThread();
|
2010-06-23 23:46:08 +04:00
|
|
|
|
2011-11-03 19:57:30 +04:00
|
|
|
if (!mHaveCachedUpperVal) {
|
|
|
|
if (!mRooted) {
|
2013-08-17 00:10:17 +04:00
|
|
|
mozilla::HoldJSObjects(this);
|
2011-11-03 19:57:30 +04:00
|
|
|
mRooted = true;
|
|
|
|
}
|
|
|
|
|
2013-09-28 15:25:46 +04:00
|
|
|
aRv = Upper().ToJSVal(aCx, mCachedUpperVal);
|
|
|
|
if (aRv.Failed()) {
|
2014-06-12 00:26:52 +04:00
|
|
|
return;
|
2013-09-28 15:25:46 +04:00
|
|
|
}
|
2011-11-03 19:57:30 +04:00
|
|
|
|
|
|
|
mHaveCachedUpperVal = true;
|
|
|
|
}
|
|
|
|
|
2014-06-12 00:26:52 +04:00
|
|
|
JS::ExposeValueToActiveJS(mCachedUpperVal);
|
|
|
|
aResult.set(mCachedUpperVal);
|
2013-08-02 13:38:49 +04:00
|
|
|
}
|
|
|
|
|
2013-09-28 15:25:46 +04:00
|
|
|
// static
|
|
|
|
already_AddRefed<IDBKeyRange>
|
2014-06-16 20:52:00 +04:00
|
|
|
IDBKeyRange::Only(const GlobalObject& aGlobal,
|
2014-09-27 03:21:57 +04:00
|
|
|
JS::Handle<JS::Value> aValue,
|
|
|
|
ErrorResult& aRv)
|
2013-08-02 13:38:49 +04:00
|
|
|
{
|
2013-09-28 15:25:46 +04:00
|
|
|
nsRefPtr<IDBKeyRange> keyRange =
|
|
|
|
new IDBKeyRange(aGlobal.GetAsSupports(), false, false, true);
|
|
|
|
|
2014-06-16 20:52:00 +04:00
|
|
|
aRv = GetKeyFromJSVal(aGlobal.Context(), aValue, keyRange->Lower());
|
2013-09-28 15:25:46 +04:00
|
|
|
if (aRv.Failed()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return keyRange.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
already_AddRefed<IDBKeyRange>
|
2014-06-16 20:52:00 +04:00
|
|
|
IDBKeyRange::LowerBound(const GlobalObject& aGlobal,
|
2014-09-27 03:21:57 +04:00
|
|
|
JS::Handle<JS::Value> aValue,
|
|
|
|
bool aOpen,
|
2013-11-11 12:04:41 +04:00
|
|
|
ErrorResult& aRv)
|
2013-09-28 15:25:46 +04:00
|
|
|
{
|
|
|
|
nsRefPtr<IDBKeyRange> keyRange =
|
|
|
|
new IDBKeyRange(aGlobal.GetAsSupports(), aOpen, true, false);
|
|
|
|
|
2014-06-16 20:52:00 +04:00
|
|
|
aRv = GetKeyFromJSVal(aGlobal.Context(), aValue, keyRange->Lower());
|
2013-09-28 15:25:46 +04:00
|
|
|
if (aRv.Failed()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return keyRange.forget();
|
2013-08-02 13:38:49 +04:00
|
|
|
}
|
|
|
|
|
2013-09-28 15:25:46 +04:00
|
|
|
// static
|
|
|
|
already_AddRefed<IDBKeyRange>
|
2014-06-16 20:52:00 +04:00
|
|
|
IDBKeyRange::UpperBound(const GlobalObject& aGlobal,
|
2014-09-27 03:21:57 +04:00
|
|
|
JS::Handle<JS::Value> aValue,
|
|
|
|
bool aOpen,
|
2013-11-11 12:04:41 +04:00
|
|
|
ErrorResult& aRv)
|
2013-09-28 15:25:46 +04:00
|
|
|
{
|
|
|
|
nsRefPtr<IDBKeyRange> keyRange =
|
|
|
|
new IDBKeyRange(aGlobal.GetAsSupports(), true, aOpen, false);
|
2013-08-02 13:38:49 +04:00
|
|
|
|
2014-06-16 20:52:00 +04:00
|
|
|
aRv = GetKeyFromJSVal(aGlobal.Context(), aValue, keyRange->Upper());
|
2013-09-28 15:25:46 +04:00
|
|
|
if (aRv.Failed()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return keyRange.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
already_AddRefed<IDBKeyRange>
|
2014-06-16 20:52:00 +04:00
|
|
|
IDBKeyRange::Bound(const GlobalObject& aGlobal,
|
2014-09-27 03:21:57 +04:00
|
|
|
JS::Handle<JS::Value> aLower,
|
|
|
|
JS::Handle<JS::Value> aUpper,
|
|
|
|
bool aLowerOpen,
|
|
|
|
bool aUpperOpen,
|
|
|
|
ErrorResult& aRv)
|
2013-08-02 13:38:49 +04:00
|
|
|
{
|
2013-09-28 15:25:46 +04:00
|
|
|
nsRefPtr<IDBKeyRange> keyRange =
|
|
|
|
new IDBKeyRange(aGlobal.GetAsSupports(), aLowerOpen, aUpperOpen, false);
|
|
|
|
|
2014-06-16 20:52:00 +04:00
|
|
|
aRv = GetKeyFromJSVal(aGlobal.Context(), aLower, keyRange->Lower());
|
2013-09-28 15:25:46 +04:00
|
|
|
if (aRv.Failed()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2014-06-16 20:52:00 +04:00
|
|
|
aRv = GetKeyFromJSVal(aGlobal.Context(), aUpper, keyRange->Upper());
|
2013-09-28 15:25:46 +04:00
|
|
|
if (aRv.Failed()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (keyRange->Lower() > keyRange->Upper() ||
|
|
|
|
(keyRange->Lower() == keyRange->Upper() && (aLowerOpen || aUpperOpen))) {
|
|
|
|
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_DATA_ERR);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return keyRange.forget();
|
2010-06-23 23:46:08 +04:00
|
|
|
}
|
2012-06-01 21:21:12 +04:00
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
} // namespace indexedDB
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|