Closed
Bug 1494726
Opened 6 years ago
Closed 5 years ago
Malformed top-level await expression lead to confusing error
Categories
(DevTools :: Console, defect, P1)
DevTools
Console
Tracking
(firefox66 fixed)
RESOLVED
FIXED
Firefox 66
Tracking | Status | |
---|---|---|
firefox66 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: nchevobbe)
References
Details
(Whiteboard: [boogaloo-mvp])
Attachments
(1 file)
**Steps to reproduce** 1. Open the console 2. Evaluate `await new Promise())` **Expected results** I get the same error as when I only type `Promise())`: `SyntaxError: unexpected token: ')'` **Actual results** The following error is displayed: `SyntaxError: await is only valid in async functions and async generators` --- The error is very confusing since we should now support top-level await.
Assignee | ||
Updated•6 years ago
|
Priority: -- → P2
Whiteboard: [boogaloo-mvp]
Assignee | ||
Updated•5 years ago
|
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Priority: P2 → P1
Assignee | ||
Comment 1•5 years ago
|
||
When an expression starting with await is not mapped by the parserService, this means it is malformed. In order to get a meaningful error, we wrap it in an async iife before evaluatin it so the engine throws the appropriate error, and not "await is only valid in async functions and async generators". A test case is added to make sure this works as expected.
Assignee | ||
Comment 2•5 years ago
•
|
||
Parser changes will be on this Github PR, then we'll use this bug to do a "release" and add the mochitest.
Updated•5 years ago
|
Attachment #9034992 -
Attachment description: Bug 1494726 - Fix unhelpful error in top-level await malformed expression; r=jlast. → Bug 1494726 - Add a test for malformed top-level await expressions; r=jlast.
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/46a48161f428 Add a test for malformed top-level await expressions; r=jlast.
Comment 4•5 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
status-firefox66:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 66
You need to log in
before you can comment on or make changes to this bug.
Description
•