Bug 271241 - Async function parameter destructuring results in "Right side of assignment cannot be destructured"
Summary: Async function parameter destructuring results in "Right side of assignment c...
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari 17
Hardware: Mac (Apple Silicon) macOS 14
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-19 07:56 PDT by csongor.szilagyi
Modified: 2024-03-31 04:42 PDT (History)
3 users (show)

See Also:


Attachments
A short html snippet to reproduce the issue (543 bytes, text/html)
2024-03-19 07:56 PDT, csongor.szilagyi
no flags Details
rendering in safari, firefox, chrome (410.42 KB, image/png)
2024-03-21 19:45 PDT, Karl Dubost
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description csongor.szilagyi 2024-03-19 07:56:24 PDT
Created attachment 470435 [details]
A short html snippet to reproduce the issue

Consider the following code: 

async function async_test(prop1) {
    var {prop1, prop2} = prop1;
    console.log(prop1)
  }

async_test({prop1: 'async_param', prop2: 2});

## Expected output: "async_param"
## Actual output: Unhandled Promise Rejection: TypeError: Right side of assignment cannot be destructured

Additional note: The same scenario works as expected in a non async context.

Expected output can be reproduced in Chrome, Firefox, Edge
Comment 1 Karl Dubost 2024-03-21 19:45:01 PDT
Created attachment 470476 [details]
rendering in safari, firefox, chrome

tested in 
Safari Technology Preview  190           19619.1.5.5.2
Firefox Nightly            125.0a1       12524.3.12
Google Chrome Canary       125.0.6371.0  6371.0

Same output everywhere.
[Log] async_param (attachment.cgi, line 10)
[Log] regular_param (attachment.cgi, line 15)
Comment 2 Karl Dubost 2024-03-21 19:46:21 PDT
csongor, This seems to be working for me in STP 190.
Do not hesitate to chime in if you think I have closed too soon.
Comment 3 csongor.szilagyi 2024-03-31 04:42:17 PDT
I can confirm that it works in Technology Preview 190. Looking forward to be included in the main build too.