mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1257422 part 1. Add a way to do IDBObjectStore::OpenCursor without a JSContext if we are not passing a keyrange. r=khuey
This commit is contained in:
parent
60d3ad7ce0
commit
547ab7b66c
@ -410,9 +410,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
mRequest = store->OpenCursor(cx, JS::UndefinedHandleValue,
|
||||
IDBCursorDirection::Prev, error);
|
||||
mRequest = store->OpenCursor(IDBCursorDirection::Prev, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
@ -99,6 +99,8 @@ IDBKeyRange::FromJSVal(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aVal,
|
||||
IDBKeyRange** aKeyRange)
|
||||
{
|
||||
MOZ_ASSERT_IF(!aCx, aVal.isUndefined());
|
||||
|
||||
RefPtr<IDBKeyRange> keyRange;
|
||||
|
||||
if (aVal.isNullOrUndefined()) {
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(IDBKeyRange)
|
||||
|
||||
// aCx is allowed to be null, but only if aVal.isUndefined().
|
||||
static nsresult
|
||||
FromJSVal(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aVal,
|
||||
|
@ -2089,6 +2089,7 @@ IDBObjectStore::OpenCursorInternal(bool aKeysOnly,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT_IF(!aCx, aRange.isUndefined());
|
||||
|
||||
if (mDeletedSpec) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
|
@ -261,6 +261,16 @@ public:
|
||||
aRv);
|
||||
}
|
||||
|
||||
already_AddRefed<IDBRequest>
|
||||
OpenCursor(IDBCursorDirection aDirection,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
return OpenCursorInternal(/* aKeysOnly */ false, nullptr,
|
||||
JS::UndefinedHandleValue, aDirection, aRv);
|
||||
}
|
||||
|
||||
already_AddRefed<IDBRequest>
|
||||
OpenKeyCursor(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aRange,
|
||||
@ -337,6 +347,8 @@ private:
|
||||
const IDBIndexParameters& aOptionalParameters,
|
||||
ErrorResult& aRv);
|
||||
|
||||
// aCx is allowed to be null but only if aRange.isUndefined(). In that case,
|
||||
// we don't actually use aCx for anything, so it's OK.
|
||||
already_AddRefed<IDBRequest>
|
||||
OpenCursorInternal(bool aKeysOnly,
|
||||
JSContext* aCx,
|
||||
|
Loading…
Reference in New Issue
Block a user