Open Bug 1642039 Opened 4 years ago Updated 11 months ago

UpdateManager: Convert the call stacks to asynchronous functions.

Categories

(Toolkit :: Application Update, task, P3)

task

Tracking

()

ASSIGNED

People

(Reporter: WeirdAl, Assigned: WeirdAl)

References

(Blocks 2 open bugs)

Details

(Keywords: arch)

Attachments

(1 file)

This involves adding async and await keywords as necessary, and possibly some IDL changes as we go. (BrowserHandler.defaultArgs is one known case.)

Blocks: 1642041

Doing this by hand is time-consuming and risky. I'm going to attempt writing an automated static analysis tool, "stacklizard", to assist.

https://github.com/ajvincent/stacklizard/

One aspect of this that's going to be harder than I anticipated is that we can't mark constructors async, period:

function f() {
  function P() {
    // await setTimeout(() => null, 1000);
    this.q = 1;
  }

  var F = new P();
  alert(F.q);
}

Uncommenting the await means that function P() must become async function P(), and that means TypeError: P is not a constructor gets thrown. This is precisely why I'm writing a static analysis tool, but points to another blocking problem that I need advice to solve in the XPCOM world. Maybe we have to do this one in tandem with the introduction of UpdateManagerInit in bug 1642037.

This is an auto-generated analysis of where we will need async and await keywords, based on tonight's mozilla-central.

The tool I used to create this analysis is one of my own design, named StackLizard, heavily using several tools mozilla-central already uses for eslint. This is its raison d'être.

I'd like some feedback before I start adding in these keywords. It's not perfect. StackLizard missed looking for instances of the browser's AppUpdater() constructor, for one, and that's one problem point.

Flags: needinfo?(ksteuber)

There's a lot going on in your attachment. Just looking through a few lines, it seems like this is probably doing what you want, but I'm not keen on checking everything, given the quantity. Was there anything in particular you wanted me to look at? Or was there particular feedback you were hoping for?

Flags: needinfo?(ksteuber)

I was hoping for (1) overall design points on whether a different approach than just marking async or await might be preferable, and (2) introduction to appropriate peers of other modules to weigh in on those different approaches for their areas of scope.

I do still think that getting the necessary async/await keywords in the right places is a good first step.

I'm not sure which modules you think we need peer input for. Are there places where we are going to require structural changes to other modules? We shouldn't really need peer input just to mark some functions as async. It would be nice if we could keep the patches specific to particular modules so we can more easily request review. But unless structural changes are needed, it doesn't seem like we need to bring in any module peers at this time.

Priority: -- → P3

Sorry, there was a problem with the detection of inactive users. I'm reverting the change.

Assignee: nobody → ajvincent
Status: NEW → ASSIGNED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: