Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 995d069

Browse files
committed
Bug 1565263 - Use Target.shouldCloseClient as only flag to check if a Target should close its Client. r=jdescottes
This will later allow dynamically change this value for local tabs, during Fission processes switches. Differential Revision: https://phabricator.services.mozilla.com/D48070 --HG-- extra : moz-landing-system : lando
1 parent cea60bb commit 995d069

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

devtools/shared/fronts/targets/target-mixin.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ function TargetMixin(parentClass) {
4646
this.activeConsole = null;
4747
this.threadFront = null;
4848

49+
// By default, we close the DebuggerClient of local tabs which
50+
// are instanciated from TargetFactory module.
51+
// This flag will also be set on local targets opened from about:debugging,
52+
// for which a dedicated DebuggerClient is also created.
53+
this.shouldCloseClient = this.isLocalTab;
54+
4955
this._client = client;
5056

5157
// Cache of already created targed-scoped fronts
@@ -453,16 +459,12 @@ function TargetMixin(parentClass) {
453459

454460
this.threadFront = null;
455461

456-
if (this.isLocalTab || this.shouldCloseClient) {
457-
// Local tab targets are typically instantiated from TargetFactory.
458-
// And we ought to destroy their client at some point. We do it from here.
459-
// There is also the clients created by about:debugging toolboxes opened
460-
// for local Firefox's targets, which sets the `shouldCloseClient` attribute.
461-
// Ignore any errors while closing, since there is not much that can be done
462-
// at this point.
462+
if (this.shouldCloseClient) {
463463
try {
464464
await this._client.close();
465465
} catch (e) {
466+
// Ignore any errors while closing, since there is not much that can be done
467+
// at this point.
466468
console.warn(`Error while closing client: ${e.message}`);
467469
}
468470

0 commit comments

Comments
 (0)