Source resource://devtools/server/startup/worker.js is missing in debugger
Categories
(DevTools :: Debugger, defect, P3)
Tracking
(Not tracked)
People
(Reporter: nchevobbe, Unassigned)
Details
Steps to reproduce:
- Open Firefox, navigate to https://www.google.com/
- Open the Browser Toolbox, select the console
- In Firefox, open the regular toolbox, select the debugger
- At this point
devtools/server/startup/worker.jsshould have been ran - Use the command palette in the browser toolbox debugger and search for
startup/worker
Expected result:
I can find the script to debug it
Actual result:
There's no results
The file is loaded from https://searchfox.org/mozilla-central/rev/40205f1b55f1ba8a26fcbd362c20d843e8718a87/devtools/server/connectors/worker-connector.js#36 , using the WorkerDebugger initialize method: https://searchfox.org/mozilla-central/rev/40205f1b55f1ba8a26fcbd362c20d843e8718a87/dom/workers/WorkerDebugger.cpp#355-373
Updated•4 years ago
|
Comment 1•4 years ago
|
||
Ok so, the first think is that WorkerDebugger.initialize will only load startup/worker.js once:
https://searchfox.org/mozilla-central/rev/40205f1b55f1ba8a26fcbd362c20d843e8718a87/dom/workers/WorkerDebugger.cpp#362-370
When you open the Browser Toolbox first, if the worker is already running, the browser toolbox should spawn a worker target and inject startup/worker.js.
Then, the second issue, is that, because of that, we create only one global for the privileged scripts devtools are using:
https://searchfox.org/mozilla-central/rev/8432d4fe31245ae9121231d7c0335aaa342675d2/dom/workers/WorkerDebugger.cpp#82-83,93,96
And so a unique system principal:
https://searchfox.org/mozilla-central/rev/8432d4fe31245ae9121231d7c0335aaa342675d2/dom/workers/WorkerScope.cpp#1036-1037
This unique global and related principal will end up being used by all modules loaded from startup/worker.js. Meaning everything devtools loads.
In order to support debugging all these scripts, we would need to change initialize so that we can inject two distinct set of modules, each using system principal, but with distinct global and principal.
Note that we might have changes around this code in order to support loading ESM in workers, so that this first script would be a ESM instead of plain JS. But noone is looking into that yet.
Description
•