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

Issue 727924 link

Starred by 3 users

Issue metadata

Status: Duplicate
Merged: issue 658558
Owner: ----
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Feature



Sign in to add a comment

top-level await for browser console

Project Member Reported by ebra...@gnu.org, May 30 2017

Issue description

Chrome Version: 59
OS: all

What steps will reproduce the problem?
Run this on browser console

let result = await new Promise(resolve => setTimeout(() => resolve('Hi'), 1000));

What is the expected result?
Same result as if wrapped with (async function () { ... }());

What happens instead?
Throws an error.

As can be seen on https://github.com/nodejs/node/issues/13209 top-level await is considered a helpful feature for working with promises on the development, as node.js investigates possible ways for providing this, I think it would be good idea if Chrome could also go for providing this for the browser developers and perhaps you can help node.js for taking a better approach for implementing this feature there also.

 

Comment 1 by chi...@gmail.com, May 30 2017

In this example `await` is a valid identifier according to specification. How should  parser understand that `await` is not a variable here?
Also this example doesn't work in Safari (which does support top-level await in console) because of same reasons.
Screen Shot 2017-05-31 at 02.12.44.png
27.9 KB View Download

Comment 2 by ebra...@gnu.org, May 30 2017

Excellent, what Safari supports already suffice for me also, so I am going to change the bug description to what already supported on Safari

Comment 3 by ebra...@gnu.org, May 30 2017

Description: Show this description

Comment 4 by chi...@gmail.com, May 30 2017

OK. Is'n this weird and inconsistent?
Screen Shot 2017-05-31 at 02.55.34.png
21.6 KB View Download

Comment 5 by ebra...@gnu.org, May 31 2017

IMO JS has lots of corner cases, my favorite one is this one https://bugs.chromium.org/p/v8/issues/detail?id=457#c1 which didn't block tail call implementation eventually; this one is less distrubing one as it targets just console REPL and also is already done on Safari. (lets continue on node topic)
 issue 658558 

Comment 7 by ebra...@gnu.org, May 31 2017

Mergedinto: 658558
Status: Duplicate (was: Untriaged)
Oh, thanks

Sign in to add a comment