Convert Troubleshoot.jsm to use ChromeUtils.requestProcInfo over Services.ppmm to get process types
Categories
(Toolkit :: General, task, P5)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox114 | --- | fixed |
People
(Reporter: Felipe, Assigned: imlata1111, Mentored)
References
Details
(Keywords: good-first-bug, Whiteboard: [lang=js])
Attachments
(2 files)
In bug 1505322, a detailed list of remote processes was added to about:support. However, the list is incomplete, as it only covers the processes related to web content + manually covers the GPU process.
There's the ChromeUtils.requestProcInfo API, but it was brand new, and I wasn't sure if it was ready and stable to be used from about:support. (It calls into a lot of proc and thread-related C++ code and opening about:support is definitely not a good moment to crash users)
However, if we 're confident in it, and assuming new processes will be added to requestProcInfo, about:support will remain up to date with new things.
When we do that, we should add translations for the other proc types to the file processTypes.ftl
Updated•7 years ago
|
Updated•3 years ago
|
Comment 1•3 years ago
|
||
Hey guys, I would like to work on this. It's my first bug fix here, but I'm a experienced js dev.
I think I'll need a little bit more info from the mentor re where in the code base to start looking.
Comment 2•3 years ago
|
||
Hi, Sam!
Thanks for volunteering to hack on this bug. I can definitely help you get started, but before I assign this bug to you, I wanted to check a few things:
- Do you have a local clone of the repository already?
- Have you managed to build Firefox locally and get it running?
If so, I can get you started on this bug and point you in the right direction.
Comment 3•3 years ago
|
||
Hi Mike,
Thanks for getting back.
Yes for both 1 and 2.
I went ahead and just changed Services.ppmm to Chromeutils.requestProcInfo in here:
https://searchfox.org/mozilla-central/source/toolkit/modules/Troubleshoot.jsm
I couldn't find info on what requestProcInfo returns however, so will need your help on that one. Need to see if childCount and getChildAt would still work.
Thanks,
Sam
Comment 4•3 years ago
|
||
Hi Sam!
So the requestProcInfo method is defined here in the ChromeUtils WebIDL file: https://searchfox.org/mozilla-central/rev/4f4c8e0e84d5a728244f1e820dda14e5cdb81e71/dom/chrome-webidl/ChromeUtils.webidl#535-539
You're not going to get a childCount or getChildAt from that, but that's okay - it returns a Promise that resolves to a ParentProcInfoDictionary, which is defined here: https://searchfox.org/mozilla-central/rev/4f4c8e0e84d5a728244f1e820dda14e5cdb81e71/dom/chrome-webidl/ChromeUtils.webidl#768-801
From that, we can iterate the children of the top-level of that dictionary, where each entry will be a ChildProcInfoDictionary: https://searchfox.org/mozilla-central/rev/4f4c8e0e84d5a728244f1e820dda14e5cdb81e71/dom/chrome-webidl/ChromeUtils.webidl#726-766
so the "type" is what we're most interested in, and what we can poke into the remoteTypes here: https://searchfox.org/mozilla-central/rev/4f4c8e0e84d5a728244f1e820dda14e5cdb81e71/toolkit/modules/Troubleshoot.jsm#413-417
Also note that we can remove this call to remoteTypePrefix here: https://searchfox.org/mozilla-central/rev/4f4c8e0e84d5a728244f1e820dda14e5cdb81e71/toolkit/modules/Troubleshoot.jsm#411, since requestProcInfo automatically truncates the domain from the process type.
Let me know if you have any questions, I'm happy to answer.
Comment 5•3 years ago
|
||
Hey, thanks for the detailed explanation. I have enough info to start on this, and the definitions in the webidl file makes this straightforward.
I still haven't figured out how I can test this / log or use breakpoints on this while working on it. But I'll try to figure that out, and if I can't, I'll let you know.
Thanks
Comment 6•3 years ago
|
||
Hey Sam, just checking in to see how it's going. Any questions for me?
Comment 7•3 years ago
|
||
Hey Mike,
I have the code ready via reading the documentation, but still haven't figured out how to test.
# HG changeset patch
# User samratrocks
# Date 1662076388 14400
# Thu Sep 01 19:53:08 2022 -0400
# Branch bugfix-1545283
# Node ID 5894774eceb26e20d8b1e9697e881cdcd2eb7cc3
# Parent af1fc1e6eb24573a5ebad1754b9d4917e934a5f9
Convert Troubleshoot.jsm to use ChromeUtils.requestProcInfo over Services.ppmm
diff -r af1fc1e6eb24 -r 5894774eceb2 toolkit/modules/Troubleshoot.jsm
--- a/toolkit/modules/Troubleshoot.jsm Thu Sep 01 00:53:00 2022 +0300
+++ b/toolkit/modules/Troubleshoot.jsm Thu Sep 01 19:53:08 2022 -0400
@@ -393,13 +393,15 @@
);
},
- processes: function processes(done) {
+ processes: async function processes(done) {
let remoteTypes = {};
- for (let i = 0; i < Services.ppmm.childCount; i++) {
+ const processInfo = await ChromeUtils.requestProcInfo();
+
+ for (let i = 0; i < processInfo.children.length; i++) {
let remoteType;
try {
- remoteType = Services.ppmm.getChildAt(i).remoteType;
+ remoteType = processInfo[i].type;
} catch (e) {}
// The parent process is also managed by the ppmm (because
@@ -408,8 +410,6 @@
continue;
}
- remoteType = E10SUtils.remoteTypePrefix(remoteType);
-
if (remoteTypes[remoteType]) {
remoteTypes[remoteType]++;
} else {
Also need to figure out Mercurial a little bit more.
Comment 8•3 years ago
|
||
[update to comment above]:
processInfo.children[i].type;
Comment 9•3 years ago
|
||
Update on this,
I was able to go start testing. Didn't realize the log was in the terminal and not the dev tool console .
Will let you know if there are any questions.
Thanks!
Comment 10•3 years ago
|
||
Comment 11•3 years ago
|
||
Hey Mike,
I have submitted PR for this:
https://phabricator.services.mozilla.com/D156610
Ty!
Comment 12•3 years ago
|
||
This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit auto_nag documentation.
Comment 13•3 years ago
|
||
Hello, I can please get assigned to this. Thank you :)
| Assignee | ||
Comment 14•3 years ago
|
||
Hey Mike! I'm an outreachy applicant and interested in solving this bug. Since there is a patch already attached to this. How should I continue by making the changes in the previous patch or submitting a new one?
Comment 15•3 years ago
|
||
Hi Lata and akanksha.t05,
Sorry that I didn't jump on this more quickly! Since akanksha.t05 asked first, I'm going to assign them the bug to work on. Yes, akanksha.t05, the starting point would be trying to apply the original patch and then if it applies cleanly, addressing the remaining review comments from the Phabricator revision. Let me know if you need any guidance on doing that.
| Assignee | ||
Comment 16•3 years ago
|
||
Hey Mike! Since we didn't hear anything from akanksha.t05. Can I work on this now?
Comment 17•3 years ago
|
||
Hi Lata,
My spologies for not getting back sooner. Yes, we haven't heard from akanksha.t05, so this is fine for you to work on. Thanks!
Updated•3 years ago
|
| Assignee | ||
Comment 18•3 years ago
|
||
Thank you! I am working on this and soon submit a revised patch.
| Assignee | ||
Comment 19•3 years ago
|
||
Updated•3 years ago
|
| Assignee | ||
Comment 20•3 years ago
|
||
Hey Mike! I have submitted the revised patch. I couldn't make changes to the existing patch as Troubleshoot.jsm has changed to Troubleshoot.sys.mjs and that was giving error while applying the changes. Kindly review my new patch and let me know if any further changes has to be made.
Comment 21•3 years ago
|
||
Comment 22•3 years ago
|
||
| bugherder | ||
Description
•