Use descriptors instead of current top level target to create Toolbox and TargetList
Categories
(DevTools :: Framework, enhancement)
Tracking
(firefox87 fixed)
Tracking | Status | |
---|---|---|
firefox87 | --- | fixed |
People
(Reporter: ochameau, Assigned: ochameau)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
For legacy reasons, we still create the Toolbox and TargetList out of a Target Front.
But this is imperfect for many reasons:
- lifecycle: the target lyfecycle is shorter than the toolbox and target list. So that the toolbox isn't really debugging this particular target, but the context hosting this one target. This principle changed because of target switching. Since the day we support running the same tab in two distinct processes, we introduced the fact that a given toolbox may have to switch to a new top level target.
- class hierarchy: the descriptor is the parent of the target. We have to access the descriptor at least from the TargetList in order to retrieve the watcher front. For now, we retrieve it from the target, via target.descriptorFront. But it would be better if we were instead receiving the descriptor and then out of it, we fetch its children classes, the current target.
- key distributor of key interfaces. We are using many different key object to fetch important interfaces: toolbox, target, descriptor, targetList, resourceWatcher, client... It would be nice to have some structure/hierarchy and ease retrieve all what we need from one generic object. Bug 1691681 will help, but won't be enough.
Toolbox isn't a good placeholder as we don't always have access to it. For example the browser console.
The target isn't good as it isn't stable overtime and changes on target switching.
ResourceWatcher requires a TargetList, so better use the TargetList.
TargetList needs a target today, but rather a descriptor. So it might be better using the descriptor to expose:
- the current top level target
- the target list
- the resource watcher
- commands
And it would probably be even better, if in bug 1691681 we keep descriptor being used only in bootstrap code of the toolbox, and let all the frontend solely use Commands.
Assignee | ||
Comment 1•4 years ago
|
||
Assignee | ||
Comment 2•4 years ago
|
||
There is still some usages in isTargetSupported,
but that would requires refactoring this method into isDescriptorSupported
and be async as some isTargetSupported only works against target as it checks for traits on it.
Updated•4 years ago
|
Assignee | ||
Comment 3•4 years ago
|
||
Green try:
https://treeherder.mozilla.org/jobs?repo=try&revision=d60aa4500ea77cefbff892adcc9ccd24c74804f6
Assignee | ||
Comment 4•4 years ago
|
||
Assignee | ||
Comment 5•4 years ago
|
||
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1c61adb7d76a [devtools] Use descriptors instead of targets in TargetList/Toolbox r=jdescottes https://hg.mozilla.org/integration/autoland/rev/c64b9fa49625 [devtools] Read isLocalTab from descriptor instead of target front. r=rpl,jdescottes
Comment 7•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/1c61adb7d76a
https://hg.mozilla.org/mozilla-central/rev/c64b9fa49625
Description
•