Switching to async/await from Task.jsm/yield

Kris Maglione kmaglione at mozilla.com
Mon Mar 27 19:59:43 UTC 2017

On Mon, Mar 27, 2017 at 12:42:46PM -0700, Dave Townsend wrote:
>It looks like the main concern raised about switching over to async/await 
>where possible is bug 1242505.

I personally wouldn't consider this a blocker. I'm all for it 
being fixed, but the benefit of not having Promise.jsm noise in 
my tests outweighs it. And there are places where we can't 
actually use Promise.jsm (content scopes, extension copes), so 
we wind up with a mix of the two models if we try to stick with 
Promise.jsm in some places and not in others.

>We're going to try to get some resources for fixing that bug and it probably 
>blocks doing a mass rewrite of existing code but I don't think it blocks 
>people starting to use async/await right now as we're already using native 
>Promises in lots of places.

I think that, if anything, it should probably the other way around. Existing 
tests that use Promise.jsm probably don't have many unhandled exceptions, but 
new tests are more likely to wind up with them. If we start using native 
promises in more new places and then add unhandled rejection tracking to 
tests, we're probably going to have to do a lot more work fixing existing 
issues to get it turned on than if we gradually migrated to native promises 
after it was fixed.

But I'd still rather we use native promises and async functions in new tests, 
so I'm all for mass converting old code as well, and making sure we invest 
time in fixing that bug as soon as possible.

More information about the firefox-dev mailing list