Closed Bug 1373632 Opened 3 years ago Closed Last year

"Step out" steps to the end of the calling function when debugging minified scripts with client-side source-maps

Categories

(DevTools :: Debugger, defect, P2)

55 Branch
defect

Tracking

(firefox57 fix-optional)

RESOLVED FIXED
Tracking Status
firefox57 --- fix-optional

People

(Reporter: hbenl, Unassigned)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

822 bytes, application/zip
Details
Attached file test-case.zip
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0
Build ID: 20170613235745

Steps to reproduce:

Steps to reproduce:
- enable the new debugger front-end (so that we use client-side source-maps - this is not an issue with the front-end though!)
- open index.html from the attached zip file
- open the debugger
- set a breakpoint in line 3 of "test.js" (not "test.min.js")
- enter "test()" in the console -> the debugger stops at the breakpoint
- press "Step In" and then press "Step Out" twice to step out of the "square()" function

Here's the original source "test.js" of the script in the attached test-case:

function test() {
  var n = 2;
  n = square(n);
  n = square(n);
  n = square(n);
  n = square(n);
  return n;
}
function square(x) {
  return x * x;
}



Actual results:

The debugger stops at line 7 (the last line of the "test()" function), the variable "n" is set to 65536


Expected results:

The debugger stops at line 4, the variable "n" is set to 4
This is the result I get with the old debugger front-end and it's also the result in the new front-end when I use the original instead of the minified source.
I did some experiments to track down the source of the issue and got the impression that "Step Out" will always try to stop at the next line after the function call.
In general this behaviour is (more or less) OK, because most javascript code does not contain more than one statement per line.
But minified code puts *all* statements on one line, so there is no "next line" to stop at.
With server-side source-maps this is not an issue because the debugger will stop at the next line in the original source, but with client-side source-maps the debugger will stop at the next line in the generated source.

Note that this makes the new debugger front-end almost unusable with minified scripts.
There's another situation where this behaviour is problematic: if the code contains a statement like "f(g())" and you want to step in to function "f". See https://bugzilla.mozilla.org/show_bug.cgi?id=1172572.
Component: Untriaged → Developer Tools: Debugger
I suspect this is another bug that would be solved by moving to column stepping.
Blocks: source-maps
Priority: -- → P2
Product: Firefox → DevTools

This now works for me.

Status: UNCONFIRMED → RESOLVED
Closed: Last year
Resolution: --- → FIXED

I just retested this with FF 66.0b3 (on Windows 10 and Arch Linux 64 bit) and sometimes it works and sometimes I get the old (broken) behavior...

Blocks: dbg-control
No longer blocks: dbg-stepping
Blocks: dbg-stepping

FYI: in 67.0b5 it works reliably for me as well.

You need to log in before you can comment on or make changes to this bug.