Closed Bug 1557611 Opened 7 years ago Closed 7 years ago

async function resolution order

Categories

(Core :: JavaScript Engine, defect)

66 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox-esr60 --- wontfix
firefox-esr68 --- wontfix
firefox67 --- wontfix
firefox68 --- wontfix
firefox69 --- fixed

People

(Reporter: johnplaisted, Assigned: jorendorff)

References

Details

(Keywords: regression)

Attachments

(2 files)

Attached file test2.html —

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36

Steps to reproduce:

The await keyword has a different resolution order than Promises, which seems incorrect (and fwiw Chrome's await matches promises; Safari appears to share FireFox's behavior).

I think I've found two different cases where the order is different from promises:

  • In some cases the await order determines when functions continue (rather than the resolve() order, assuming things resolve synchronously)
  • In some other cases it seems to be the opposite of the resolve AND await order when the are the same order. Maybe it is because one is an await <literal> and the other is an await promise?

Tested on FireFox 66.

Actual results:

The order of asynchronous code with an async function doesn't match the equivalent promise code.

When running the file:

  • async test fails
  • promise test passes
  • order of await determines order of async callbacks
  • order resolve() determines order of promise callbacks

Expected results:

The async function order matches the Promise equivalent.

When running the file:

  • async test passes
  • promise test passes
  • order of resolve() determines order of async callbacks
  • order resolve() determines order of promise callbacks

Using the test case above, I confirm this issue occurs in Beta v68.0b14 and Release v67.0.4, but DOE NOT occur in Nightly v69.0a1 (2019-07-02) on MacBook Pro with Mac OS 10.14.5.
Setting bug's component as (Core) JavaScript Engine.

Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true

Bugbug thinks this bug is a regression, but please revert this change in case of error.

Keywords: regression

(In reply to Bodea Daniel [:danibodea] from comment #2)

Using the test case above, I confirm this issue occurs in Beta v68.0b14 and Release v67.0.4, but DOE NOT occur in Nightly v69.0a1 (2019-07-02) on MacBook Pro with Mac OS 10.14.5.
Setting bug's component as (Core) JavaScript Engine.

Can you please bisect what fixed this?

Flags: needinfo?(daniel.bodea)

Unfortunately, there were insufficient builds to bisect the fix completely, but these are the logs. Hope it helps.

Flags: needinfo?(daniel.bodea)

Bug 1546145 stands out as a likely candidate in that range. I don't think that's a fix we could safely consider backporting, however, so this may just need to ride out with 69.

Yes, the difference is caused by the spec change implemented in bug 1495072 (and enabled by default in bug 1546145).

Thanks, calling this fixed by those two bugs then. But yeah, that's definitely not a change we can realistically consider backporting to stable branches, so 69+ it is.

Assignee: nobody → jorendorff
Status: NEW → RESOLVED
Closed: 7 years ago
Depends on: 1495072, 1546145
Resolution: --- → FIXED
Target Milestone: --- → mozilla69

Thanks!

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: