Support Network and Storage devtools panels when debugging background tasks
Categories
(DevTools :: General, enhancement)
Tracking
(Not tracked)
People
(Reporter: nalexander, Unassigned)
References
Details
In Bug 1686344, we added support for debugging background tasks. It's really useful! But it would have been helpful when investigating Bug 1793890 to have been able to see (the absence of) network requests and to investigate the IndexedDB storage of the background update task profile. This ticket tracks adding support for these panels.
For historical reasons, background tasks (following xpcshell
) use a special root actor that is essentially a "content process" actor. It's my belief that to address this ticket, we need to flesh this out -- but it seems there are many ways to opt-in to various features, actors, etc, so some guidance is needed. I expect that we can't do this for xpcshell
at the same time: it's not clear that the Network and Storage panels are sensible without an underlying profile.
Reporter | ||
Comment 1•2 years ago
|
||
jdescottes: can you provide guidance on how to do this, or redirect to an appropriate expert? Thanks!
Reporter | ||
Updated•2 years ago
|
Comment 2•2 years ago
|
||
Alex will probably have a clearer idea of what could be the next steps here.
I'm not sure if we should try to make network & storage panels work in general for content process targets, or if we need to consider background task as a new type of context (descriptor) that can be debugged from devtools. I think in terms of DevTools "target", that would still only be represented by a ProcessTargetActor, but if we have a different descriptor, then maybe we can enable additional actors.
I feel like this will be non-trivial
Comment 3•2 years ago
|
||
The first step to enable the netmonitor in the frontend is around here:
https://searchfox.org/mozilla-central/rev/dd216c1307a2bf1b0d2465b9749fa86dac44303a/devtools/client/definitions.js#327-332
It is disabled for background script because of this backend code:
https://searchfox.org/mozilla-central/rev/dd216c1307a2bf1b0d2465b9749fa86dac44303a/devtools/server/actors/targets/content-process.js#162
But after that, it is quite hairy and requires understandting "the old" and "the new" DevTools architecture.
We are still using "the old" for xpcshell/backgroundtask toolboxes, which are both content process target actors:
- "the old" is about connecting to one descriptor and debugging the context via the descriptor's target (here a ContentProcessDescriptor and a ContentProcessTargetActor).
- "the new" is about connecting to one descriptor, but then debugging the context via a dedicated watcher actor. (This would still be a ContentProcessDescriptor, but the target actor would be managed by a WatcherActor)
I think we should first try to migrate xpcshell/backgroundtask to "the new"/watcher actor.
We may be able to make things to work with "the old", by manually instantiating: NetworkMonitorActor + StackTraceCollector + NetworkMonitorContent from the ContentProcessTargetActor, but that's not trivial... Making the netmonitor work out of "the new"/watcher actor should be more straightforward.
In theory, once we support the watcher, we might not have to do much to enable NETWORK resources, they should just work thanks to this code:
https://searchfox.org/mozilla-central/rev/dd216c1307a2bf1b0d2465b9749fa86dac44303a/devtools/server/actors/watcher/session-context.js#213-214
Now migrating the ContentProcessDescriptor to support the WatcherActor isn't trivial. But it would remove a big maintenance burden as it would get rid of a legacy codepath.
It is about exposing a getWatcher method on ContentProcessDescriptor and then ensuring that:
- the Watcher Actor instantiate the ContentProcessTarget actor somehow (would probably be through devtools/server/actors/watcher/target-helpers/). We would also have to ensure it only instantiate this actor and none of the others.
- review all resource watchers (devtools/server/actors/resources/*) to be correctly scoped to the targeted content process (long and boring, but less complex)
Updated•9 months ago
|
Description
•