RESOLVED FIXED 198643
async function resolution order
https://bugs.webkit.org/show_bug.cgi?id=198643
Summary async function resolution order
John Plaisted
Reported 2019-06-06 21:29:07 PDT
Created attachment 371556 [details] Test demonstrating differences in async / promise behavior Steps to reproduce: The await keyword has a different resolution order than Promises, which seems incorrect (and fwiw Chrome's await matches promises; FireFox appears to share Safari'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? 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
Attachments
Test demonstrating differences in async / promise behavior (3.69 KB, text/html)
2019-06-06 21:29 PDT, John Plaisted
no flags
John Plaisted
Comment 1 2019-06-07 08:12:14 PDT
I did file a webkit bug as well: https://bugs.webkit.org/show_bug.cgi?id=198643
John Plaisted
Comment 2 2019-06-07 08:12:45 PDT
Err, I filed a *FireFox* bug as well :) https://bugzilla.mozilla.org/show_bug.cgi?id=1557611
Radar WebKit Bug Importer
Comment 3 2023-08-14 18:32:37 PDT
Alexey Shvayka
Comment 4 2023-10-11 17:03:24 PDT
Hey John, thanks for filing the bugs and providing super well-written test case! Per https://bugzilla.mozilla.org/show_bug.cgi?id=1557611#c7, the difference that was observed in 2019 was due to not all browsers (yet) implementing the spec change: https://github.com/tc39/ecma262/pull/1250. All browsers, including Safari 16.1, are passing the tests.
Note You need to log in before you can comment on or make changes to this bug.