summaryrefslogtreecommitdiffstats
path: root/devtools/server/startup
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/server/startup')
-rw-r--r--devtools/server/startup/content-process-script.js4
-rw-r--r--devtools/server/startup/worker.js24
2 files changed, 17 insertions, 11 deletions
diff --git a/devtools/server/startup/content-process-script.js b/devtools/server/startup/content-process-script.js
index 3449eb465a..fa91ab0c28 100644
--- a/devtools/server/startup/content-process-script.js
+++ b/devtools/server/startup/content-process-script.js
@@ -143,7 +143,7 @@ class ContentProcessStartup {
/**
* Called when the content process just started.
- * This will start creating ContentProcessTarget actors, but only if DevTools code (WatcherActor / WatcherRegistry.sys.mjs)
+ * This will start creating ContentProcessTarget actors, but only if DevTools code (WatcherActor / ParentProcessWatcherRegistry.sys.mjs)
* put some data in `sharedData` telling us to do so.
*/
maybeCreateExistingTargetActors() {
@@ -187,7 +187,7 @@ class ContentProcessStartup {
* The prefix of the DevToolsServerConnection of the Watcher Actor.
* This is used to compute a unique ID for the target actor.
* @param Object sessionData
- * All data managed by the Watcher Actor and WatcherRegistry.jsm, containing
+ * All data managed by the Watcher Actor and ParentProcessWatcherRegistry.jsm, containing
* target types, resources types to be listened as well as breakpoints and any
* other data meant to be shared across processes and threads.
* @param Object options Dictionary with optional values:
diff --git a/devtools/server/startup/worker.js b/devtools/server/startup/worker.js
index 42034831ee..6ed880eb28 100644
--- a/devtools/server/startup/worker.js
+++ b/devtools/server/startup/worker.js
@@ -4,7 +4,7 @@
"use strict";
-/* global worker, loadSubScript, global */
+/* global global */
/*
* Worker debugger script that listens for requests to start a `DevToolsServer` for a
@@ -44,7 +44,10 @@ this.rpc = function (method, ...params) {
});
}.bind(this);
-loadSubScript("resource://devtools/shared/loader/worker-loader.js");
+const { worker } = ChromeUtils.importESModule(
+ "resource://devtools/shared/loader/worker-loader.sys.mjs",
+ { global: "current" }
+);
const { WorkerTargetActor } = worker.require(
"resource://devtools/server/actors/targets/worker.js"
@@ -86,13 +89,6 @@ this.addEventListener("message", async function (event) {
// Make the worker manage itself so it is put in a Pool and assigned an actorID.
workerTargetActor.manage(workerTargetActor);
- workerTargetActor.on(
- "worker-thread-attached",
- function onThreadAttached() {
- postMessage(JSON.stringify({ type: "worker-thread-attached" }));
- }
- );
-
// Step 5: Send a response packet to the parent to notify
// it that a connection has been established.
connections.set(forwardingPrefix, {
@@ -100,6 +96,11 @@ this.addEventListener("message", async function (event) {
workerTargetActor,
});
+ // Immediately notify about the target actor form,
+ // so that we can emit RDP events from the target actor
+ // and have them correctly routed up to the frontend.
+ // The target front has to be first created by receiving its form
+ // before being able to receive RDP events.
postMessage(
JSON.stringify({
type: "connected",
@@ -126,6 +127,11 @@ this.addEventListener("message", async function (event) {
await Promise.all(promises);
}
+ // Finally, notify when we are done processing session data
+ // We are processing breakpoints, which means we can release the execution of the worker
+ // from the main thread via `WorkerDebugger.setDebuggerReady(true)`
+ postMessage(JSON.stringify({ type: "session-data-processed" }));
+
break;
case "add-or-set-session-data-entry":