Closed Bug 1493714 Opened 2 years ago Closed 2 years ago
Thread/detach Thread code specific to the toolbox in toolbox .js
Bug 1493714 - move toolbox specific listeners to threadClient events to the toolbox; r=ochameau,jdescottes
47 bytes, text/x-phabricator-request
|Details | Review|
attachThread and detachThread is 90% generic code to instantiate the thread client that has nothing specific to the toolbox. The only two bits are specific to the toolbox: https://searchfox.org/mozilla-central/source/devtools/client/framework/attach-thread.js#24-35 This should rather be a listener in toolbox.js, registered from toolbox.open via: threadClient.addListener("paused", this.handleThreadState); threadClient.addListener("resumed", this.handleThreadState); And: https://searchfox.org/mozilla-central/rev/0640ea80fbc8d48f8b197cd363e2535c95a15eb3/devtools/client/framework/attach-thread.js#82-90 This one is harder to refactor as it happens right before instantiating the thread client and doesn't emit an event. But we might be able to do something via an event? It would be great to understand this error. Is the thread client broken after that? Can we set a flag on thread client so that toolbox.open can later check it? Then once attachThread and detachThread are no longer having any reference to toolbox, we can inline this code into target.js (bug 1492830)
Note that there is also bug 1225492 for the thread-paused/thread-resumed events being emitted from handleThreadState, but that is yet another thing to refactor.
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/781152317789 move toolbox specific listeners to threadClient events to the toolbox; r=jdescottes
You need to log in before you can comment on or make changes to this bug.