Bug 161660 - Web Inspector: Stepping through code should point to the next thing that will execute and not skip function calls that can be stepped into
Summary: Web Inspector: Stepping through code should point to the next thing that will...
Status: RESOLVED DUPLICATE of bug 161658
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-09-06 17:22 PDT by Joseph Pecoraro
Modified: 2016-09-30 17:58 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-09-06 17:22:22 PDT
Summary:
Stepping through code should point to the next thing that will execute.

Test:
1. <script>
2. function foo(a, b) { return a + b; }
3. function a() { return 1; }
4. function b() { return 2; }
5. var x = 1;
6. foo(
7.   a(),
8.   b()
9. );

Steps to Reproduce:
1. Inspect test page
2. Set a breakpoint on line 5
3. Reload
  => Pause on breakpoint
4. Step through the code (step-over)
  => Can be confusing what is about to execute

Notes:
When stepping through code in different debugger environments we get different behavior:

  - WebKit: will stop at lines [5, 6] => "x = 1", "foo(...)"
  - Chrome: will stop at lines [5, 6] => "x = 1", "foo(...)"
  - Firefox: still stop at lines [5, 6, 7, 8, 6] => "x = 1", "foo(...)", "a()", "b()", "foo(...)"
  - lldb: would stop at lines [5, 7, 8, 6] => "x = 1", "a()", "b()", "foo(...)"

I think the lldb approach makes the most sense. It is the smartest. In WebKit/Chrome you may not realize that you could step into "a()" or "b()". In lldb it is very clear that those will execute and you are given the opportunity to step over or into them. Firefox is close, but it is unclear what the first stop on line 6 mean given the stop at 7 and 8 happen before returning to and really executing line 6.

Proposed stepping locations:

  - Proposed stop at lines [5, 7, 8, 6] => "x = 1", "a()", "b()", "foo(...)"

Reasoning:

  - Stop at any location where the developer should be offered the choice to step over or into
    - this means function calls in execution order. foo(a(), b()) stops first at a(), then b(), then foo()
Comment 1 Radar WebKit Bug Importer 2016-09-06 17:22:51 PDT
<rdar://problem/28181548>
Comment 2 Joseph Pecoraro 2016-09-30 17:58:08 PDT
Fixed by Bug 161658.

*** This bug has been marked as a duplicate of bug 161658 ***