Bug 1669681 - [devtools] Ignore detach errors when purging Front requests r=ochameau

Depends on D92756

Detach errors can happen when a target is being destroyed.
Historically, those errors were swallowed in the TargetFront mixin.
However this logic became outdated when we started purging requests during Front::destroy.

This results in non-actionable error messages logged frequently while using DevTools.
This changeset updates the logic in target-mixin.js in order to swallow errors due to purged requests.

Differential Revision: https://phabricator.services.mozilla.com/D92757
This commit is contained in:
Julian Descottes 2020-10-12 08:12:53 +00:00
Родитель d4c1319148
Коммит 4d7f2e708f
1 изменённых файлов: 8 добавлений и 7 удалений

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

@ -253,6 +253,14 @@ function connectToFrame(connection, frame, onDestroy, { addonId } = {}) {
// in case content wasn't able to destroy them via a message
spawnInParentActorPool.destroy();
if (actor) {
// The FrameTargetActor within the child process doesn't necessary
// have time to uninitialize itself when the frame is closed/killed.
// So ensure telling the client that the related actor is detached.
connection.send({ from: actor.actor, type: "tabDetached" });
actor = null;
}
if (childTransport) {
// If we have a child transport, the actor has already
// been created. We need to stop using this message manager.
@ -274,13 +282,6 @@ function connectToFrame(connection, frame, onDestroy, { addonId } = {}) {
// the actor.
resolve(null);
}
if (actor) {
// The FrameTargetActor within the child process doesn't necessary
// have time to uninitialize itself when the frame is closed/killed.
// So ensure telling the client that the related actor is detached.
connection.send({ from: actor.actor, type: "tabDetached" });
actor = null;
}
if (onDestroy) {
onDestroy(mm);