Closed Bug 1603170 Opened 4 years ago Closed 4 years ago

Make the accessibility support target switching

Categories

(DevTools :: Accessibility Tools, enhancement, P1)

enhancement

Tracking

(Fission Milestone:M6, firefox76 fixed)

RESOLVED FIXED
Firefox 76
Fission Milestone M6
Tracking Status
firefox76 --- fixed

People

(Reporter: ochameau, Assigned: daisuke)

References

Details

(Whiteboard: dt-fission-m2-mvp)

Attachments

(2 files, 1 obsolete file)

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.

We may want to wait for bug 1599806 completion as it would require modifying the same code.

Depends on: 1599806
  1. We would want to use targetList.watchTargets in order to listen to all top level target's navigate event:
    https://searchfox.org/mozilla-central/rev/62a130ba0ac80f75175e4b65536290b52391f116/devtools/client/accessibility/panel.js#74
    The toolbox is doing something similar over here:
    https://searchfox.org/mozilla-central/rev/62a130ba0ac80f75175e4b65536290b52391f116/devtools/client/framework/toolbox.js#617-626

  2. Similarly, we would also need to register these RDP event listeners on each target front:
    https://searchfox.org/mozilla-central/rev/62a130ba0ac80f75175e4b65536290b52391f116/devtools/client/accessibility/panel.js#96-100
    Unfortunately, there is a couple of other places where we would need to do similar work:
    https://searchfox.org/mozilla-central/rev/62a130ba0ac80f75175e4b65536290b52391f116/devtools/client/accessibility/components/Description.js#58
    https://searchfox.org/mozilla-central/rev/62a130ba0ac80f75175e4b65536290b52391f116/devtools/client/accessibility/components/MainFrame.js#63
    https://searchfox.org/mozilla-central/rev/62a130ba0ac80f75175e4b65536290b52391f116/devtools/client/accessibility/components/Toolbar.js#53
    May be we should be listening for this from the panel and communicate the ends differently to the React Components?

  3. Last but not least, we would need to also use watchTargets here:
    https://searchfox.org/mozilla-central/rev/62a130ba0ac80f75175e4b65536290b52391f116/devtools/client/accessibility/accessibility-startup.js#78-94
    So that we can do something similar to:

toolbox.targetList.watchTargets([this._toolbox.targetList.TYPES.FRAME],
    ({ type, targetFront, isTopLevel }) => {
      if (isTopLevel) 
        this._accessibility = await this.target.getFront("accessibility");
        ...
        this._accessibility.on("init", this._updateToolHighlight);
      }
  });

and support target-switching. The modification of accessibility-startup.js isn't trivial and most likely need more tweaks.
On top of that, bug 1599806 is going to shuffle things as we will have the accessiblity actor/front for the parent process, which, won't change.
Only the actor/front for the content process will change in case of navigation to another process.

Whiteboard: dt-fission-m2-mvp

Tracking dt-fission-m2 bugs for Fission Nightly (M6)

Fission Milestone: --- → M6
Priority: -- → P2
Assignee: nobody → daisuke
Status: NEW → ASSIGNED
Priority: P2 → P1

Depends on D61956

Depends on: 1619621
Attachment #9124950 - Attachment is obsolete: true
Attachment #9132513 - Attachment description: Bug 1603170: Introduce target-swithing mechanism with reusing listeners. → Bug 1603170: Introduce target-switching mechanism with reusing listeners.
Pushed by dakatsuka.birchill@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fd7c96f16e38
Introduce target-switching mechanism with reusing listeners. r=yzen,jdescottes
https://hg.mozilla.org/integration/autoland/rev/45684181e266
Add a test for target-swithing. r=jdescottes
Flags: needinfo?(daisuke)
Pushed by dakatsuka.birchill@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8e480e2795e7
Introduce target-switching mechanism with reusing listeners. r=yzen,jdescottes
https://hg.mozilla.org/integration/autoland/rev/fa79dc68ff56
Add a test for target-swithing. r=jdescottes,yzen
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 76
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: