Referencing variables in module scopes during debugging throws a ReferenceError. |
|||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36 Steps to reproduce the problem: 1. Create a page with an inline or external module that contains a variable in the top scope. ``` <html> <head> <script type="module"> let x = 1; debugger; </script> </head> <body> </body> </html> ``` 2. Place a debugger statement in the module after the variable declaration. 3. Type the variable into the console and press enter; a ReferenceError is thrown. Another thing I noticed that might be related to this is that the name of the module scope in the "Scope" panel is blank and expanding objects within that scope occasionally causes the page to crash. What is the expected behavior? The console displays some representation of the variable's value. What went wrong? The console shows that a ReferenceError was thrown instead. Did this work before? N/A Chrome version: 60.0.3087.0 Channel: canary OS Version: OS X 10.12.4 Flash Version:
,
May 3 2017
Are you running with the latest Canary? That's the only place `<script type="module">` works right now.
,
May 3 2017
(I wasn't given any option to set the UA string listed at the top of this bug; I assume that was added by Monorail.)
,
May 3 2017
Huh, Canary on Windows doesn't execute this at all.
,
May 5 2017
Oh! This is behind the "Experimental Web Platform features" flag and my Windows VM didn't have it enabled. It's reproducible there too though. Mind taking another look?
,
May 8 2017
I suspect this is an artifact of the fact that modules are implemented under the hood as generators.
,
May 9 2017
,
May 9 2017
It rather seems that Devtools is looking in the wrong scope. Typing "this" prints the window object, while it should be undefined.
,
May 9 2017
kozyatinskiy@, could you have a look please? Let me know if I can help somehow.
,
May 10 2017
,
May 10 2017
,
May 12 2017
,
May 19 2017
Update from kozyatinskiy@ via IM: https://cs.chromium.org/chromium/src/v8/src/debug/debug-evaluate.cc?rcl=bc40d0b49393a6be439fa622c244a05362b53daa&l=152 needs updating to handle module scopes.
,
May 19 2017
Thanks, I can give it a try next week.
,
May 24 2017
I'm not sure what exactly needs be done here. With jgruber@'s help I made some changes to Context::Lookup but then I realized this never gets called for module contexts. kozyatinskiy@, could you provide some details or, alternatively, would you be willing to make the changes yourself? Unfortunately, Yang is on leave so I can't ask him for help.
,
May 24 2017
Ok, I'll take a look.
,
May 26 2017
Bumping to P1, M61 given that this blocks the devtools MVP bug which blocks ES6 Modules (targeted at M61).
,
Jun 12 2017
kozyatinskiy: Would you give an update on this?
,
Jun 13 2017
This is WIP at https://chromium-review.googlesource.com/c/519389/
,
Jun 14 2017
,
Jun 14 2017
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/c2a7550f4713f34daeb9d561c5999bab0fa774e1 commit c2a7550f4713f34daeb9d561c5999bab0fa774e1 Author: Alexey Kozyatinskiy <kozyatinskiy@chromium.org> Date: Wed Jun 14 14:58:12 2017 [inspector] expose module variables for Debugger.evaluateOnCallFrame method Context::Lookup method should support Module variables. Bug: chromium:717670 Change-Id: I58d3448b9048c7f9dd7ab8b720803b3503cf91ae Reviewed-on: https://chromium-review.googlesource.com/519389 Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#45950} [modify] https://crrev.com/c2a7550f4713f34daeb9d561c5999bab0fa774e1/src/contexts.cc [modify] https://crrev.com/c2a7550f4713f34daeb9d561c5999bab0fa774e1/src/contexts.h [modify] https://crrev.com/c2a7550f4713f34daeb9d561c5999bab0fa774e1/src/debug/debug-evaluate.cc [modify] https://crrev.com/c2a7550f4713f34daeb9d561c5999bab0fa774e1/src/runtime/runtime-scopes.cc [add] https://crrev.com/c2a7550f4713f34daeb9d561c5999bab0fa774e1/test/inspector/debugger/evaluate-on-call-frame-in-module-expected.txt [add] https://crrev.com/c2a7550f4713f34daeb9d561c5999bab0fa774e1/test/inspector/debugger/evaluate-on-call-frame-in-module.js [modify] https://crrev.com/c2a7550f4713f34daeb9d561c5999bab0fa774e1/test/inspector/inspector.status
,
Jun 14 2017
|
|||||||||||
►
Sign in to add a comment |
|||||||||||
Comment 1 by eostroukhov@chromium.org
, May 3 2017