Switching to async/await from Task.jsm/yield

Michael Layzell michael at thelayzells.com
Fri Mar 17 01:08:24 UTC 2017


I mostly use tasks when writing tests, so I mostly have questions about how
it's use in that situation will be affected.

Can we pass async functions everywhere where we use `add_task` in tests
already? If we can't, is there a tracking bug for converting all of the
test systems to support it?
Can you `await` a function created with Task.async such as
`BrowserTestUtils.withNewTab` during the transition period?
How about in ESR52? Will uplifting tests to ESR52 be a painful experience
due to having to use different tools to write the tests?
Can I pass an async function as the callback argument to things like
ContentTask.spawn and BrowserTestUtils.withNewTab? How about on ESR52?

On Thu, Mar 16, 2017 at 7:18 PM, J. Ryan Stinnett <jryans at gmail.com> wrote:

> Sounds like a good change to make from the discussion so far.
>
> If there are issues with stack traces, I would assume having more of our
> code base using async / await is a good way to apply pressure for stack
> trace improvements (if needed) that will benefit everyone.
>
> - Ryan
>
> On Thu, Mar 16, 2017 at 5:52 PM, Kris Maglione <kmaglione at mozilla.com>
> wrote:
>
> > On Thu, Mar 16, 2017 at 05:39:06PM -0500, J. Ryan Stinnett wrote:
> >
> >> For modules that have already converted, is there any performance change
> >> (good or bad) between async / await vs. Task?
> >>
> >
> > I haven't noticed any differences either way, but I also haven't done any
> > explicit profiling. There's definitely a difference in the way we collect
> > async stacks in async/await code vs. with the Promise.jsm promises that
> > Task.jsm uses, but that shouldn't show up much on release.
> >
> >
> > On Thu, Mar 16, 2017 at 5:33 PM, Kris Maglione <kmaglione at mozilla.com>
> >> wrote:
> >>
> >> On Thu, Mar 16, 2017 at 03:29:15PM -0700, Dave Townsend wrote:
> >>>
> >>> Writing code in standard JS is always better for the web, makes it
> easier
> >>>> to onboard new engineers and allows for better support in developer
> >>>> tools.
> >>>> So I'd like to propose that we switch to the standard way of writing
> >>>> these
> >>>> functions immediately. New code should use async/await instead of
> >>>> Task.jsm
> >>>> going forwards.
> >>>>
> >>>>
> >>> +1
> >>>
> >>> I've already started doing this in places where using Task.jsm was
> >>> unwieldy, and it's improved things tremendously.
> >>>
> >>
> _______________________________________________
> dev-platform mailing list
> dev-platform at lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/firefox-dev/attachments/20170316/344b2754/attachment.html>


More information about the firefox-dev mailing list