diff --git a/devtools/server/main.js b/devtools/server/main.js index 6ab60b0625a3..5db2ef6fa626 100644 --- a/devtools/server/main.js +++ b/devtools/server/main.js @@ -779,11 +779,15 @@ var DebuggerServer = { }); }, + /** + * Start a DevTools server in a worker and add it as a child server for an active + * connection. + */ connectToWorker(connection, dbg, id, options) { return new Promise((resolve, reject) => { // Step 1: Ensure the worker debugger is initialized. if (!dbg.isInitialized) { - dbg.initialize("resource://devtools/server/worker.js"); + dbg.initialize("resource://devtools/server/startup/worker.js"); // Create a listener for rpc requests from the worker debugger. Only do // this once, when the worker debugger is first initialized, rather than diff --git a/devtools/server/moz.build b/devtools/server/moz.build index de0106647e0c..3a1a9827d8c0 100644 --- a/devtools/server/moz.build +++ b/devtools/server/moz.build @@ -19,7 +19,6 @@ XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini'] DevToolsModules( 'main.js', - 'worker.js' ) with Files('**'): diff --git a/devtools/server/startup/moz.build b/devtools/server/startup/moz.build index 5e02302c0059..b8a1607b3870 100644 --- a/devtools/server/startup/moz.build +++ b/devtools/server/startup/moz.build @@ -8,4 +8,5 @@ DevToolsModules( 'content-process.js', 'content-process.jsm', 'frame.js', + 'worker.js', ) diff --git a/devtools/server/worker.js b/devtools/server/startup/worker.js similarity index 93% rename from devtools/server/worker.js rename to devtools/server/startup/worker.js index 088bf0836542..be99b842fd83 100644 --- a/devtools/server/worker.js +++ b/devtools/server/startup/worker.js @@ -7,6 +7,12 @@ /* eslint-env mozilla/chrome-worker */ /* global worker, loadSubScript, global */ +/* + * Worker debugger script that listens for requests to start a `DebuggerServer` for a + * worker in a process. Loaded into a specific worker during + * `DebuggerServer.connectToWorker` which is called from the same process as the worker. + */ + // This function is used to do remote procedure calls from the worker to the // main thread. It is exposed as a built-in global to every module by the // worker loader. To make sure the worker loader can access it, it needs to be