Switching to async/await from Task.jsm/yield

Mark Hammond mhammond at mozilla.com
Thu Mar 16 23:11:36 UTC 2017


On 17/3/17 9:39 am, Mike Conley wrote:
> I'm all for it.
> 
> For the people who are more familiar with async / await than I am, and
> have also used Task.jsm, are there any gotchas, or is it pretty much a
> drop-in replacement?

I'm all for it, and since 54 we've been landing async functions in the 
Sync code base and it works well. The code isn't particularly 
performance sensitive and we've not profiled anything, but there's no 
obvious evidence of worse performance.

However, there is some weirdness with stacks - see bug 1343158 - 
Task.jsm often has the same issue, but it can be subtly different - 
because Task.jsm still uses Promise.jsm which has some additional stack 
magic. Code using DOM promises also has subtly different behavior re stacks.

So eventually this will be a big win (only DOM promises and async 
functions should exist, so less places for strange behaviour to appear), 
but it is worth being aware of issues with stack traces in the 
(hopefully) shorter term.

Cheers,

Mark



More information about the firefox-dev mailing list