Closed Bug 1145752 Opened 5 years ago Closed 3 months ago

Difficult to anticipate where debugger step functions will step to

Categories

(DevTools :: Debugger, enhancement, P5)

x86
macOS
enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: callahad, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Try stepping through the following code. Can you guess where you'll end up each time you click Step In?

    function foo() {
      return a() ? b() ? c() : d() ? e() : f() && g() : h();
    }

    function a() { return Math.random() >= 0.5; }
    function b() { return Math.random() >= 0.5; }
    function c() { return Math.random() >= 0.5; }
    function d() { return Math.random() >= 0.5; }
    function e() { return Math.random() >= 0.5; }
    function f() { return Math.random() >= 0.5; }
    function g() { return Math.random() >= 0.5; }
    function h() { return Math.random() >= 0.5; }

The tools should help me with this.

This is not completely contrived; I had to wade through a ternary with identical structure when tracking down Bug 1143857. Proof at 4:15 in https://www.youtube.com/watch?v=PUgRMRQoTq4&t=4m15s
For easy testing, the above code can be found at http://people.mozilla.org/~dcallahan/tmp/bug1145752.html
I hope Firefox debugger one day will highlight the statement it's at. Chrome devtools does this very well.

(If it's any consolation, IE's devtools are on par with us and old Opera Dragonfly was even worse than Firefox devtools on this test case..)
See Also: → 1363325, 1370655
Product: Firefox → DevTools
Blocks: dbg-control
Type: defect → enhancement
Priority: -- → P5
  1. we now have better stepping
  2. we now have a better highlighter

Let me know if we're missing anything here

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