Open Bug 1806731 Opened 2 years ago Updated 5 months ago

Anti-pattern of async/await in Promise constructor executor functions

Categories

(Core :: General, defect)

defect

Tracking

()

People

(Reporter: jib, Unassigned)

References

(Depends on 1 open bug)

Details

(Keywords: good-first-bug)

Attachments

(2 files, 1 obsolete file)

There are 158 hits in the tree of the async/await inside Promise constructor executor function anti-pattern. This pattern has demonstrably poor error handling characteristics, leading to uncaught errors, as described in the link.

Bad patterns tend to spread unless weeded, so the sooner we root this out the better.

The severity field is not set for this bug.
:marco, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(mcastelluccio)
Severity: -- → S4
Flags: needinfo?(mcastelluccio)
Keywords: good-first-bug
Assignee: nobody → liumeo
Status: NEW → ASSIGNED
Depends on: 1810076
Attachment #9311238 - Attachment is obsolete: true
Depends on: 1810328

This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit auto_nag documentation.

Assignee: liumeo → nobody
Status: ASSIGNED → NEW

Hey! I want to give it a try. Can you please assign me this or I should go ahead and submit a patch?

Flags: needinfo?(jib)

Hi Lata, that would be great!

Note I briefly started on this around the time I filed the issue, but got side-tracked. So if you have cycles to pick it up that would be great!

I've uploaded a patch of how far I got. I didn't get very far, as you can see, but hopefully it is helpful to get a sense of what is needed.

Challenges I ran into:

  1. Each fix turned out to be more demanding and less rote than I thought, often requiring insight into what was going on. I.e. not sure I would trust GPT-4 with this.
  2. A lot of the hits appear to be for tests that aren't passing. I suggest only touching tests that pass, because that way we have some measure of success.
  3. I wasn't sure who would review it all, since it cuts across many folders, e.g. if some areas require review by certain people, but I'm happy to be the reviewer!
Assignee: nobody → imlata1111
Flags: needinfo?(jib)

Hey! Sorry for the late reply. I have been working on other bug. I will look into your patch and try to figure out what needs to be done next. Thanks.

This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit BugBot documentation.

Assignee: imlata1111 → nobody

Hello!
I can work on this bug if it is still relevant.

This changeset only includes the somewhat straight-forward cases.

Approaches:

  • Removing unused 'async' keywords.
  • Removing the promise constructor altogether/reducing its scope
    by lifting all/some executor code up into the surrounding async
    function.
Assignee: nobody → swamblumat-git
Status: NEW → ASSIGNED

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: swamblumat-git → nobody
Status: ASSIGNED → NEW

Hello there!
I can work on this bug if it is still available.

(In reply to Ali Yousef from comment #12)

Hello there!
I want to give it a try . Would you please assign me !

(In reply to Ali Yousef from comment #13)

(In reply to Ali Yousef from comment #12)

Hello there!
I want to give it a try . Would you please assign me !

Sorry for this mistake. I am new to Bugzilla, and what I wanted is to edit my first comment not to add second one . I did not realized that editing not allowed !

I want to give this bug a try . Would you please assign me !

Usually the bug is assigned once the contributor attaches a patch :)

(In reply to Jan-Ivar Bruaroey [:jib] (needinfo? me) from comment #6)

  1. A lot of the hits appear to be for tests that aren't passing. I suggest only touching tests that pass, because that way we have some measure of success.

what commands I should run to see what tests aren't passing !

Flags: needinfo?(jib)

If we focus on the WPT tests (inside testing/web-platform/tests/), then use mach wpt <path/folder/file.html> to run tests locally.

See also testing/web-platform/meta/ where known failing tests are annotated/turned off.

For quick view there's also https://wpt.fyi/results (but that's outside our tree)

Flags: needinfo?(jib)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: