From 1d0af8b59102331cba100529e1697f91faf0c86b Mon Sep 17 00:00:00 2001 From: Ascrod <32915892+Ascrod@users.noreply.github.com> Date: Mon, 8 Apr 2019 20:42:10 -0400 Subject: Issue #991 Part 5: DOM and layout --- dom/indexedDB/test/test_globalObjects_other.xul | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'dom/indexedDB') diff --git a/dom/indexedDB/test/test_globalObjects_other.xul b/dom/indexedDB/test/test_globalObjects_other.xul index eb180a9b4..b527d66bd 100644 --- a/dom/indexedDB/test/test_globalObjects_other.xul +++ b/dom/indexedDB/test/test_globalObjects_other.xul @@ -31,14 +31,8 @@ Cu.import("resource://gre/modules/Services.jsm"); for (var stage of [ "install", "startup", "shutdown", "uninstall" ]) { for (var symbol of [ "IDBKeyRange", "indexedDB" ]) { - let pref; - try { - pref = Services.prefs.getBoolPref("indexeddbtest.bootstrap." + stage + - "." + symbol); - } - catch(ex) { - pref = false; - } + let pref = Services.prefs.getBoolPref("indexeddbtest.bootstrap." + stage + + "." + symbol, false); ok(pref, "Symbol '" + symbol + "' present during '" + stage + "'"); } } -- cgit v1.2.3 From 9dfb9401a5d621367730ad7ebecf0387111f4618 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sat, 25 May 2019 16:01:39 +0200 Subject: [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. --- dom/indexedDB/ActorsParent.cpp | 46 ++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'dom/indexedDB') 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); } } -- cgit v1.2.3