Expose the list of all nsIContentParent's to JS
Categories
(Core :: DOM: Content Processes, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox80 | --- | fixed |
People
(Reporter: ochameau, Assigned: ochameau)
References
Details
Attachments
(2 files)
DevTools currently inspects all content processes via a code similar to this:
https://searchfox.org/mozilla-central/rev/fac90408bcf52ca88a3dcd2ef30a379b68ab24e2/devtools/server/actors/descriptors/process.js#110-111
for (let i = 0; i < Services.ppmm.childCount; i++) {
const processMessageManager = Services.ppmm.getChildAt(i);
I'm currently looking forward using JSProcessActors
instead of message managers... but.
I've not found a way to iterate over all nsIContentParent
instances.
I saw that typically, you would spawn a JSProcessActor via browsingContext.currentWindowGlobal.contentParent
,
but that doesn't really allow iterating over all the ContentParents.
Nika suggested to me that we could probably expose them via sequence<nsIContentParent> getAllContentParents()
on ChromeUtils
.
Assignee | ||
Comment 1•4 years ago
|
||
Some more discussion coming from Matrix:
Gis: can we add it as a static thing on
JSProcessActor
, maybe? I mean, I knowChromeUtils
is a dumping ground as it is, but... :)
nika Sure, that'd be fine too. I suggested
ChromeUtils
just because it's already where methods likeregisterWindowActor
are, but I suppose those could be moved toJSWindowActor.registerActor(...)
andJSProcessActor.registerActor
as well.
getAllContentParents
does feel like more of aChromeUtils
method, though, as it's technically getting the native ContentParent object, rather than something explicitly tied to JSProcessActors.
Something likeJSProcessActor.getAllActors("MyActorType")
which callsgetActor
on every content process could work too.
Comment 2•4 years ago
|
||
This is a feature request from Frontend team.
Tracking for Fission Nightly M6b
Assignee | ||
Comment 3•4 years ago
|
||
Updated•4 years ago
|
Assignee | ||
Comment 4•4 years ago
|
||
Assignee | ||
Comment 5•4 years ago
|
||
I went for ChromeUtils.getAllContentParents()
as it better matches current DevTools needs over here:
https://searchfox.org/mozilla-central/rev/a87a1c3b543475276e6d57a7a80cb02f3e42b6ed/devtools/server/actors/process.js#23-34
We have to know about all the process and their OS PIDs. JSProcessActors / JSProcessActor.getAllActors("MyActorType")
won't help provide this information.
And later on, we need to connect to one specific content process, again JSProcessActor.getAllActors("MyActorType")
won't help,
while we can iterate over ChromeUtils.getAllContentParents()
in order to find the matching osPid.
See https://phabricator.services.mozilla.com/D81123 where I sketched something to demonstrate how we would use such APIs.
This patch doesn't work, it is purely theoritical. I have a few things to address (bug 1620248) before getting to this.
Updated•4 years ago
|
Updated•4 years ago
|
Comment 7•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/7cc7ff20205e
https://hg.mozilla.org/mozilla-central/rev/9cf50d4ea19f
Description
•