New issue
Advanced search Search tips

Issue 900644 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 1
Type: Bug



Sign in to add a comment

Can't resolve "this" pointer in DevTools

Project Member Reported by kbr@chromium.org, Oct 31

Issue description

Chromium	72.0.3597.0 (Developer Build) (32-bit) 
Revision	d2896e776895c7f89af2239019676859c5ae8686-refs/heads/master@{#604072}
OS: Windows 10

What steps will reproduce the problem?
(1) Navigate to https://s3-eu-west-1.amazonaws.com/bug-demo/google.html (from  Issue 894021 )
(2) Open DevTools
(3) Go to Sources tab
(4) Navigate to the following path (see attached screenshot):
webpack://
  (blank)
    Users/danielmanson/Mapbox-vector-tiles-basic-js-renderer
      src
        basic
          renderer.js
(5) Set a breakpoint on line 401:
  c.ctx.drawImage(this._canvas, srcLeft, srcTop, width, height, destLeft, destTop, width, height);
(6) Pan the map around until the breakpoint is hit
(7) Attempt to type "this" in the DevTools console


What is the expected result?

Expect to be able to programmatically inspect "this", in particular "this._canvas".


What happens instead?

"this" is undefined in scope. Can inspect other local variables both by hovering over them and typing their names into the console, and can also see properties of "this._canvas" by hovering over it in the source view; but it's not possible to type imperative code into the console which operates upon "this".

This is preventing effective debugging of this bug. Please diagnose; thanks.

 
this-undefined.png
183 KB View Download
Cc: l...@chromium.org
Owner: yangguo@chromium.org
Status: Assigned (was: Untriaged)
Thanks for the report.  This case looks like V8 has optimized away `this` from the arrow function's scope, preventing DevTools from resolving it.

In this particular case, the workaround is to click on the next highest callframe (_loop2), and evaluate `this`.

yangguo@, I think the core issue may be a duplicate of: crbug.com/826613


When I click on any higher callframe (_loop2, _loop, and the top-level .
(anonymous)), evaluating 'this' in the console shelf still results in 'undefined'.

Cc: -l...@chromium.org
Components: -Blink>JavaScript
Owner: l...@chromium.org
In an offline discussion, we found the true issue.

The file shown is a sourcemapped version of the script that is actually evaluated.  The evaluated script does not have `this` in its source code, but rather `_this10`, some name likely generated by Webpack.

I'll take a look.  There should be something smart we can do with Console autocomplete / Object popup previews to make it more intuitive.
Cc: swarnasree.mukkala@chromium.org
 Issue 905220  has been merged into this issue.

Sign in to add a comment