Closed Bug 1495386 Opened 6 years ago Closed 6 years ago

Allow to listen for front creations by typeName

Categories

(DevTools :: Framework, enhancement, P2)

enhancement

Tracking

(firefox65 fixed)

RESOLVED FIXED
Firefox 65
Tracking Status
firefox65 --- fixed

People

(Reporter: ochameau, Assigned: yulia)

References

Details

(Whiteboard: dt-fission)

Attachments

(1 file)

Bug 1222047 introduced a generic API to instantiate fronts, but it doesn't allow to listen for fronts being created.
It would be really helpful to expose such API in order to easily register event listeners whenever a front get created, that, without forcing the instantiation of a new one.

The typical usecase is the toolbox class. It has to listen for some events on the performance and inspector-related fronts, but these fronts don't necessarily have to be instantiated on toolbox opening. They will be created depending on which panel we open. For now, in order to mitigate that, we managed these fronts creation from toolbox. But for fission we have to uncouple that from the toolbox, instead it should be handled by the target or the root fronts. In addition to that, we will start instantiating more than just one of these actors and so it will be handy to have a way to listen for all the new ones being created.

So TabTarget.getFront:
  https://searchfox.org/mozilla-central/rev/819cd31a93fd50b7167979607371878c4d6f18e8/devtools/client/framework/target.js#363-373
and RootClient.getFront:
  https://searchfox.org/mozilla-central/rev/819cd31a93fd50b7167979607371878c4d6f18e8/devtools/shared/client/root-client.js#277-293
Should both emit an event whenever a new front is created. This event should be easily listened by typeName as listeners will most likely care about one particular type of front.
We might also want to emit an event on destruction (if that is *really* useful as fronts are going to be destroyed anyway and there is no value to do it only for removing the listeners).
Blocks: 1495388
Blocks: 1495389
Depends on: 1485661
this change only impacts the target front, and emits an event every time a target is
created. No listners yet.
Attachment #9015526 - Attachment description: Bug 1495386 - WIP emit event when target front is created; r=ochameau → Bug 1495386 - WIP emit event when target scoped front is created; r=ochameau
Whiteboard: dt-fission
No longer blocks: dt-fission
Assignee: nobody → ystartsev
Attachment #9015526 - Attachment description: Bug 1495386 - WIP emit event when target scoped front is created; r=ochameau → Bug 1495386 - emit event when target scoped front is created; r=ochameau
Pushed by ystartsev@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/587532e4c6fe
emit event when target scoped front is created; r=ochameau
https://hg.mozilla.org/mozilla-central/rev/587532e4c6fe
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: