Closed Bug 1603174 Opened 5 years ago Closed 5 years ago

Make the application panel support target switching

Categories

(DevTools :: Application Panel, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1600263

People

(Reporter: ochameau, Unassigned)

References

Details

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.

It looks like it should be quite straightforward.
I see only two callsites which are impacted by the target-switching:

  1. navigate event listening
    https://searchfox.org/mozilla-central/rev/62a130ba0ac80f75175e4b65536290b52391f116/devtools/client/application/initializer.js#59
    We should do like the toolbox code. Use TargetList.watchTarget to listen for all the targets and for each of the top level target, listen for navigate:
    https://searchfox.org/mozilla-central/rev/62a130ba0ac80f75175e4b65536290b52391f116/devtools/client/framework/toolbox.js#740-744
    https://searchfox.org/mozilla-central/rev/62a130ba0ac80f75175e4b65536290b52391f116/devtools/client/framework/toolbox.js#617-626

  2. fetchManifest
    https://searchfox.org/mozilla-central/rev/62a130ba0ac80f75175e4b65536290b52391f116/devtools/client/application/src/modules/application-services.js#44-45
    This uses a target and so should be reviewed. But nothing is to be changed as it uses Toolbox's target getter which is dynamic and will use the right target front. We may just ensure updating the application panel from initializer everytime a new target is notified.

(might be a duplicate of Bug 1600263)

See Also: → 1600263
Whiteboard: dt-fission-m2-mvp

Hi, I'm already working on this on 1600263 (thanks Julian for the heads up!)

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
Whiteboard: dt-fission-m2-mvp
You need to log in before you can comment on or make changes to this bug.