New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 717670 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug

Blocked on:
issue v8:6489

Blocking:
issue 594639
issue 721801



Sign in to add a comment

Referencing variables in module scopes during debugging throws a ReferenceError.

Project Member Reported by bickne...@google.com, May 2 2017

Issue description

UserAgent: 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:
 
Status: WontFix (was: Unconfirmed)
I do not see code in your snippet being executed - 'debugger' statement is not hit, adding a console.log does not output anything, breakpoint is never executed, etc.
Are you running with the latest Canary? That's the only place `<script type="module">` works right now.
(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.)
Huh, Canary on Windows doesn't execute this at all.
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?

Comment 6 by adamk@chromium.org, May 8 2017

Cc: kozyatinskiy@chromium.org neis@chromium.org
Components: Blink>HTML>Modules
Labels: -OS-Mac OS-All
Status: Available (was: WontFix)
I suspect this is an artifact of the fact that modules are implemented under the hood as generators.

Comment 7 by neis@chromium.org, May 9 2017

Blocking: 594639

Comment 8 by neis@chromium.org, 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.

Comment 9 by neis@chromium.org, May 9 2017

Cc: -kozyatinskiy@chromium.org
Owner: kozyatinskiy@chromium.org
Status: Assigned (was: Available)
kozyatinskiy@, could you have a look please? Let me know if I can help somehow.
Components: Blink>HTML>Script
Components: -Blink>HTML>Modules
Blocking: 721801

Comment 13 Deleted

Comment 14 Deleted

Comment 15 by adamk@chromium.org, May 19 2017

Cc: adamk@chromium.org
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.

Comment 16 by neis@chromium.org, May 19 2017

Thanks, I can give it a try next week.

Comment 17 by neis@chromium.org, 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.
Ok, I'll take a look.
Labels: -Pri-2 M-61 Pri-1
Bumping to P1, M61 given that this blocks the devtools MVP bug which blocks ES6 Modules (targeted at M61).
kozyatinskiy: Would you give an update on this?
Blockedon: v8:6489
Status: Fixed (was: Assigned)

Sign in to add a comment