Reuse global from DevTools Loader to load other DevTools modules
Categories
(DevTools :: General, task, P3)
Tracking
(firefox108 fixed)
| Tracking | Status | |
|---|---|---|
| firefox108 | --- | fixed |
People
(Reporter: jdescottes, Assigned: jdescottes)
References
(Blocks 1 open bug)
Details
Attachments
(3 files, 1 obsolete file)
If we load the DevToolsLoader with loadInDevToolsLoader: true and manage to reuse the same global to load other devtools modules, we should be able to automatically load other ESMs in the DevTools global instead of the shared global.
See this comment: https://phabricator.services.mozilla.com/D159219#5226753
But note that it may not be that complicated to set the right global in our Loader... especially once I land my patch to convert Loader.jsm/base-loader.js into ESMs.
https://searchfox.org/mozilla-central/rev/76ccfc801e6b736c844cde3fddeab7a748fc8515/devtools/shared/loader/base-loader.js#545-550
Here we might "just" replace sharedGlobalSandbox with globalThis or something refering to the global of base-loader.sys.mjs,
and then, ensure that Loader.sys.mjs is loaded with loadInDevtoolsLoader:true.
Many issues may arise, but I think we can do this without any additional C++ API.
The downside of this approach is that we will start loading all ESMs in the DevTools compartment, and this might not always be desirable. So we will have to flag individual imports with loadInDevToolsLoader: false. One case is about the JSWindow/ProcessActors. We never want to load twice an ESM which will register actors, because the actual store for those actors in C++ and doesn't seem to follow compartments.
| Assignee | ||
Comment 1•3 years ago
|
||
Just a wip, this prevents the MBT from actually retrieving content from other processes.
But the isolation works
| Assignee | ||
Comment 2•3 years ago
|
||
| Assignee | ||
Comment 3•3 years ago
|
||
Depends on D160214
| Assignee | ||
Comment 4•3 years ago
|
||
Depends on D160215
Updated•3 years ago
|
Comment 6•3 years ago
•
|
||
Backed out for causing failures in test_invisible_loader.js.
- Backout link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | devtools/shared/tests/xpcshell/test_loader.js | run_test - [run_test : 19] The loader is set invisible to debugger - false == true
| Assignee | ||
Comment 7•3 years ago
|
||
Sorry, I forgot to include the xpcshell test update! Will re-land with the fix
Comment 9•3 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/af01513a649e
https://hg.mozilla.org/mozilla-central/rev/188f86540306
https://hg.mozilla.org/mozilla-central/rev/ea7a72477948
Description
•