Bug 1578243 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Bug 1565263 focuses on landing the framework modification in order to support switching to another target and will only enable this feature for the console.
But we should followup in each tool to support that.
Bug 1565263 landed the TargetList API which helps support switching to another target (as well as supporting the additional remote iframe target).
But we should followup in each tool in order to start using this new API.
The very first goal is to:
* stop memoizing the target/targetFront and may be also the target scoped front (inspector, console, thread, storage, ...). Instead we should use `toolbox.targetList.targetFront` in order to query for the current top level target front.
* support target switching by using `TargetList.watchTargets`. In a first iteration we would only care about the top level target. In order to do so, we can check for the `isTopLevel` argument being passed to the two callbacks register to `watchTargets`:
```
  this._toolbox.targetList.watchTargets([this._toolbox.targetList.TYPES.FRAME],
    (type, targetFront, isTopLevel) => {
      if (isTopLevel) {
        // A new top level target is available
        // This will be fired on toolbox opening, for the first one,
        // And then, evertime we navigate to another process.
        // For now, you would need `devtools.target-switching.enabled` to be set to true
        // And navigate from any http website to about:robots, which loads into the parent process. Or enable Fission and navigate between two distinct top level domains.
      }
    },
    (type, targetFront, isTopLevel) => {
      if (isTopLevel) {
        // A top level target has been destroyed
      }
    }
```

See bug 1565263 for how we migrated the console or bug 1578242 for the inspector.
Bug 1565263 landed the TargetList API which helps support switching to another target (as well as supporting the additional remote iframe target).
But we should followup in each tool in order to start using this new API.
The very first goal is to:
* stop memoizing the target/targetFront and may be also the target scoped front (inspector, console, thread, storage, ...). Instead we should use `toolbox.targetList.targetFront` in order to query for the current top level target front.
* support target switching by using `TargetList.watchTargets`. In a first iteration we would only care about the top level target. In order to do so, we can check for the `isTopLevel` argument being passed to the two callbacks register to `watchTargets`:
```
  this._toolbox.targetList.watchTargets([this._toolbox.targetList.TYPES.FRAME],
    ({ type, targetFront, isTopLevel }) => {
      if (isTopLevel) {
        // A new top level target is available
        // This will be fired on toolbox opening, for the first one,
        // And then, evertime we navigate to another process.
        // For now, you would need `devtools.target-switching.enabled` to be set to true
        // And navigate from any http website to about:robots, which loads into the parent process. Or enable Fission and navigate between two distinct top level domains.
      }
    },
    ({ type, targetFront, isTopLevel }) => {
      if (isTopLevel) {
        // A top level target has been destroyed
      }
    }
```

See bug 1565263 for how we migrated the console or bug 1578242 for the inspector.

Back to Bug 1578243 Comment 0