Bug 1944981 - [devtools] Expose a targetType attribute on all target actor forms. r=devtools-reviewers,bomsy
This will help distinguish targets by types in the frontend, as well as in Vs Code. Differential Revision: https://phabricator.services.mozilla.com/D236268
This commit is contained in:
@@ -104,6 +104,8 @@ class WorkerDescriptorFront extends DescriptorMixin(
|
|||||||
this.targetForm.threadActor = workerTargetForm.threadActor;
|
this.targetForm.threadActor = workerTargetForm.threadActor;
|
||||||
this.targetForm.tracerActor = workerTargetForm.tracerActor;
|
this.targetForm.tracerActor = workerTargetForm.tracerActor;
|
||||||
|
|
||||||
|
this.targetForm.targetType = workerTargetForm.targetType;
|
||||||
|
|
||||||
if (this.isDestroyedOrBeingDestroyed()) {
|
if (this.isDestroyedOrBeingDestroyed()) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ class WorkerDescriptorActor extends Actor {
|
|||||||
threadActor: this._threadActor,
|
threadActor: this._threadActor,
|
||||||
tracerActor: this._tracerActor,
|
tracerActor: this._tracerActor,
|
||||||
|
|
||||||
|
targetType: this._targetType,
|
||||||
|
|
||||||
id: this._dbg.id,
|
id: this._dbg.id,
|
||||||
url: this._dbg.url,
|
url: this._dbg.url,
|
||||||
origin: this._dbg.principal.origin,
|
origin: this._dbg.principal.origin,
|
||||||
@@ -124,6 +126,8 @@ class WorkerDescriptorActor extends Actor {
|
|||||||
consoleActor: this._consoleActor,
|
consoleActor: this._consoleActor,
|
||||||
threadActor: this._threadActor,
|
threadActor: this._threadActor,
|
||||||
tracerActor: this._tracerActor,
|
tracerActor: this._tracerActor,
|
||||||
|
|
||||||
|
targetType: this._targetType,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,6 +145,8 @@ class WorkerDescriptorActor extends Actor {
|
|||||||
this._threadActor = workerTargetForm.threadActor;
|
this._threadActor = workerTargetForm.threadActor;
|
||||||
this._tracerActor = workerTargetForm.tracerActor;
|
this._tracerActor = workerTargetForm.tracerActor;
|
||||||
|
|
||||||
|
this._targetType = workerTargetForm.targetType;
|
||||||
|
|
||||||
this._transport = transport;
|
this._transport = transport;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -150,6 +156,8 @@ class WorkerDescriptorActor extends Actor {
|
|||||||
threadActor: this._threadActor,
|
threadActor: this._threadActor,
|
||||||
tracerActor: this._tracerActor,
|
tracerActor: this._tracerActor,
|
||||||
|
|
||||||
|
targetType: this._targetType,
|
||||||
|
|
||||||
url: this._dbg.url,
|
url: this._dbg.url,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -165,6 +165,8 @@ class ContentProcessTargetActor extends BaseTargetActor {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
actor: this.actorID,
|
actor: this.actorID,
|
||||||
|
targetType: this.targetType,
|
||||||
|
|
||||||
isXpcShellTarget: this.isXpcShellTarget,
|
isXpcShellTarget: this.isXpcShellTarget,
|
||||||
processID: Services.appinfo.processID,
|
processID: Services.appinfo.processID,
|
||||||
remoteType: Services.appinfo.remoteType,
|
remoteType: Services.appinfo.remoteType,
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ class WebExtensionContentScriptTargetActor extends BaseTargetActor {
|
|||||||
return {
|
return {
|
||||||
actor: this.actorID,
|
actor: this.actorID,
|
||||||
addonId: this.addonId,
|
addonId: this.addonId,
|
||||||
|
targetType: this.targetType,
|
||||||
|
|
||||||
// Use the related extension as content script title
|
// Use the related extension as content script title
|
||||||
// as content scripts have no name, they are just a group of JS files
|
// as content scripts have no name, they are just a group of JS files
|
||||||
|
|||||||
@@ -679,6 +679,8 @@ class WindowGlobalTargetActor extends BaseTargetActor {
|
|||||||
|
|
||||||
const response = {
|
const response = {
|
||||||
actor: this.actorID,
|
actor: this.actorID,
|
||||||
|
targetType: this.targetType,
|
||||||
|
|
||||||
browsingContextID,
|
browsingContextID,
|
||||||
processID: Services.appinfo.processID,
|
processID: Services.appinfo.processID,
|
||||||
// True for targets created by JSWindowActors, see constructor JSDoc.
|
// True for targets created by JSWindowActors, see constructor JSDoc.
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ class WorkerTargetActor extends BaseTargetActor {
|
|||||||
form() {
|
form() {
|
||||||
return {
|
return {
|
||||||
actor: this.actorID,
|
actor: this.actorID,
|
||||||
|
targetType: this.targetType,
|
||||||
|
|
||||||
consoleActor: this._consoleActor?.actorID,
|
consoleActor: this._consoleActor?.actorID,
|
||||||
threadActor: this.threadActor?.actorID,
|
threadActor: this.threadActor?.actorID,
|
||||||
|
|||||||
@@ -709,6 +709,14 @@ class TargetCommand extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTargetType(target) {
|
getTargetType(target) {
|
||||||
|
const { targetType } = target.targetForm;
|
||||||
|
if (targetType) {
|
||||||
|
return targetType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @backward-compat { version 137 } This can be removed as target.targetForm.targetType
|
||||||
|
// will always be defined. We can then remove TargetCommand.getTargetType and TargetMixin.setTargetType
|
||||||
|
// and instead have a getter like this `TargetMixin.targetType() this.targetForm.targetType`.
|
||||||
const { typeName } = target;
|
const { typeName } = target;
|
||||||
if (typeName == "windowGlobalTarget") {
|
if (typeName == "windowGlobalTarget") {
|
||||||
return TargetCommand.TYPES.FRAME;
|
return TargetCommand.TYPES.FRAME;
|
||||||
|
|||||||
Reference in New Issue
Block a user