Closed Bug 1815472 Opened 3 years ago Closed 2 years ago

Debugger tooltip displays wrong value when there is line wrapping

Categories

(DevTools :: Debugger, defect, P3)

defect

Tracking

(firefox120 fixed, firefox121 fixed)

RESOLVED FIXED
121 Branch
Tracking Status
firefox120 --- fixed
firefox121 --- fixed

People

(Reporter: Oriol, Assigned: bomsy)

References

(Blocks 1 open bug)

Details

Attachments

(5 files, 1 obsolete file)

Attached file testcase —
  1. In about:config, set devtools.debugger.ui.editor-wrapping = true.
  2. Open the attached testcase with the debugger open
  3. Find this line: isNaN(cs1, cs2);. The debugger should show some information:
    cs1: CSS2Properties(354) { "accent-color" → "auto", "align-content" → "normal", "align-items" → "normal", … } cs2: CSS2Properties(354) { "accent-color" → "auto", "align-content" → "normal", "align-items" → "normal", … }
    
  4. Ensure that information appears on the line below isNaN(cs1, cs2);. If you have a wide screen and it fits on the same line, shrink your browser window or resize the debugger sidebars.
  5. Hover hoverMe

Expected: you see NaN
Actual: you see

prop: 0
<prototype>: Object { … }
Attached image Screenshot —

Thanks for reporting i can reproduce the issue.

Also for me myObject is NaN when it shouldn't be. See the second screenshot attached.

Blocks: debugger-tooltips
No longer blocks: dbg-inline-preview
Severity: -- → S3
Priority: -- → P3

FYI this is an annoying behavior when the window of the debugger is too small, which is exactly the case for the default window size. Most of the lines are wrapped in my case when I'm trying to debug code from /remote/.

Changes in this patch

  • Rename the token-events.js => token.js
  • Unify all the token realted utils into token.js
  • Remove other token util related files
  • Remove not really useful jest test get-token-location.spec.js as this is already covered by preview related mochitests
Assignee: nobody → hmanilla
Status: NEW → ASSIGNED
See Also: → 1757277
Attachment #9340917 - Attachment description: Bug 1815472 - [devtools] Consider wrapping when calculate the line/column from dom element coordinates r=#devtools-reviewers → Bug 1815472 - [devtools] Disable inline-previews when editor wrapping is r=#devtools-reviewers

Hi Bomsy, do you have an update for us? Is it something you could fix or is it blocked by some dependency not yet listed on this bug? Thanks.

Flags: needinfo?(hmanilla)

There's an issue in a CodeMirror method which doesn't look trivial to fix (see https://phabricator.services.mozilla.com/D181962#6054336)
I did attempt to fix this but it failed through the cracks, I'll try to resume that work

Flags: needinfo?(hmanilla)

In getTokenLocation, the call to coordsChar needed an extra parameter so the
coordinates are relative to the top left corner fo the currently visible window.
We were passing the center of the bounding client rect to getTokenLocation, but
a token could wrap and have it's bounding rect center not being on the token.
To fix this we're passing the center of the first box quads of the token.

The inline preview widgets were causing some troubles on CodeMirror internal
state too. Since we're using React to populate the bookmark we set on the line,
and given that React.render is asynchronous, we were setting an empty element
as a bookmark on the editor, which React populates later. But CodeMirror probably
update its internal state when the bookmark is added, so that was causing wrong
computation later.
To avoid that, we only set the bookmark once React actually rendered the element
in the DOM.

We add a test to cover this, and also modify test helpers so we would query
the DOM instead of relying on CodeMirror methods.

Depends on D181960

Attachment #9340917 - Attachment is obsolete: true
Pushed by hmanilla@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/930888998f68 [devtools] Cleanup and use utility file for tokens r=devtools-reviewers,nchevobbe
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/04e0ba20153f [devtools] Fix variable tooltip when location is impacted by inline preview or wrapping. r=devtools-reviewers,bomsy.
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 120 Branch
Status: RESOLVED → REOPENED
Flags: needinfo?(hmanilla)
Resolution: FIXED → ---
Target Milestone: 120 Branch → ---
Backout by nbeleuzu@mozilla.com: https://hg.mozilla.org/mozilla-central/rev/c85ad51385ad Backed out changeset 04e0ba20153f for dt failure on browser_dbg-preview.js
Flags: needinfo?(hmanilla)
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/64122f08423f [devtools] Fix variable tooltip when location is impacted by inline preview or wrapping. r=devtools-reviewers,bomsy.
Regressions: 1860639
Status: REOPENED → RESOLVED
Closed: 2 years ago → 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch

The patch landed in nightly and beta is affected.
:bomsy, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval. Also, don't forget to request an uplift for the patches in the regression caused by this fix.
  • If no, please set status-firefox120 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(hmanilla)

Comment on attachment 9357027 [details]
Bug 1815472 - [devtools] Fix variable tooltip when location is impacted by inline preview or wrapping. r=#devtools-reviewers.

Beta/Release Uplift Approval Request

  • User impact if declined: Developer debugging webpages will see wrong values in the preview tooltip, when inline-preview is enabled and the line is wrapped.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Devtools JS code fix mainly related to the tooltip display, should be low risk
  • String changes made/needed:
  • Is Android affected?: No
Flags: needinfo?(hmanilla)
Attachment #9357027 - Flags: approval-mozilla-beta?
Attachment #9340915 - Flags: approval-mozilla-beta?

Comment on attachment 9340915 [details]
Bug 1815472 - [devtools] Cleanup and use utility file for tokens r=#devtools-reviewers

This patch already landed in fx120 during the nightly cycle

Attachment #9340915 - Flags: approval-mozilla-beta? → approval-mozilla-beta-

Comment on attachment 9357027 [details]
Bug 1815472 - [devtools] Fix variable tooltip when location is impacted by inline preview or wrapping. r=#devtools-reviewers.

Waiting on issue with bug 1860639 before uplifting

Attachment #9357027 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9357027 - Flags: approval-mozilla-beta+ → approval-mozilla-beta?

Comment on attachment 9357027 [details]
Bug 1815472 - [devtools] Fix variable tooltip when location is impacted by inline preview or wrapping. r=#devtools-reviewers.

Approved for 120.0b3

Attachment #9357027 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Duplicate of this bug: 1757277
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: