Closed
Bug 1373632
Opened 7 years ago
Closed 6 years ago
"Step out" steps to the end of the calling function when debugging minified scripts with client-side source-maps
Categories
(DevTools :: Debugger, defect, P2)
Tracking
(firefox57 fix-optional)
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
firefox57 | --- | fix-optional |
People
(Reporter: hbenl, Unassigned)
References
(Blocks 2 open bugs)
Details
Attachments
(1 file)
(deleted),
application/zip
|
Details |
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.
Updated•7 years ago
|
Component: Untriaged → Developer Tools: Debugger
Comment 3•7 years ago
|
||
I suspect this is another bug that would be solved by moving to column stepping.
Blocks: source-maps
Updated•7 years ago
|
status-firefox57:
--- → fix-optional
Priority: -- → P2
Updated•6 years ago
|
Product: Firefox → DevTools
Comment 4•6 years ago
|
||
This now works for me.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Blocks: dbg-stepping
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...
Updated•6 years ago
|
Updated•6 years ago
|
Blocks: dbg-stepping
You need to log in
before you can comment on or make changes to this bug.
Description
•