New issue
Advanced search Search tips

Issue 784768 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Dec 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Debugger appear to stop at incorrect positions

Project Member Reported by jensj@google.com, Nov 14 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36

Steps to reproduce the problem:
Example code:
```
<html>
  <head>
    <script>
baz();
function baz() {
  print(foo(), bar());
  return 42;
}
function foo() {
  return "foo";
}

function bar() {
  return 1 + 2 + 3 + 4;
}

function print(a, b) {
  console.log(a);
  console.log(b);
}
    </script>
  </head>
  <body>
    <h1>Hello, stepping</h1>
  </body>
</html>
```

1. Set a breakpoint on line 6 (first line in "baz")
2. Reload or whatnot so it breaks. It appears to have stopped at "print".
3. Stepping (F11) goes into "foo". Stepping further it goes back into "baz" and correctly stops on "bar".

What is the expected behavior?
Breaking on 'foo' in line 6 (i.e. line 6 column 9).

What went wrong?
It seems that the first break is always at the first code of the line, even if it is actually about to execute something else. In this case it is about to call "foo" (not "print") so it should be pointing to "foo" (line 6 column 9).

Did this work before? N/A 

Chrome version: 62.0.3202.75  Channel: stable
OS Version: 
Flash Version:
 

Comment 1 by l...@chromium.org, Nov 14 2017

Owner: kozy@chromium.org
Status: Assigned (was: Unconfirmed)
Thanks for the report.  kozy@ will know whether this is intended behavior or not.

Comment 2 by kozy@chromium.org, Dec 4 2017

Status: WontFix (was: Assigned)
JavaScript is a little trickier. At the given expression JavaScript tries to call getter print on global object first if it is defined. So we break at this position to guarantee that we do not skip this getter call.
Try following example:
<html>
  <head>
    <script>
Object.defineProperty(window, 'log', {get: () => print});
baz();
function baz() {
  log(foo(), bar());
  return 42;
}
function foo() {
  return "foo";
}

function bar() {
  return 1 + 2 + 3 + 4;
}

function print(a, b) {
  console.log(a);
  console.log(b);
}
    </script>
  </head>
  <body>
    <h1>Hello, stepping</h1>
  </body>
</html>

Sign in to add a comment