New issue
Advanced search Search tips

Issue 714145 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Debugger cannot access function parameters

Reported by nicolas....@gmail.com, Apr 21 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36

Steps to reproduce the problem:
1. Write a function with parameters
2. Write a "debugger;" statement in the function
3. 

What is the expected behavior?
When the breakpoint is reached, function parameters should be accessible.

What went wrong?
Trying to access the function parameters (which technically are accessible to the function's scope) returns a "Reference Error", as if the function had no such parameter.

Did this work before? N/A 

Chrome version: 57.0.2987.133  Channel: stable
OS Version: 10.0
Flash Version: 

Note that if I change the function in the screenshot to:

scope.getChildren = function() {
   scope;
   debugger;
}

The "scope" variable becomes available when the breakpoint is reached.
 
debuggerproblem.png
141 KB View Download
Also note that this broken behavior seems to be random, it doesn't always fail.

Comment 2 by caseq@chromium.org, Apr 23 2017

Cc: caseq@chromium.org
Components: -Platform>DevTools Platform>DevTools>JavaScript
Status: WontFix (was: Unconfirmed)
This looks as "by design" to me -- the variable you're trying to access is a parameter of an outer function and does not become part of the inner function's closure as it is not being used. When it becomes used in the inner function, you can actually see its value.
Shouldn't the behavior be the same for window (global) variables which aren't part of the inner function eather then?


Also, this works as expected on Safari and Firefox's debuggers, as you can see: it's possible to see i's value without actually using it:


safaridebug.png
80.3 KB View Download

Comment 4 by caseq@chromium.org, Apr 28 2017

Note your Safari example is actually different from the original in that the inner function is invoked from within the outer function, i.e. while the outer function is still on the stack. In the original case, the inner function is returned and invoked from outside of the outer function, at the moment when the outer function's frame is not on the stack, so the variable you're trying to inspect is not there. Variables on the global object have different life time from the local variables and function parameters, so these won't be part of the closure and will be just accessed directly on the global object -- so this _should_ work.

Sign in to add a comment