Bug 1563299 - Update the mAbortCode if the IDBTransaction has been aborted yet to correct the IDB_LOG; r=asuth

IDBTransaction generates IDB_LOG base on the mAbortCode, but it fires event
according to the argument "aResult" of FireCompleteOrAbortEvents(). It's
possible to have a situation that IDBTransaction hasn't been aborted yet, but
the transaction on the parent process is aborted and propagate the reason to
IDBTransaction. In this case, IDBTransaction would still fire an abort event as
expected. However, the IDB_LOG would show that it fired a complete event.

Therefore, this patch corrects the behavior and adds an assertion to ensure it's
only possible that parent process tells child process to abort at the last
minate rather than the case of parent is canceling the abort.

Differential Revision: https://phabricator.services.mozilla.com/D36900

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Tung 2019-07-26 13:29:04 +00:00
Родитель f33a502eb3
Коммит f3eb98601f
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -741,6 +741,10 @@ void IDBTransaction::FireCompleteOrAbortEvents(nsresult aResult) {
event = CreateGenericEvent(this, nsDependentString(kCompleteEventType),
eDoesNotBubble, eNotCancelable);
MOZ_ASSERT(event);
// If we hit this assertion, it probably means transaction object on the
// parent process doesn't propagate error properly.
MOZ_ASSERT(NS_SUCCEEDED(mAbortCode));
} else {
if (aResult == NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR) {
mDatabase->SetQuotaExceeded();
@ -753,6 +757,10 @@ void IDBTransaction::FireCompleteOrAbortEvents(nsresult aResult) {
event = CreateGenericEvent(this, nsDependentString(kAbortEventType),
eDoesBubble, eNotCancelable);
MOZ_ASSERT(event);
if (NS_SUCCEEDED(mAbortCode)) {
mAbortCode = aResult;
}
}
if (NS_SUCCEEDED(mAbortCode)) {