Closed Bug 1714508 Opened 3 years ago Closed 3 years ago

Use DOCUMENT_EVENT's will-navigate event to track navigation in Debugger

Categories

(DevTools :: Debugger, enhancement, P2)

enhancement

Tracking

(Fission Milestone:M8, firefox91 fixed)

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

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

Attachments

(2 files)

Today, the debugger contains a hack to fake a willNavigate from onTargetAvailable in case of target-switching, as we may miss it when navigating to another process/origin:
https://searchfox.org/mozilla-central/source/devtools/client/debugger/src/client/firefox.js#103-108

But:

  1. This isn't ideal, as will-navigate is supposed to fire a bit earlier, before the target even exists. It is probably better to use DOCUMENT_EVENT will-navigate so that we avoid any race. We especially shouldn't clear too late. Clearing on target-available should be fine. But just to be safe, doing it earlier would be extra safe!

  2. The call to actions.willNavigate is redundant with the call to actions.connect
    https://searchfox.org/mozilla-central/source/devtools/client/debugger/src/client/firefox.js#134-138
    And on top of that, connect is called after a couple of async operation, which is a significant source of troubles during target switching as we reset things too late, after some sources are being processed and after some breakpoint are being hit ://

=> We should do two things: migrate to DOCUMENT_EVENT and stop calling connect from target-available.

connect and willNavigate actions are redundant, except for the isWebExtension argument.
And calling connect late, after a few async code make us reset redux state way too late.
Some sources/breakpoints could be processed before and we end up having confusing state.

Clearing debugger state from onTargetAvaible should be fine,
as soon as we do it immediately.
But doing it from DOCUMENT_EVENT will-navigate may help
if we get some debugger related resources while the target is still attaching on the client.
It should better ensure that state is cleared at the right time, the earliest right time.

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P2
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9e47eca0c22e
[devtools] Call Debugger `connect` action only once. r=nchevobbe,bomsy
https://hg.mozilla.org/integration/autoland/rev/83a5ecde6f6f
[devtools] Use DOCUMENT_EVENT will-navigate in debugger. r=nchevobbe,bomsy
Fission Milestone: --- → M8
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: