Closed Bug 1687965 Opened 4 years ago Closed 3 years ago

Investigate removing shouldCloseClient logic from the target

Categories

(DevTools :: Framework, task, P3)

task

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1631451

People

(Reporter: jdescottes, Unassigned)

References

Details

The shouldCloseClient is a property of the target-front. If true, the target-front destroy will close the corresponding DebuggerClient:

      if (this.shouldCloseClient) {
        try {
          await this._client.close();
        } catch (e) {
          // Ignore any errors while closing, since there is not much that can be done
          // at this point.
          console.warn("Error while closing client:", e);
        }
        // ...
     }

https://searchfox.org/mozilla-central/rev/1ebc9745be02eebf7a694f5c527a44a045b8c97a/devtools/client/fronts/targets/target-mixin.js#619

This property is true only for:

As we can see, this property is also only relevant for top level targets. When trying to create top level targets from the WatcherActor, this property becomes complicated to handle. Typically, for a navigation/reload, we will attempt to destroy the previous top level BrowsingContextTargetFront, before the new target is created. So we risk destroying the client, because we don't realize that this is just a target-switching and we will get a new target soon.

Moving this outside of the target (maybe to the descriptor) would help. For about:debugging targets, we won't have descriptors for all targets though.

[1] remote debugging targets use the same client that was created for about:debugging, so they don't close the client when the target is closed. However they use another codepath to "close" the toolbox. See initToolbox/onTargetDestroyed in toolbox-init.js

Bug 1631451 is moving this attribute up to the descriptor front.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.