Closed
Bug 1381049
Opened 9 years ago
Closed 9 years ago
Fix cases of async function definitions without await in Places code
Categories
(Toolkit :: Places, enhancement)
Toolkit
Places
Tracking
()
RESOLVED
FIXED
mozilla56
| Tracking | Status | |
|---|---|---|
| firefox56 | --- | fixed |
People
(Reporter: standard8, Assigned: standard8)
References
Details
Attachments
(1 file)
We've got a few cases in Places related code where we're defining async functions but they don't actually use await, and therefore don't need to be defined as async.
Some of them do return promises though so the callers don't need updating.
This is part of the work towards enabling the eslint rule in bug 1381030.
| Comment hidden (mozreview-request) |
Comment 2•9 years ago
|
||
| mozreview-review | ||
Comment on attachment 8887097 [details]
Bug 1381049 - Fix cases of async function definitions without await in Places code.
https://reviewboard.mozilla.org/r/157832/#review162974
can we enable the rule just for Places with a local .eslintrc? Is it not worth it?
::: toolkit/components/places/PlacesDBUtils.jsm:223
(Diff revision 1)
> await PlacesUtils.withConnectionWrapper(
> "PlacesDBUtils: coherence check:",
> - db => db.executeTransaction(async () => {
> + db => db.executeTransaction(() => {
> for (let {query, params} of stmts) {
> params = params ? params : null;
> allStatementsPromises.push(db.execute(query, params).catch(ex => {
hm, I'm worried this may indicate a bug, for the transaction to be useful the queries should be await-ed for, or they may slip out of the transaction.
I don't think there's an actual win here into collecting all the promises and awaiting later, since all the queries on a database connection are serialized regardless.
Can we rewrite this as a plain for loop with awaits inside it?
Attachment #8887097 -
Flags: review?(mak77) → review+
| Assignee | ||
Comment 3•9 years ago
|
||
| mozreview-review-reply | ||
Comment on attachment 8887097 [details]
Bug 1381049 - Fix cases of async function definitions without await in Places code.
https://reviewboard.mozilla.org/r/157832/#review162974
I was thinking of holding off as I'm hoping to get it enabled globally soon, however with PTO etc, I decided it was worth it, so I've added on just to toolkit/components/places for now. We'll get the rest soon.
| Comment hidden (mozreview-request) |
| Assignee | ||
Comment 5•9 years ago
|
||
Note: the editBookmarkOverlay.js changes in the original version of the patch landed in bug 1381027.
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9d89b33a35a3
Fix cases of async function definitions without await in Places code. r=mak
Comment 7•9 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox56:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in
before you can comment on or make changes to this bug.
Description
•