зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1176165 - Fix the exception codes returned from functions that modify the IndexedDB schema, r=janv.
This commit is contained in:
Родитель
e31f422aa2
Коммит
6c1e8969cd
|
@ -520,7 +520,6 @@ IDBDatabase::CreateObjectStore(
|
|||
AssertIsOnOwningThread();
|
||||
|
||||
IDBTransaction* transaction = IDBTransaction::GetCurrent();
|
||||
|
||||
if (!transaction ||
|
||||
transaction->Database() != this ||
|
||||
transaction->GetMode() != IDBTransaction::VERSION_CHANGE) {
|
||||
|
@ -528,7 +527,10 @@ IDBDatabase::CreateObjectStore(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(transaction->IsOpen());
|
||||
if (!transaction->IsOpen()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
KeyPath keyPath(0);
|
||||
if (NS_FAILED(KeyPath::Parse(aOptionalParameters.mKeyPath, &keyPath))) {
|
||||
|
@ -596,7 +598,6 @@ IDBDatabase::DeleteObjectStore(const nsAString& aName, ErrorResult& aRv)
|
|||
AssertIsOnOwningThread();
|
||||
|
||||
IDBTransaction* transaction = IDBTransaction::GetCurrent();
|
||||
|
||||
if (!transaction ||
|
||||
transaction->Database() != this ||
|
||||
transaction->GetMode() != IDBTransaction::VERSION_CHANGE) {
|
||||
|
@ -604,7 +605,10 @@ IDBDatabase::DeleteObjectStore(const nsAString& aName, ErrorResult& aRv)
|
|||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(transaction->IsOpen());
|
||||
if (!transaction->IsOpen()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
nsTArray<ObjectStoreSpec>& specArray = mSpec->objectStores();
|
||||
|
||||
|
|
|
@ -1738,16 +1738,18 @@ IDBObjectStore::CreateIndexInternal(
|
|||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
IDBTransaction* transaction = IDBTransaction::GetCurrent();
|
||||
|
||||
if (!transaction ||
|
||||
transaction != mTransaction ||
|
||||
mTransaction->GetMode() != IDBTransaction::VERSION_CHANGE ||
|
||||
if (mTransaction->GetMode() != IDBTransaction::VERSION_CHANGE ||
|
||||
mDeletedSpec) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IDBTransaction* transaction = IDBTransaction::GetCurrent();
|
||||
if (!transaction || transaction != mTransaction) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(transaction->IsOpen());
|
||||
|
||||
auto& indexes = const_cast<nsTArray<IndexMetadata>&>(mSpec->indexes());
|
||||
|
@ -1819,16 +1821,18 @@ IDBObjectStore::DeleteIndex(const nsAString& aName, ErrorResult& aRv)
|
|||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
IDBTransaction* transaction = IDBTransaction::GetCurrent();
|
||||
|
||||
if (!transaction ||
|
||||
transaction != mTransaction ||
|
||||
mTransaction->GetMode() != IDBTransaction::VERSION_CHANGE ||
|
||||
if (mTransaction->GetMode() != IDBTransaction::VERSION_CHANGE ||
|
||||
mDeletedSpec) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
IDBTransaction* transaction = IDBTransaction::GetCurrent();
|
||||
if (!transaction || transaction != mTransaction) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(transaction->IsOpen());
|
||||
|
||||
auto& metadataArray = const_cast<nsTArray<IndexMetadata>&>(mSpec->indexes());
|
||||
|
|
Загрузка…
Ссылка в новой задаче