Open
Bug 1503716
Opened 7 years ago
Updated 3 years ago
[autoconfig] Convert code to use async functions and Promises
Categories
(Thunderbird :: Account Manager, enhancement)
Thunderbird
Account Manager
Tracking
(Not tracked)
ASSIGNED
People
(Reporter: BenB, Assigned: BenB)
References
Details
The account creation dialog code is mostly asynchronous processing. Written 9 years ago, there were no Promise or async/await available. So, it uses the closest match: successCallback and errorCallback. It uses that pattern consistently throughout (aside from the UI), so it should be reasonably straightforward to convert to Promises and |async function|s. Callers should use |await| where possible/reasonable.
To consider here is that most async functions currently return an |Abortable| object. That will still be needed despite Promises, because it's important that both the end user and the dialog logic can cancel any request at any time. Obviously, the |Abortable| object is needed immediately when the function starts, not when it finishes, so it can't be the result of the Promise. We need to find a nice function API so that these functions can run as await foo(), but still be abortable.
Out of scope:
* It currently uses its own small FetchHTTP class based on XMLHttpRequest. I have already tried to convert this to Fetch(), but that brings no advantage and does not work well, so this is out of scope here. XMLHttpRequest serves us fine here. The library should be to Promise / async function, though, which should be straight-forward and simple.
* Any other code polish, code style etc. I may fix some code style in lines that I touch, but if reviewers ask me to change lines in some way or other "because you touch them anyway", this task here will not be feasible. Other code polish outside of the conversion to Promises should be put in a different bug and be done there, not here.
Assignee | ||
Comment 1•7 years ago
|
||
Code dependency on bug 1500105, because that changes a lot of the code.
Depends on: owl
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → ben.bucksch
Assignee | ||
Comment 2•7 years ago
|
||
xref bug 1504805 for |class| syntax.
Assignee | ||
Updated•7 years ago
|
Status: NEW → ASSIGNED
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•