New issue
Advanced search Search tips

Issue 905220 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 900644
Owner: ----
Closed: Nov 15
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Context is not correct inside of an arrow function

Reported by alejandr...@gapps.fi, Nov 14

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36

Steps to reproduce the problem:
1. Download the react project from here: https://github.com/lopezvit/react_tutorial It is very simple because it comes form a tutorial
2. Execute it with npm install && npm start (needs node installed)

3. When the browser window opens, open the devTools and delete one of the counters by pressing the "Delete" button.

4. When the debugger stops in the line with the debugger instruction, check the value of this.state: The debugger returns undefined, because the context is wrong, this is pointing to a different object.

5. You can move a couple of lines forward to see that the line gets executed perfectly, but if one were to trust the debugger, it should give an exception.

What is the expected behavior?
The debugger should interpret the correct behaviour of the arrow functions inside of classes.

What went wrong?
The debugger doesn't get the correct context, changing the value of the "this" object inside of the arrow function.

Did this work before? N/A 

Chrome version: 70.0.3538.77  Channel: n/a
OS Version: OS X 10.14.1
Flash Version: 

I have attached an image on how it looks when you put the mouse the way that I describe in the steps to reproduce.
 
Chrome dev tools bug.png
506 KB View Download
I just realized that there is already a bug with a related case. Didn't see it before creating the issue:
https://bugs.chromium.org/p/chromium/issues/detail?id=900644

Labels: Needs-Triage-M70
Cc: swarnasree.mukkala@chromium.org
Labels: Triaged-ET
Mergedinto: 900644
Status: Duplicate (was: Unconfirmed)
Thanks for filing the issue..

As per comment#1 duping the issue into issue id: 900644 and marking it as a duplicate.

Please feel free to undupe if it is not the case.

Sign in to add a comment