Open
Bug 1961778
Opened 20 days ago
Updated 20 days ago
Misleading SyntaxError When Using Top-Level Await inside Parameter List in Addon Content Script
Categories
(Core :: JavaScript Engine, enhancement, P3)
Tracking
()
NEW
People
(Reporter: epithet-until0e, Unassigned)
References
(Blocks 1 open bug)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:138.0) Gecko/20100101 Firefox/138.0
Steps to reproduce:
In an addon content script, try to call an async function with await at the top level. It must be inside some sort of parenthesis, e.g. a parameter list.
Actual results:
both of these cause an error that does not mention await. It seems to be the standard error for if any two identifiers are in a row without anything between them.
console.log(await fetch("https://example.com")); // SyntaxError: missing ) after argument list
(await fetch("https://example.com")); // SyntaxError: missing ) in parenthetical
Expected results:
The normal error for if it's outside of parenthesis:
await fetch(); // SyntaxError: await is only valid in async functions, async generators and modules
Comment 1•20 days ago
|
||
The Bugbug bot thinks this bug should belong to the 'WebExtensions::Untriaged' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Product: Firefox → WebExtensions
Updated•20 days ago
|
Blocks: sm-error-messages
Severity: -- → N/A
Status: UNCONFIRMED → NEW
Type: defect → enhancement
Component: Untriaged → JavaScript Engine
Ever confirmed: true
Priority: -- → P3
Product: WebExtensions → Core
You need to log in
before you can comment on or make changes to this bug.
Description
•