Closed Bug 1270751 Opened 8 years ago Closed 6 years ago

Protocol.js needs a way to predeclare actor types.

Categories

(DevTools :: General, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1399589

People

(Reporter: ejpbruel, Unassigned)

Details

In some cases, we have circular dependencies between actors. For instance, the inspector actors depend on the style actors, which depend on the inspector actors (in particular, the node actor).

In the example above, we use protocol.addActorType to predeclare the node actor type for the style actors. However, addActorType is intended to *define* an actor type, not declare it. An actor should only ever be defined once, so addActorType will throw when we attempt to declare the same actor type twice.

For instance, the highlighter actors also depend on the node actor, but we cannot use addActorType to predeclare the node actor type there *and* in the style actors. Instead, we only predeclare this type for the latter, and then require the highlighter actors to be required after the style actors everywhere.

Needless to say, this is very fragile. What we need is a way to properly predeclare actor types. We could simply make addActorType not throw when it is called twice for the same actor type, but that would allow actor types to be redefined, which is not what we want. What I think we should do is have separate functions for declaring and defining actor types.
Severity: normal → enhancement
The specs index added in bug 1399589 achieves this.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.