Bug 1609797 - Ignore cursor responses after disconnecting from global. r=dom-workers-and-storage-reviewers,asuth

Differential Revision: https://phabricator.services.mozilla.com/D96171
This commit is contained in:
Simon Giesecke 2020-11-10 17:05:36 +00:00
parent 8fe0338fd0
commit acfbc6daac

View File

@ -3355,9 +3355,18 @@ void BackgroundCursorChild<CursorType>::HandleResponse(
nsTArray<ResponseType>&& aResponses) {
AssertIsOnOwningThread();
if constexpr (CursorType == IDBCursorType::ObjectStore) {
if constexpr (CursorType == IDBCursorType::ObjectStore ||
CursorType == IDBCursorType::Index) {
MOZ_ASSERT(mTransaction);
if (!mTransaction->Database()->GetOwnerGlobal()) {
// Ignore the response, since we have already been disconnected from the
// global.
return;
}
}
if constexpr (CursorType == IDBCursorType::ObjectStore) {
HandleMultipleCursorResponses(
std::move(aResponses), [this](const bool useAsCurrentResult,
ObjectStoreCursorResponse&& response) {
@ -3380,8 +3389,6 @@ void BackgroundCursorChild<CursorType>::HandleResponse(
});
}
if constexpr (CursorType == IDBCursorType::Index) {
MOZ_ASSERT(mTransaction);
HandleMultipleCursorResponses(
std::move(aResponses),
[this](const bool useAsCurrentResult, IndexCursorResponse&& response) {