Bug 1589908 - The Worker name should be reflected in the threads pane r=bhackett

Differential Revision: https://phabricator.services.mozilla.com/D52444

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Bryan Kok 2019-12-18 10:12:15 +00:00
parent 2dd64e92cd
commit 4072abcd72
6 changed files with 10 additions and 2 deletions

View File

@ -97,7 +97,9 @@ export function createThread(actor: string, target: Target): Thread {
actor,
url: target.url,
type: getTargetType(target),
name: target.name,
name: target.isWorkerTarget
? target.workerName || target.name
: target.name,
serviceWorkerStatus: target.debuggerServiceWorkerStatus,
};
}

View File

@ -195,6 +195,7 @@ export type Target = {
destroy: () => void,
threadFront: ThreadFront,
name: string,
workerName?: string,
isBrowsingContext: boolean,
isContentProcess: boolean,
isWorkerTarget: boolean,

View File

@ -125,13 +125,15 @@ const WorkerTargetActor = protocol.ActorClassWithSpec(workerTargetSpec, {
}
return connectToWorker(this.conn, this._dbg, this.actorID, options).then(
({ threadActor, transport, consoleActor }) => {
({ workerName, threadActor, transport, consoleActor }) => {
this._workerName = workerName;
this._threadActor = threadActor;
this._transport = transport;
this._consoleActor = consoleActor;
return {
type: "connected",
workerName: this._workerName,
threadActor: this._threadActor,
consoleActor: this._consoleActor,
};

View File

@ -156,6 +156,7 @@ function connectToWorker(connection, dbg, id, options) {
connection.setForwarding(id, transport);
resolve({
workerName: message.workerName,
threadActor: message.threadActor,
consoleActor: message.consoleActor,
transport: transport,

View File

@ -123,6 +123,7 @@ this.addEventListener("message", function(event) {
JSON.stringify({
type: "connected",
id: packet.id,
workerName: consoleActor.evaluateJS({ text: "self.name" }).result,
threadActor: threadActor.actorID,
consoleActor: consoleActor.actorID,
})

View File

@ -78,6 +78,7 @@ class WorkerTargetFront extends TargetMixin(
const connectResponse = await this.connect({});
// Set the console actor ID on the form to expose it to Target.attachConsole
// Set the ThreadActor on the target form so it is accessible by getFront
this.workerName = connectResponse.workerName;
this.targetForm.consoleActor = connectResponse.consoleActor;
this.targetForm.threadActor = connectResponse.threadActor;
this._threadActor = connectResponse.threadActor;