Stop memoizing the target object in WebConsole classes
Categories
(DevTools :: Console, enhancement, P1)
Tracking
(Fission Milestone:M6c, firefox70 fixed)
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: ochameau, Assigned: ochameau)
References
Details
(Whiteboard: dt-fission-m2-mvp)
Attachments
(3 files)
The WebConsole and WebConsoleConnectionProxy classes are memoizing the target
front.
But this get in the way of bug 1565263.
Instead, we should fetch the target from a dynamic getter, so that we always get "the current target", instead of "whatever target the toolbox was opened with".
An alternative could be to update this memoized target
attribute whenever the toolbox switchs to another target, but is it any better?
A third option could be to emit a "this target is about to be replaced by this new one" on the target itself, and listen to it everywhere, from the toolbox and panels. But we might have an ordering issue. As of today, the toolbox do call target.attach()
, and for now, we expect it to be called first before the panel start using the target object. An example is target.activeConsole
that is only set after attach resolves. There might be other cases like that. As part of the resource API discussion, we might inline the call to attach
into the instantiation of the target actors and so this may no longer be an issue.
Assignee | ||
Comment 1•5 years ago
|
||
As we enable fission and support more than one target, the target will change and so memoizing gets in the way.
I see three options here:
- always fetch the target from toolbox, which watch for target changes, attach the new one (this is necessary to have activeConsole working)
- listen for "switch-target" on toolbox in order to update the memoized target everywhere in console. We should probably stop memoizing it everywhere but one high level class
- try to emit a "switching to another target" on the TargetMixin, listen to that and do similarly to the previous option.
This patch applies the first option.
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
Assignee | ||
Comment 3•5 years ago
|
||
Do that to better highlight that the target can change over time.
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a213b28dd40f Fetch target from toolbox instead of memoizing it on console classes. r=nchevobbe https://hg.mozilla.org/integration/autoland/rev/304366165980 Fetch toolbox from WebConsole class rather than gDevTools. r=nchevobbe https://hg.mozilla.org/integration/autoland/rev/854e62f7f1ae Rename target to currentTarget in WebConsole codebase. r=nchevobbe,yulia
Comment 5•5 years ago
|
||
Backed out 3 changesets (bug 1570242) for devtools failure in /webconsole/test/node/components/webconsole-wrapper.test.js. CLOSED TREE
Log:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=262634062&repo=autoland&lineNumber=832
Push with failures:
https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=854e62f7f1aed9c435bceb173eba119a90dc6eba
Backout:
https://hg.mozilla.org/integration/autoland/rev/beeb07bef59ca1b3a0a8c399048728e476c5b3b7
Comment 6•5 years ago
|
||
This should fix the test failure:
diff --git a/devtools/client/webconsole/test/node/components/webconsole-wrapper.test.js b/devtools/client/webconsole/test/node/components/webconsole-wrapper.test.js
--- a/devtools/client/webconsole/test/node/components/webconsole-wrapper.test.js
+++ b/devtools/client/webconsole/test/node/components/webconsole-wrapper.test.js
@@ -22,7 +22,7 @@ const { messagesAdd } = require("devtool
async function getWebConsoleWrapper() {
const hud = {
- target: { client: {}, getFront: () => {} },
+ currentTarget: { client: {}, getFront: () => {} },
getMappedExpression: () => {},
};
const webConsoleUi = getWebConsoleUiMock(hud);
Assignee | ||
Comment 7•5 years ago
|
||
I think this is green now:
https://treeherder.mozilla.org/#/jobs?repo=try&author=apoirot%40mozilla.com&selectedJob=262741955
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1e3b87887a98 Fetch target from toolbox instead of memoizing it on console classes. r=nchevobbe https://hg.mozilla.org/integration/autoland/rev/d5edaef8eff0 Fetch toolbox from WebConsole class rather than gDevTools. r=nchevobbe https://hg.mozilla.org/integration/autoland/rev/ecdbc6266c47 Rename target to currentTarget in WebConsole codebase. r=nchevobbe,yulia
Comment 9•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/1e3b87887a98
https://hg.mozilla.org/mozilla-central/rev/d5edaef8eff0
https://hg.mozilla.org/mozilla-central/rev/ecdbc6266c47
Updated•5 years ago
|
Updated•5 years ago
|
Comment 10•4 years ago
|
||
Tracking dt-fission-m2-mvp bugs for Fission Nightly milestone (M6c)
Description
•