From 5b6373fb8b19044d6a8f9d997a83e371c8512281 Mon Sep 17 00:00:00 2001 From: Razvan Caliman Date: Thu, 2 Jul 2020 08:52:20 +0000 Subject: [PATCH] Bug 1649738 - Log an error when calling targetFront.actorHasMethod() for an unknown or uninitialized actor. r=jdescottes Differential Revision: https://phabricator.services.mozilla.com/D81850 --- devtools/client/fronts/targets/target-mixin.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/devtools/client/fronts/targets/target-mixin.js b/devtools/client/fronts/targets/target-mixin.js index be465a86e994..09a86b6dcdf0 100644 --- a/devtools/client/fronts/targets/target-mixin.js +++ b/devtools/client/fronts/targets/target-mixin.js @@ -261,6 +261,13 @@ function TargetMixin(parentClass) { */ actorHasMethod(actorName, methodName) { return this.getActorDescription(actorName).then(desc => { + if (!desc) { + console.error( + `Actor "${actorName}" was not found in the protocol description. + Ensure you used the correct typename and that the actor is initialized.` + ); + } + if (desc?.methods) { return !!desc.methods.find(method => method.name === methodName); }