Issue metadata
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 descriptionUserAgent: 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:
,
Nov 15 2017
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.
,
Nov 15 2017
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.
,
Nov 15 2017
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.
,
Nov 15 2017
@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.
,
Nov 15 2017
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 |
|||||||||||||||||||||||||
Comment 1 by dtapu...@chromium.org
, Nov 14 2017