Ensure passing the form to Fronts before notifying about their creation
Categories
(DevTools :: Framework, enhancement)
Tracking
(firefox71 fixed)
| Tracking | Status | |
|---|---|---|
| firefox71 | --- | fixed |
People
(Reporter: ochameau, Assigned: ochameau)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
Front's form is currently passed after calling parentFront.manage(front):
https://searchfox.org/mozilla-central/rev/17756e2a5c180d980a4b08d99f8cc0c97290ae8d/devtools/shared/protocol/types.js#336-344
parentFront.manage(front);
}
// When the type `${name}#actorid` is used, `v` is a string refering to the
// actor ID. We only set the actorID just before and so do not need anything else.
if (detail != "actorid") {
v = identityWrite(v);
front.form(v, ctx);
}
But we do notify about the fronts from within Front.manage:
https://searchfox.org/mozilla-central/rev/17756e2a5c180d980a4b08d99f8cc0c97290ae8d/devtools/shared/protocol/Front.js#79-96
async manage(front) {
if (!front.actorID) {
throw new Error(
"Can't manage front without an actor ID.\n" +
"Ensure server supports " +
front.typeName +
"."
);
}
super.manage(front);
if (typeof front.initialize == "function") {
await front.initialize();
}
// Call listeners registered via `onFront` method
this._frontListeners.emit(front.typeName, front); // <==== Right here
}
We should ensure calling front.form(v) before this._frontListeners.emit(front.typeName, front);, so that when we notify about the fronts being just created, their typical attributes polulated out of the form are already set.
| Assignee | ||
Comment 1•6 years ago
|
||
I thought I would contribute to this test.
As it doesn't involve any child actor, I'm not, but this cleanup is still valuable.
| Assignee | ||
Comment 2•6 years ago
|
||
You can listen for fronts creation via parentFront.onFront(typeName, callback).
For now, we were calling callback before we pass the form to Front.
This leads to empty attributes as the Front doesn't have access to any data.
| Assignee | ||
Comment 3•6 years ago
|
||
| Assignee | ||
Updated•6 years ago
|
| Assignee | ||
Updated•6 years ago
|
Comment 5•6 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/ad24c0afefd4
https://hg.mozilla.org/mozilla-central/rev/b2a798629bd6
Description
•