Nullish coalescing operator inside async function fails in web console
Categories
(DevTools :: Console, defect)
Tracking
(firefox74 verified, firefox75 verified)
People
(Reporter: subs, Assigned: nchevobbe)
References
Details
Attachments
(1 file)
47 bytes,
text/x-phabricator-request
|
pascalc
:
approval-mozilla-beta+
|
Details | Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0
Steps to reproduce:
Similar to bug 1599163, I was trying out the nullish coalescing operator in the console, but inside an async function.
Actual results:
The console failed to make the function, and didn't produce an error. (Returned undefined like normal.)
Here's the smallest test case that fails:
async function testa() { await x; let y = 1 ?? 2; }
(Type 'testa' and enter in console, and it won't be there.)
by contrast these work fine:
async function testb() { let y = 1 ?? 2; }
async function testc() { await x; let y = 1 || 2; }
(Typing 'testb' or 'testc' bring up their respective functions as expected.)
Expected results:
Typing 'testa' and enter should have brought up the function.
Note that the function seems to work fine in a .js file (or loaded in a script tag).
Comment 1•4 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Assignee | ||
Comment 2•4 years ago
|
||
Since both operators are now supported in Firefox,
we should make sure we can use them in top-level
await expression in the console.
Unit tests are added to ensure this works as expected.
Updated•4 years ago
|
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ee79f0156832 Enable nullish coalescing and optional chaining operators when parsing console expression. r=loganfsmyth.
Comment 4•4 years ago
|
||
bugherder |
Assignee | ||
Comment 5•4 years ago
|
||
Comment on attachment 9127029 [details]
Bug 1615781 - Enable nullish coalescing and optional chaining operators when parsing console expression. r=loganfsmyth.
Beta/Release Uplift Approval Request
- User impact if declined: User won't be able to declare an async function with the nullish coalesce operator or the optional chaining operator from the console.
This would be weird as it works in regular JS files. - Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: Yes
- If yes, steps to reproduce: 1. Open the console
- Evaluate the following
async function test(x) {
await 1;
return x?.value ?? 2;
}
- Make sure you can call the newly created
test
function.
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): devtools only, covered by tests, babel-configuration only
- String changes made/needed:
Assignee | ||
Updated•4 years ago
|
Updated•4 years ago
|
Comment 6•4 years ago
|
||
Comment on attachment 9127029 [details]
Bug 1615781 - Enable nullish coalescing and optional chaining operators when parsing console expression. r=loganfsmyth.
Looks safe, has tests and doesn't impact end_users, uplift approved for our next beta, thanks.
Comment 7•4 years ago
|
||
bugherder uplift |
Updated•4 years ago
|
Comment 8•4 years ago
|
||
Verify as fixed on Firefox Nightly 75.0a1 (2020-02-19) and on Firefox 74.0b5 on Windows 10 x64, Ubuntu 18.04 x64 and on Mac OS X 10.14.
Description
•