Closed Bug 1702511 Opened 2 years ago Closed 2 years ago

Ensure that console is cleared when doing a server side top level target switch

Categories

(DevTools :: Console, defect, P2)

defect

Tracking

(Fission Milestone:M8, firefox91 fixed)

RESOLVED FIXED
91 Branch
Fission Milestone M8
Tracking Status
firefox91 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

(Blocks 1 open bug)

Details

(Whiteboard: dt-fission-m3-mvp)

Attachments

(6 files, 4 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

Once bug 1694651 is landed, you can toggle devtools.target-switching.server.enabled to true and when navigating between two distinct origins, with fission enabled, you will see that the console is no longer cleared, even if persists log is off.

It comes from this code:
https://searchfox.org/mozilla-central/source/devtools/client/webconsole/webconsole-connection-proxy.js#161-174
which only tries to clear the console when will-navigate is fired.
Unfortunately, server side target swiching breaks will-navigate.

We should probably follow StyleEditor example, and instead of listening to will-navigate, we would listen to:

Fission Milestone: --- → M8
Whiteboard: dt-fission-m3-triage → dt-fission-m3-mvp
Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED
Depends on: 1704805
Depends on: 1704806
Depends on: 1704811
Severity: -- → S3
Priority: -- → P2

That's to ensure clearing the panels sooner than later.
A few tests depend on this. Without that, "navigate" event,
which isn't throttled, fires before dom-loading.
That ends up being a logic issue in the console code.

About browser_jsterm_autocomplete_getters_cache, we weren't correctly waiting
for popup to close because of the reload. Instead we probably worked around intermittents
by closing the popup explicitly before the reload.
But that creates other issue, where the reload may close the popup after we do Ctrl+Space.

Surprisingly, there is no issue with ResourceWatcher cache,
but only with the WebConsoleWrapper which gets its inner cache purged.

Attachment #9216156 - Attachment description: Bug 1702511 - Avoid removing the navigation request on navigation in console batch registry. → Bug 1702511 - [devtools] Avoid removing the navigation request on navigation in console batch registry.
Attachment #9216155 - Attachment description: Bug 1702511 - Clear console messages when doing a navigation across processes. → Bug 1702511 - [devtools] Clear console messages when doing a navigation across processes.
Attachment #9216154 - Attachment description: Bug 1702511 - Flush resources when receiving the dom-loading event. → Bug 1702511 - [devtools] Flush resources when receiving the dom-loading event.

I'll actually fix this via bug 1706995, which is a quick workaround until we can really revisit "will-navigate" event.
And keep this bug to provide a good test for this.

Depends on: 1706995
Attachment #9216155 - Attachment description: Bug 1702511 - [devtools] Clear console messages when doing a navigation across processes. → Bug 1702511 - [devtools] Cover console persist feature with cross process navigation.
Depends on: 1712567

Comment on attachment 9216155 [details]
Bug 1702511 - [devtools] Cover console persist feature with cross process navigation.

Revision D112231 was moved to bug 1712567. Setting attachment 9216155 [details] to obsolete.

Attachment #9216155 - Attachment is obsolete: true
Blocks: 1712591
Depends on: 1712592

Comment on attachment 9217365 [details]
Bug 1702511 - [devtools] Implement DOCUMENT_EVENT's will-navigate in order to replace target actor's will-navigate.

Revision D112922 was moved to bug 1712592. Setting attachment 9217365 [details] to obsolete.

Attachment #9217365 - Attachment is obsolete: true
Attachment #9216154 - Attachment description: Bug 1702511 - [devtools] Flush resources when receiving the dom-loading event. → Bug 1702511 - [devtools] Flush resources when receiving the will-navigate event.

Note that the timestamp being set in WebConsoleWrapper is overriding the one passed from will-navigate
and ends up being wrong and too late.

The following changeset, migrating from target's will-navigate events
to DOCUMENT_EVENT resources, triggers some action dispatch while calling
_attachTargets. i.e. Some dispatch* methods of WebConsoleWrapper get called.
But as it wasn't initialized yet, it was throwing.

Blocks: 1713607
Blocks: 1713643

Comment on attachment 9224236 [details]
Bug 1702511 - [devtools] Use DOCUMENT_EVENT will-navigate in ResourceCommand to prune its cache.

Revision D116345 was moved to bug 1713643. Setting attachment 9224236 [details] to obsolete.

Attachment #9224236 - Attachment is obsolete: true
Blocks: 1713670

Comment on attachment 9224249 [details]
Bug 1702511 - [devtools] Tweak browser_navigateEvents.js to cover both target navigate events and DOCUMENT_EVENT resources.

Revision D116358 was moved to bug 1713670. Setting attachment 9224249 [details] to obsolete.

Attachment #9224249 - Attachment is obsolete: true
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a4562f19df54
[devtools] Add backward compat code for DOCUMENT_EVENT will-navigate events. r=jdescottes,nchevobbe
https://hg.mozilla.org/integration/autoland/rev/8967dc205c21
[devtools] Flush resources when receiving the will-navigate event. r=jdescottes,nchevobbe
https://hg.mozilla.org/integration/autoland/rev/90d2e0a0ead6
[devtools] Init WebConsoleWrapper before watching for console resources. r=nchevobbe
https://hg.mozilla.org/integration/autoland/rev/3e18373a945f
[devtools] Clear console messages when doing a navigation across processes. r=jdescottes,nchevobbe
https://hg.mozilla.org/integration/autoland/rev/1a4738901acf
[devtools] Expose isNavigationRequest on NETWORK_EVENT to highlight request done for top level document navigation. r=jdescottes,nchevobbe,bomsy
https://hg.mozilla.org/integration/autoland/rev/f7988048b5d7
[devtools] Avoid removing the navigation request on navigation in console batch registry. r=jdescottes,nchevobbe
Regressions: 1713806
You need to log in before you can comment on or make changes to this bug.