mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1149815 - Guard against using deleted IDBObjectStore and IDBIndex objects, r=janv.
This commit is contained in:
parent
d1ad3d2695
commit
be1e03fc98
@ -13060,12 +13060,12 @@ TransactionBase::GetMetadataForObjectStoreId(int64_t aObjectStoreId) const
|
||||
|
||||
nsRefPtr<FullObjectStoreMetadata> metadata;
|
||||
if (!mDatabase->Metadata()->mObjectStores.Get(aObjectStoreId,
|
||||
getter_AddRefs(metadata))) {
|
||||
getter_AddRefs(metadata)) ||
|
||||
metadata->mDeleted) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(metadata->mCommonMetadata.id() == aObjectStoreId);
|
||||
MOZ_ASSERT(!metadata->mDeleted);
|
||||
|
||||
return metadata.forget();
|
||||
}
|
||||
@ -13083,12 +13083,12 @@ TransactionBase::GetMetadataForIndexId(
|
||||
}
|
||||
|
||||
nsRefPtr<FullIndexMetadata> metadata;
|
||||
if (!aObjectStoreMetadata->mIndexes.Get(aIndexId, getter_AddRefs(metadata))) {
|
||||
if (!aObjectStoreMetadata->mIndexes.Get(aIndexId, getter_AddRefs(metadata)) ||
|
||||
metadata->mDeleted) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(metadata->mCommonMetadata.id() == aIndexId);
|
||||
MOZ_ASSERT(!metadata->mDeleted);
|
||||
|
||||
return metadata.forget();
|
||||
}
|
||||
|
@ -223,6 +223,11 @@ IDBIndex::GetInternal(bool aKeyOnly,
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (mDeletedMetadata) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IDBTransaction* transaction = mObjectStore->Transaction();
|
||||
if (!transaction->IsOpen()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
@ -306,6 +311,11 @@ IDBIndex::GetAllInternal(bool aKeysOnly,
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (mDeletedMetadata) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IDBTransaction* transaction = mObjectStore->Transaction();
|
||||
if (!transaction->IsOpen()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
@ -387,6 +397,11 @@ IDBIndex::OpenCursorInternal(bool aKeysOnly,
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (mDeletedMetadata) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IDBTransaction* transaction = mObjectStore->Transaction();
|
||||
if (!transaction->IsOpen()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
@ -483,6 +498,11 @@ IDBIndex::Count(JSContext* aCx,
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (mDeletedMetadata) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IDBTransaction* transaction = mObjectStore->Transaction();
|
||||
if (!transaction->IsOpen()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
|
@ -1160,6 +1160,11 @@ IDBObjectStore::AddOrPut(JSContext* aCx,
|
||||
MOZ_ASSERT(aCx);
|
||||
MOZ_ASSERT_IF(aFromCursor, aOverwrite);
|
||||
|
||||
if (mDeletedSpec) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mTransaction->IsOpen()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
return nullptr;
|
||||
@ -1314,6 +1319,11 @@ IDBObjectStore::GetAllInternal(bool aKeysOnly,
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (mDeletedSpec) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mTransaction->IsOpen()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
return nullptr;
|
||||
@ -1386,6 +1396,11 @@ IDBObjectStore::Clear(ErrorResult& aRv)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (mDeletedSpec) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mTransaction->IsOpen()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
return nullptr;
|
||||
@ -1572,6 +1587,11 @@ IDBObjectStore::Get(JSContext* aCx,
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (mDeletedSpec) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mTransaction->IsOpen()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
return nullptr;
|
||||
@ -1620,6 +1640,11 @@ IDBObjectStore::DeleteInternal(JSContext* aCx,
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (mDeletedSpec) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mTransaction->IsOpen()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
return nullptr;
|
||||
@ -1717,7 +1742,8 @@ IDBObjectStore::CreateIndexInternal(
|
||||
|
||||
if (!transaction ||
|
||||
transaction != mTransaction ||
|
||||
mTransaction->GetMode() != IDBTransaction::VERSION_CHANGE) {
|
||||
mTransaction->GetMode() != IDBTransaction::VERSION_CHANGE ||
|
||||
mDeletedSpec) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
@ -1797,7 +1823,8 @@ IDBObjectStore::DeleteIndex(const nsAString& aName, ErrorResult& aRv)
|
||||
|
||||
if (!transaction ||
|
||||
transaction != mTransaction ||
|
||||
mTransaction->GetMode() != IDBTransaction::VERSION_CHANGE) {
|
||||
mTransaction->GetMode() != IDBTransaction::VERSION_CHANGE ||
|
||||
mDeletedSpec) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return;
|
||||
}
|
||||
@ -1866,6 +1893,13 @@ IDBObjectStore::Count(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aKey,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (mDeletedSpec) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mTransaction->IsOpen()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
return nullptr;
|
||||
@ -1916,6 +1950,11 @@ IDBObjectStore::OpenCursorInternal(bool aKeysOnly,
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (mDeletedSpec) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mTransaction->IsOpen()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
return nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user