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
I did file a webkit bug as well: https://bugs.webkit.org/show_bug.cgi?id=198643
Err, I filed a *FireFox* bug as well :) https://bugzilla.mozilla.org/show_bug.cgi?id=1557611
<rdar://problem/113883375>
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.