Debugger step functions are sensitive to whitespace

NEW
Unassigned

Status

--
enhancement
4 years ago
4 months ago

People

(Reporter: callahad, Unassigned)

Tracking

Trunk

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
If you set a breakpoint on the first line of foo(), then click "step in" on each line, the debugger takes a different number of steps to reach the bar() function depending on whitespace in the function arguments.

    function foo() {
      var a = bar('one step to bar', { foo: 1, bar: 2, baz: { qux: true } });

      var b = bar('three steps to bar', {
        foo: 1, bar: 2, baz: { qux: true }
      });

      var c = bar('four steps to bar', {
        foo: 1, bar: 2, baz: {
          qux: true
        }
      });
    }

    function bar(subject, opts) {
      return true;
    }

I find this somewhat confusing and unintuitive -- the code is syntactically identical, but the debugger behaves different in each case.
(Reporter)

Comment 1

4 years ago
For easy testing, the above code can be found at http://people.mozilla.org/~dcallahan/tmp/bug1145747.html

Updated

a year ago
See Also: → bug 1370641

Comment 2

a year ago
In essence the idea here would be either to column-step through the arguments,
or not to emit line notes for the arguments.

I'm not sure where I come down on this.  For "obvious" arguments, there seems to
be no point in stepping through them -- it's not as though one can inspect the
intermediate values created while stepping anyway.

Abstractly my preferred approach to line-notes would be to emit them at user-visible
spots only, and not for intermediate calculations.

However, an otherwise innocuous-looking intermediate expression might involve
a getter or other non-obvious behavior, and this isn't generally known
during bytecode emission, and one might want to be made aware of this
while stepping.

Updated

4 months ago
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.