зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1260441 - Never pass a null js context to OpenCursor() r=bz
MozReview-Commit-ID: 2Scs80wX411 --HG-- extra : rebase_source : 0d8d74a756a1b059fe0b516de292b0226740def7
This commit is contained in:
Родитель
7b5cb65169
Коммит
09d61ae31a
|
@ -27,6 +27,7 @@
|
|||
#include "mozilla/dom/IDBTransaction.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/unused.h"
|
||||
|
||||
#include "mozIApplication.h"
|
||||
|
@ -410,7 +411,9 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
mRequest = store->OpenCursor(IDBCursorDirection::Prev, error);
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
mRequest = store->OpenCursor(jsapi.cx(), IDBCursorDirection::Prev, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2088,7 +2088,7 @@ IDBObjectStore::OpenCursorInternal(bool aKeysOnly,
|
|||
ErrorResult& aRv)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT_IF(!aCx, aRange.isUndefined());
|
||||
MOZ_ASSERT(aCx);
|
||||
|
||||
if (mDeletedSpec) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
|
|
|
@ -262,12 +262,13 @@ public:
|
|||
}
|
||||
|
||||
already_AddRefed<IDBRequest>
|
||||
OpenCursor(IDBCursorDirection aDirection,
|
||||
OpenCursor(JSContext* aCx,
|
||||
IDBCursorDirection aDirection,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
return OpenCursorInternal(/* aKeysOnly */ false, nullptr,
|
||||
return OpenCursorInternal(/* aKeysOnly */ false, aCx,
|
||||
JS::UndefinedHandleValue, aDirection, aRv);
|
||||
}
|
||||
|
||||
|
@ -347,8 +348,6 @@ 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,
|
||||
|
|
|
@ -116,6 +116,7 @@ IDBRequest::Create(JSContext* aCx,
|
|||
IDBDatabase* aDatabase,
|
||||
IDBTransaction* aTransaction)
|
||||
{
|
||||
MOZ_ASSERT(aCx);
|
||||
MOZ_ASSERT(aDatabase);
|
||||
aDatabase->AssertIsOnOwningThread();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче