Bug 1817729 - [devtools] Ensure computing Actor's requestTypes only once. r=jdescottes

This complex object used to be computed only once per Class,
but this regressed to be computed once per Class instance.

Differential Revision: https://phabricator.services.mozilla.com/D170412
This commit is contained in:
Alexandre Poirot 2023-02-21 10:48:35 +00:00
parent 200dca5cfb
commit 1715c2ffcb

View file

@ -34,7 +34,11 @@ class Actor extends Pool {
// Will contain the actor's ID
this.actorID = null;
this.requestTypes = generateRequestTypes(spec);
// Ensure computing requestTypes only one time per class
const proto = Object.getPrototypeOf(this);
if (!proto.requestTypes) {
proto.requestTypes = generateRequestTypes(spec);
}
// Forward events to the connection.
if (spec.events) {