Bug 1725572 - Wait for parent ack when discarding BC from child, r=kmag

I am not confident that this will fix the underlying issue causing this crash,
but given how small of a change it is, I figure it's worth trying to land
quickly to see if the crash rate drops with it.

Differential Revision: https://phabricator.services.mozilla.com/D124503
This commit is contained in:
Nika Layzell
2021-09-03 22:21:49 +00:00
parent 11f4e4f4fb
commit 02a67629af

View File

@@ -859,7 +859,10 @@ void BrowsingContext::Detach(bool aFromIPC) {
}
});
} else if (!aFromIPC) {
auto callback = [](auto) {};
// Hold a strong reference to ourself until the responses come back to
// ensure the BrowsingContext isn't cleaned up before the parent process
// acknowledges the discard request.
auto callback = [self = RefPtr{this}](auto) {};
ContentChild::GetSingleton()->SendDiscardBrowsingContext(this, callback,
callback);
}