Closed Bug 1622238 Opened 6 months ago Closed 4 months ago

Inconsistent variable preview

Categories

(DevTools :: Debugger, defect, P1)

defect

Tracking

(firefox78 fixed)

RESOLVED FIXED
Firefox 78
Tracking Status
firefox78 --- fixed

People

(Reporter: Honza, Assigned: stepan)

Details

Attachments

(2 files)

Attached image image.png

STR:

The goal is to trigger BP in getExpandedNodes function in devtools/client/shared/components/tree/TreeView.js

  1. Open DevTools select the Network panel
  2. Load any page e.g. google.com
  3. Open Browser Toolbox and create BP in aforementioned file in getExpandedNodes method
  4. Select the first (any) request in the panel, BP should hit
  5. Check value of maxLevel and maxNodex

ER:
Value of both variables is consistent across the Debugger UI

AR:
Various places in the UI shows different values (actual value vs. Infinite)
Check out the screenshot for all the places.

Honza

Priority: P3 → P1

I was looking into this issue and was hoping to add more detail to the description. It seems that the value changes after hovering over the variable names in the object passed into getExpandedNodes(). It is at that point that the value of the variable is set to Infinity. I've attached a video below to describe what I mean:

https://www.loom.com/share/52ce1af69ba1410c917e5c437f96e367

@Alex J Garcia great video!

I did a quick check and it seems that the problem is because when hovering the findBestMatchExpression() in 'actions/preview.js' is getting expression string equal to "maxNodes = Infinity" from the 'symbols' object (instead of just "maxNodes"). This 'expression' string is then sent to evaluateJSAsync() in webConsoleActor which overwrites any previously set values to maxNodes.

I am not familiar with how the parser works to get symbols, so I don't know if we can make any changes there.
A very simple solution would be to remove with regex an equals sign and anything that follows from the 'expression' string before passing into evaluateInFrame() in 'actions/preview.js'.

Jason what do you think? Could it conflict with anything?

Flags: needinfo?(jlaster)

Hmm, it'd be great to look into getSymbols and try and understand why the expression is maxNodes = Infinity. This should be easy to do with a unit test.

Flags: needinfo?(jlaster)

Take a look at the tests in getSymbols.spec.js for how to come up with a small test case

Fixes incorrect 'expression' strings getting from the parse causing overwriting of values when hovering.

If an 'expression' string is in the form of "foo = value", when hovering over 'foo', that 'expression' string is sent to 'evaluateJSAsync()' in 'webConsoleActor' which overwrites any previously set values to 'foo'.

Assignee: nobody → stepanstava
Status: NEW → ASSIGNED
Pushed by jlaster@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/61d840f9bb43
Inconsistent variable preview r=jlast
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 78
You need to log in before you can comment on or make changes to this bug.