We discussed this briefly on Elements last week so I will just paste my comments on this topic. If we can start a bgtask which will spawn a BrowserToolbox from a browser mochitest, then I feel like we can reuse most of the [initBrowserToolboxTask helper](https://searchfox.org/mozilla-central/rev/3c8a7970944daaf917b547dffc0790bcd37cadc1/devtools/client/framework/browser-toolbox/test/helpers-browser-toolbox.js#37). If the preference `devtools.browsertoolbox.enable-test-server` is set, the BrowserToolbox [automatically starts a test server](https://searchfox.org/mozilla-central/rev/3c8a7970944daaf917b547dffc0790bcd37cadc1/devtools/client/framework/browser-toolbox/window.js#222) which listens for connections on port 6001. So I imagine the steps will be - test starts the Background Task with the --jsdebugger argument - Background Task spawns the BrowserToolbox - BrowserToolbox starts a test server (depends on pref `devtools.browsertoolbox.enable-test-server`, has to be true for the Background Task profile) - BrowserToolbox automatically breaks on the first line - test connects to the BrowserToolbox (we might have to poll on port 6001 until we get something here?) - test then interacts with the BrowserToolbox to set breakpoints, resume, etc... If we can get help/pointers to start the background task from the test, I hope the rest should be straightforward.
Bug 1686344 Comment 3 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
We discussed this briefly on Elements last week so I will just paste my comments on this topic. If we can start a Background Task which will spawn a BrowserToolbox from a browser mochitest, then I feel like we can reuse most of the [initBrowserToolboxTask helper](https://searchfox.org/mozilla-central/rev/3c8a7970944daaf917b547dffc0790bcd37cadc1/devtools/client/framework/browser-toolbox/test/helpers-browser-toolbox.js#37). If the preference `devtools.browsertoolbox.enable-test-server` is set, the BrowserToolbox [automatically starts a test server](https://searchfox.org/mozilla-central/rev/3c8a7970944daaf917b547dffc0790bcd37cadc1/devtools/client/framework/browser-toolbox/window.js#222) which listens for connections on port 6001. So I imagine the steps will be - test starts the Background Task with the --jsdebugger argument - Background Task spawns the BrowserToolbox - BrowserToolbox starts a test server (depends on pref `devtools.browsertoolbox.enable-test-server`, has to be true for the Background Task profile) - BrowserToolbox automatically breaks on the first line - test connects to the BrowserToolbox (we might have to poll on port 6001 until we get something here?) - test then interacts with the BrowserToolbox to set breakpoints, resume, etc... If we can get help/pointers to start the background task from the test, I hope the rest should be straightforward.