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:
Alexandre Poirot
2025-02-11 13:41:36 +00:00
parent 83d08122aa
commit 40e54fc01c
7 changed files with 24 additions and 0 deletions

View File

@@ -709,6 +709,14 @@ class TargetCommand extends EventEmitter {
}
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;
if (typeName == "windowGlobalTarget") {
return TargetCommand.TYPES.FRAME;