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
This commit is contained in:
Razvan Caliman 2020-07-02 08:52:20 +00:00
Родитель ece484d43f
Коммит 5b6373fb8b
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -261,6 +261,13 @@ function TargetMixin(parentClass) {
*/ */
actorHasMethod(actorName, methodName) { actorHasMethod(actorName, methodName) {
return this.getActorDescription(actorName).then(desc => { 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) { if (desc?.methods) {
return !!desc.methods.find(method => method.name === methodName); return !!desc.methods.find(method => method.name === methodName);
} }