Closed Bug 1478665 Opened 6 years ago Closed 5 years ago

Custom element links to Debugger should favor pretty-printed file if it exists

Categories

(DevTools :: Inspector, enhancement, P3)

enhancement

Tracking

(firefox72 fixed)

RESOLVED FIXED
Firefox 72
Tracking Status
firefox72 --- fixed

People

(Reporter: Harald, Assigned: wartmanm)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

STR:
- Open https://www.vox.com/platform/amp/science-and-health/2017/7/25/16019892/solar-eclipse-2017-interactive-map
- Open Inspector
- Click one of the many [custom…] badges
- Pretty-print the file (right-click tab header)
- Back to Inspector, click [custom…] again

AR: Jumps to minified version
ER: Jumps to pretty version

Console does this correctly for log sources.
Severity: normal → enhancement
Priority: -- → P3
How hard is this to wire up, Julian? Existing source links in Console and Inspector (events) do this correctly and we tend to underestimate how many devs depend on pretty print.
Flags: needinfo?(jdescottes)
Not sure, it seems related to using the sourcemap service in order to get the URLs. 

I think pretty printing started notifying console and others in https://hg.mozilla.org/mozilla-central/rev/05569ef2d175
We would need similar logic on our side.

Can't dig much further at the moment, maybe Nicolas can tell us if this is a big task or not.
Flags: needinfo?(jdescottes) → needinfo?(nchevobbe)
Blocks: source-maps
The button's callback is here:
https://dxr.mozilla.org/mozilla-central/source/devtools/client/inspector/inspector.js#2089-2091

The location here just comes directly from the actor:
https://dxr.mozilla.org/mozilla-central/source/devtools/shared/fronts/node.js#322-324

So I think what you want to do is change the button callback to
pass the location through the "source map URL service", in particular
the `originalPositionFor` method, docs here:
https://dxr.mozilla.org/mozilla-central/source/devtools/client/framework/source-map-url-service.js#183-197

The source map URL service is available on the toolbox.
https://dxr.mozilla.org/mozilla-central/source/devtools/client/framework/toolbox.js#694-701


Right now, hovering in the markup view doesn't show the location of the custom element.
However, if you wanted it to, then instead of `originalPositionFor`, you would want to use
the source map URL service to subscribe to changes to the location.
But, if you plan to leave the tooltip as-is, then you needn't bother.

The hardest part of this task is (as usual...) writing the test case.
No longer blocks: devtools-webcomponents
I think we have the same issue in the console with the "jump to definition" button: we don't jump to the generated location.
Flags: needinfo?(nchevobbe)
Hi Harald, after doing the triage version we are not confident that this could be fixed in 64. We think that the bugs listed here  should be addressed first https://bugzilla.mozilla.org/show_bug.cgi?id=1484272 . Are you OK with moving this bug back to the global webcomponents backlog?
Flags: needinfo?(hkirschner)
That is fine, this is affects other places. Debugger is also working on pretty print in 65, so this work might be affected by adding auto-prettyprint and should probably wait.
Flags: needinfo?(hkirschner)

Assigning to :mattheww, thanks for submitting a patch!

Assignee: nobody → wartmanm
Status: NEW → ASSIGNED
Attachment #9103148 - Attachment description: Follow source maps when viewing custom element definition → Bug 1478665 - Follow source maps when viewing custom element definition
Pushed by nbeleuzu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5d2e52a68c0e
Follow source maps when viewing custom element definition r=jdescottes
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 72
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: