diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-05-25 16:01:39 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-05-25 22:15:29 +0200 |
commit | 607a4e2da599b2c704718a51a0ff6efd410f13e7 (patch) | |
tree | 4e83d8deb99e83de9d8c05f230dc4ebf08ca5a62 /dom | |
parent | 8c159f3d42b374c50476832bf84438e8ae56db4e (diff) | |
download | UXP-607a4e2da599b2c704718a51a0ff6efd410f13e7.tar UXP-607a4e2da599b2c704718a51a0ff6efd410f13e7.tar.gz UXP-607a4e2da599b2c704718a51a0ff6efd410f13e7.tar.lz UXP-607a4e2da599b2c704718a51a0ff6efd410f13e7.tar.xz UXP-607a4e2da599b2c704718a51a0ff6efd410f13e7.zip |
[IndexedDB] Call SendFailureResult if the actor has been destroyed.
Normally we wouldn't need to send any notifications if the actor was
already destroyed, but it can be a VersionChangeOp which needs to
notify its parent operation (OpenDatabaseOp) about the failure.
So SendFailureResult needs to be called even when the actor was
destroyed. Normal operations redundantly check if the actor was
destroyed in SendSuccessResult and SendFailureResult, therefore it's
ok to call it in all cases here.
Diffstat (limited to 'dom')
-rw-r--r-- | dom/indexedDB/ActorsParent.cpp | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 38621cee3..cd998c31c 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -23717,32 +23717,38 @@ TransactionDatabaseOperationBase::SendPreprocessInfoOrResults( MOZ_ASSERT(mTransaction); if (NS_WARN_IF(IsActorDestroyed())) { - // Don't send any notifications if the actor was destroyed already. + // Normally we wouldn't need to send any notifications if the actor was + // already destroyed, but this can be a VersionChangeOp which needs to + // notify its parent operation (OpenDatabaseOp) about the failure. + // So SendFailureResult needs to be called even when the actor was + // destroyed. Normal operations redundantly check if the actor was + // destroyed in SendSuccessResult and SendFailureResult, therefore it's + // ok to call it in all cases here. if (NS_SUCCEEDED(mResultCode)) { IDB_REPORT_INTERNAL_ERR(); mResultCode = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR; } - } else { - if (mTransaction->IsInvalidated() || mTransaction->IsAborted()) { - // Aborted transactions always see their requests fail with ABORT_ERR, - // even if the request succeeded or failed with another error. - mResultCode = NS_ERROR_DOM_INDEXEDDB_ABORT_ERR; - } else if (NS_SUCCEEDED(mResultCode)) { - if (aSendPreprocessInfo) { - // This should not release the IPDL reference. - mResultCode = SendPreprocessInfo(); - } else { - // This may release the IPDL reference. - mResultCode = SendSuccessResult(); - } + } else if (mTransaction->IsInvalidated() || mTransaction->IsAborted()) { + // Aborted transactions always see their requests fail with ABORT_ERR, + // even if the request succeeded or failed with another error. + mResultCode = NS_ERROR_DOM_INDEXEDDB_ABORT_ERR; + } + + if (NS_SUCCEEDED(mResultCode)) { + if (aSendPreprocessInfo) { + // This should not release the IPDL reference. + mResultCode = SendPreprocessInfo(); + } else { + // This may release the IPDL reference. + mResultCode = SendSuccessResult(); } + } - if (NS_FAILED(mResultCode)) { - // This should definitely release the IPDL reference. - if (!SendFailureResult(mResultCode)) { - // Abort the transaction. - mTransaction->Abort(mResultCode, /* aForce */ false); - } + if (NS_FAILED(mResultCode)) { + // This should definitely release the IPDL reference. + if (!SendFailureResult(mResultCode)) { + // Abort the transaction. + mTransaction->Abort(mResultCode, /* aForce */ false); } } |