Closed Bug 1134798 Opened 6 years ago Closed 10 months ago

Correct line isn't jumped to when clicking the line for a pretty printed source

Categories

(DevTools :: Debugger, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bgrins, Unassigned)

References

(Blocks 2 open bugs)

Details

After I pretty print a source, I'd like to clicking on the line number to jump to the correct line number in the debugger.

STR:

Open http://bgrins.github.io/devtools-demos/debugger/scripts.html
Start profiling
Stop profiling
Click on "JavaScript" tab
Click on one of the jquery-2.1.3.min.js lines (takes you to debugger panel)
Stop blackboxing the source
Pretty print source

At this point the cursor should move to the correct line.  At the least, if I flip back to the performance tool and click on the same line number again it should open to the correct place.
Not specifically blocking v2.
No longer blocks: perf-tool-v2
I suspect this is a debugger issue, as any tool trying to select a line in the debugger will run into this (profiler data, console logs, etc just have the original line number). Adding a method in Debugger (highlightLine()?) that takes a url and line, if pretty printed convert the number to the new line position, and then select that line on the Editor instance.

Not sure of pretty print provides mappings of line positions?

If this happens, we'll have to update shared/source-utils.js as well to use this method (from bug 1134778)
Blocks: 1153412
Component: Developer Tools: Performance Tools (Profiler/Timeline) → Developer Tools: Debugger
(In reply to Jordan Santell [:jsantell] [@jsantell] from comment #2)
> I suspect this is a debugger issue, as any tool trying to select a line in
> the debugger will run into this (profiler data, console logs, etc just have
> the original line number).

Hm, we may be seeing the same thing in Bug 1045237 then.

> Adding a method in Debugger (highlightLine()?)
> that takes a url and line, if pretty printed convert the number to the new
> line position, and then select that line on the Editor instance.

From what I understand, doing that conversion may be related to source map support in the web console (Bug 670002).
See Also: → 670002, 1045237
Yeah, guessing bug 1045237 is a similar issue.

I don't think bug 670002 is related, as the debugger should be able to handle mapping to a line regardless. Any tool that wants to link to the debugger shouldn't have to deal with source maps, and a scenario can occur where you have a link to a minified file, subsequently pretty print it, and that original link should still work. Imagining a method on the debugger:

Debugger.selectLine(line, { isSourceMap })
See Also: → 1179820
Duplicate of this bug: 1322927
Product: Firefox → DevTools

Should I report a separate bug for the same issue with CSS pretty-printing? When I jump from element inspector to Style Editor, it always jumps to line 1, even if aautomatic reformatting puts the relevant CSS rule on a different line.

sure

Priority: -- → P2

Simpler STR:

  1. Open https://debugger-pretty-print-events-1532240.glitch.me/
  2. Click console reference Added click handler compressed.js:17:28 … opens Debugger
  3. Pretty-print file

AR: First line is highlighted
ER: Line with console.log is focused

Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.