ThreadActor.sources will force emitting newSource events for the returned sources
Categories
(DevTools :: Debugger, task, P3)
Tracking
(Not tracked)
People
(Reporter: ochameau, Unassigned)
References
(Blocks 2 open bugs)
Details
ThreadActor.sources method:
https://searchfox.org/mozilla-central/rev/c07aaf12f13037c1f5a343d31f8291549e57373f/devtools/server/actors/thread.js#1238
onSources: function(request) {
for (const source of this.dbg.findSources()) {
this.sources.createSourceActor(source);
}
TabSources.createSourceActor will call TabSources.sources, which will inconditionally emit a newSource event:
https://searchfox.org/mozilla-central/rev/c07aaf12f13037c1f5a343d31f8291549e57373f/devtools/server/actors/utils/TabSources.js#142
source: function({ source, isInlineSource, contentType }) {
...
this.emit("newSource", actor);
Which is received by the ThreadActor, piping this event back to the frontend, also, inconditionally:
https://searchfox.org/mozilla-central/rev/c07aaf12f13037c1f5a343d31f8291549e57373f/devtools/server/actors/thread.js#1875-1886
onNewSourceEvent: function(source) {
...
const type = "newSource";
this.conn.send({
from: this._parent.actorID,
type,
source: source.form(),
});
And, on top of that, we emit the newSource event twice from here, but that's another story (bug 1269919).
That means that we end up emitting each source form 3 times:
- once in the array returned by ThreadActor.sources request,
- and two additional times from this onNewSourceEvent method.
This means calling SourceActor.form 3 times, building its non-naive JSON 3 times and piping it through RDP 3 times.
It would be great to only pipe it once, but this may require some tweaks in the frontend if we were depending on this extra verbosity of the actor.
Updated•6 years ago
|
Updated•6 years ago
|
Comment 1•5 years ago
|
||
This is important because the client calls fetchSources in several places and we could accidentally send the same results down.
Updated•2 years ago
|
Description
•