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

Issue 784772 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 756006
Owner:
Last visit > 30 days ago
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Console input with global async use (ES7) may provide misleading errors

Reported by va...@visionsinteractive.ch, Nov 14 2017

Issue description

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

Steps to reproduce the problem:
1. Open the console in Chromium
2. Type in this silly example code
   let r = await Notification.requestPermission()
   ...[r]
3. Read the error that pops up

What is the expected behavior?
The error reads as
<snip>
Uncaught SyntaxError: Unexpected token ...
</snip>

What went wrong?
The error reads as 
<snip>
Uncaught SyntaxError: await is only valid in async function
</snip>

Did this work before? N/A 

Chrome version: 63.0.3239.40  Channel: beta
OS Version: 10.0
Flash Version:
 
error-with-global-async-in-chrome-console.png
26.1 KB View Download
Components: -Blink Blink>JavaScript
Cc: sc00335...@techmahindra.com
Labels: -Type-Bug -Pri-2 hasbisect-per-revision ReleaseBlock-Stable Triaged-ET M-62 OS-Linux OS-Mac Pri-1 Type-Bug-Regression
Owner: gsat...@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce this issue on reported version 63.0.3239.40 and on latest canary 64.0.3269.0 using Windows 10, Mac 10.12.6 and Ubuntu 14.04 with steps mentioned in comment#0.

NOTE: Same error (SyntaxError: await is only valid in async functions) is seen in Firefox as well.

Manual Bisect Info:
================
Good Build: 62.0.3167.0
Bad Build: 62.0.3168.0 

You are probably looking for a change made after 489630 (known good), but no later than 489631 (first known bad).
CHANGELOG URL:
  https://chromium.googlesource.com/chromium/src/+log/6f26e54ff5ca98da832258b2aba96c4832c64d09..f290833d4d4acbb3dfbf27a1c496c958eb0e4381

Reviewed-on: https://chromium-review.googlesource.com/582210

Suspecting same from changelog.

@gsathya: Please confirm the bug and help in re-assigning if it is notrelated to your change.

Adding RB-Stable as this is a recent regression. Please feel free to remove if not the case.
Status: WontFix (was: Assigned)
This is working as intended. await can only be used as a contextual keyword inside an async function.

`(async () => { let r = await Notification.requestPermission(); ...[r] })()`

prints the correct error.
Cc: gsat...@chromium.org
Owner: kozyatinskiy@chromium.org
Maybe the reporter was confused by the magic wrapping that the console does to allow top level await. Re-assigning to Alexey to take a look potentially.
@gsat...: I am well aware that in theory await can only be used within an async function. However there has been support in Chromium for execution on the top level in the console via some magic wrapping.

The problem is, that the misleading error message this magic wrapping produces; i.e. think of way more code that someone might be pasting (or hacking) into the console, along with some errors and then attempts to find the cause. 

Comment 6 by kozy@chromium.org, Nov 15 2017

Mergedinto: 756006
Status: Duplicate (was: WontFix)
We use acorn to parse expression in console. Unfortunately acorn does not support spread operator for objects and arrays and produces syntax error for them and we fall back to evaluating expression as is.

Sign in to add a comment