Closed Bug 1569690 Opened 5 years ago Closed 5 years ago

Target should be used to fetch any other target scoped front

Categories

(DevTools :: Debugger, enhancement, P1)

enhancement

Tracking

(firefox70 fixed)

RESOLVED FIXED
Firefox 70
Tracking Status
firefox70 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

(Blocks 1 open bug)

Details

(Whiteboard: dt-fission-m1)

Attachments

(1 file)

For now, a Map of thread actor ID is being maintainted over here:

        newWorkerClients[workerThread.actor] = {
          url: workerTargetFront.url,
          thread: workerThread,
          console: consoleFront,
        };

This clearly replicates the Target fronts and its TargetMixin class. Targets expose url and the getFront method to access any other target scoped front like console, thread, but also the inspector and all other similar fronts.

The current doesn't scale, especially when this pattern escape from the debugger into the console.

By using the thread actor ID as a key in the console:
https://searchfox.org/mozilla-central/rev/1eb05019f47069172ba81a6c108a584a409a24ea/devtools/client/webconsole/webconsole-wrapper.js#171-184

         const state = this.hud.getDebuggerFrames();

         const grip = state.frames[state.selected];

         return {
            frameActor: grip.actor,
            client: this.hud.lookupConsoleClient(grip.thread),
         };

It forces us to have to call some function of the debugger, lookupConsoleClient in order to derivate the console front out of the thread actor ID.

Instead, if the debugger would have passed the target front out of DebuggerPanel.getFrames, we would have more naturally retrieved the console front via target.getFront("console").
The same actually applies to the internals of the debugger. The whole newWorkerClients map could actually be a map of targets.

Assignee: nobody → poirot.alex
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ec73bc656bd3
Use target instead of thread as greatest common divisor. r=loganfsmyth,nchevobbe
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/020e8aad58a8
Use target instead of thread as greatest common divisor. r=loganfsmyth,nchevobbe
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 70
Flags: needinfo?(poirot.alex)
Priority: -- → P1
Whiteboard: dt-fission
Whiteboard: dt-fission → dt-fission dt-fission-m1
Whiteboard: dt-fission dt-fission-m1 → dt-fission-m1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: