Closed Bug 1658238 Opened 4 years ago Closed 3 years ago

Show source-mapped variables in console autocomplete

Categories

(DevTools :: Console, enhancement)

Firefox 81
enhancement

Tracking

(firefox95 fixed)

RESOLVED FIXED
95 Branch
Tracking Status
firefox95 --- fixed

People

(Reporter: wartmanm, Assigned: wartmanm)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:79.0) Gecko/20100101 Firefox/79.0

Steps to reproduce:

https://wartmanm.gitlab.io/debugger-examples/minified-trivial/
Open the console, run test(), enter val

Actual results:

valueOf, values, ValidityState appear in the autocomplete popup, and function valueOf() appears in the eager-evaluation preview.

Expected results:

It would be nice if value showed up as well. I feel that it would help make source-mapped files more transparent.

I'd be happy to work on this. However, while autocompleting variable names and properties seems straightforward, eager-eval-driven property autocomplete seems much more challenging and I'm not sure how to approach it.

I'm still interested in working on this, please. I think it would be helpful even without eager eval mapping.

oh sure, sorry mattheww for the delay.
The patch on phabricator is a draft, is it ready for review or are you blocked on something? How can I help?

Assignee: nobody → wartmanm
Flags: needinfo?(wartmanm)

No worries! I didn't want the patch to show up in anyone's review queue before the feature request was accepted, and I wasn't sure whether to even attempt eager eval mapping. I rebased it and fixed the eslint errors, and it should be ready now.

Flags: needinfo?(wartmanm)

(In reply to mattheww from comment #5)

No worries! I didn't want the patch to show up in anyone's review queue before the feature request was accepted, and I wasn't sure whether to even attempt eager eval mapping. I rebased it and fixed the eslint errors, and it should be ready now.

I think this would be a nice thing to have, especially since we already map variables at execution time

Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Sounds good, but I think I will need some advice on how to proceed.
Right now, expression mapping is only available on the client, and only works if there are no syntax errors, but the analyzeInputString method to turn console input into valid javascript expressions is only available on the server. Both of them are big enough that I don't really want to try and replicate them on the other side.
I could avoid this problem and instead count on bracket matching to provide a valid string most of the time. But, without knowing what expression was evaluated, I can't convert an unsafe getter path back to an original expression. (Multiple original variables can map to one generated variable, or to a path containing unsafe getters.)
I could add a method to ask the server to get the expression to evaluate, but I don't know how much latency it could add. Should it be a last resort after finding an unsafe getter, or done before mapping?

Please disregard all of that, I saw that js-property-provider.js was exclusively used on the server, but overlooked that it's in the shared folder. I've updated the review to handle eager evaluation and unsafe getters. I'm still not entirely comfortable calling something that makes use of a timeout twice, but it works!

Attachment #9170095 - Attachment description: Bug 1658238 - Autocomplete source-mapped variable names → Bug 1658238 - Autocomplete source-mapped variable names r=nchevobbe
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6149555d9efa
Autocomplete source-mapped variable names r=nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: