Closed Bug 1928824 Opened 8 months ago Closed 4 months ago

The debugger doesn't always move the source view to the break point when it's hit

Categories

(DevTools :: Debugger, defect, P2)

defect

Tracking

(firefox138 fixed)

RESOLVED FIXED
138 Branch
Tracking Status
firefox138 --- fixed

People

(Reporter: jrmuizel, Assigned: ochameau)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

I think it's often on the first breakpoint hit on during page load. The debugger won't automatically show the currently hit breakpoint and it requires clicking on the stack frame in the stack window to go there.

I've never noticed this behaviour in Chrome.

See Also: → 1926486

Alex is seeing a similar intermittent issue where the Debugger doesn't scroll the source to the paused line

Severity: -- → S3
Priority: -- → P2
See Also: 1926486
Flags: needinfo?(hmanilla)
Assignee: nobody → hmanilla
Flags: needinfo?(hmanilla)

I reproduced against lemonde.fr, by pausing on next interruption and pretty printed the two possible scripts.
If you have simpler or different STR let me know as they may be different race conditions.

There seems to be a race condition between the pretty printing of the pause source and the selection of the paused frame.

When we pause, we immediately select the location of the frame, in the bundle/generated source (i.e. non-pretty printed):
https://searchfox.org/mozilla-central/rev/a4935c8cb9edb35981871dee4a9132ab3e77d92b/devtools/client/debugger/src/actions/pause/paused.js#53
In this action, we do detect it was a pretty printed source and start creating the pretty printed source:
https://searchfox.org/mozilla-central/rev/a4935c8cb9edb35981871dee4a9132ab3e77d92b/devtools/client/debugger/src/actions/sources/select.js#174
Within the process of creating the pretty printed source, we have some logic to maintain the currently selected location from the non-pretty printed to pretty printed location, over here:
https://searchfox.org/mozilla-central/rev/a4935c8cb9edb35981871dee4a9132ab3e77d92b/devtools/client/debugger/src/actions/sources/prettyPrint.js#246-262
But at this point in time, the actual selected location hasn't updated yet and is the one before the pause.
So that we select the top of the pretty printed source.
We then continue the execution of selectLocation action, but bail out as the selected location changed by the pretty print creation action...
https://searchfox.org/mozilla-central/rev/a4935c8cb9edb35981871dee4a9132ab3e77d92b/devtools/client/debugger/src/actions/sources/select.js#261-264

All these async work is really complex to compose against each other, I faced similar challenges in bug 980022.
We might want/have to simplify select and pretty print actions, somehow.

Bug 1493094 is for when the source is empty in same cases.

(In reply to Alexandre Poirot [:ochameau] from comment #3)

Bug 1493094 is for when the source is empty in same cases.

I think this probably meant to be Bug 1926486, which is fixed

Reproduced again by Jeff while debugging https://qlover.jp/

I found a couple of reason why the scroll wouldn't work while investigating test failures in bug 1938418.
I'll submit a couple of fixes.

Assignee: hmanilla → poirot.alex

Adding a new test to extensively cover isScrolledPositionVisible behavior,
while doing strong assertion on the behavior of scroll on pause.

Also tweak isScrolledPositionVisible and scrollEditorIntoView test function to receive 1-based lines.
Many usages passed 1-based lines and could possibly have an unexpected -1 shift.

Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c9dc0e10e7f1 [devtools] Fix CodeMirror 6 helper checking for lines being in the viewport. r=devtools-reviewers,bomsy
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch
Blocks: 1953394
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: