Closed Bug 1609128 Opened 5 years ago Closed 5 years ago

Add polymorphic type support to protocol.js

Categories

(DevTools :: Framework, enhancement)

enhancement
Not set
normal

Tracking

(firefox74 fixed)

RESOLVED FIXED
Firefox 74
Tracking Status
firefox74 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

For now, you can only return a unique type of actor from an actor method, or pass a unique type of front to a front method argument.
But in many case, we do return more than one possible type of actor.
For example, the target actors could be a BrowsingContextTargetActor inherited actor, or a ContentProcessTargetActor.
In order to support that, we have to avoid using protocol.js types and use json as a type. Then we need to manually convert the actor to its form, via actor.form() on the actor side. And on the client side, we have to manually instantiate the front from the form.

It would be nice to add some support for polymorphism, so that we can return more than just one type of actor and have protocol.js to automatically pass the form on the wire, and instantiate the right Front class on the client side.

Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/92d116a3c59d
Refactor test_protocol_children.js to use Task/async/await. r=jdescottes
https://hg.mozilla.org/integration/autoland/rev/1e72656e038e
Move all protocol.js tests next to its implementation. r=jdescottes
https://hg.mozilla.org/integration/autoland/rev/373c0e15c266
Implement polymorphism in protocol.js r=jdescottes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: