From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- devtools/server/startup/worker.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'devtools/server/startup/worker.js') 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": -- cgit v1.2.3