Closed
Bug 1462483
Opened 6 years ago
Closed 6 years ago
Cleanup directory enumeration code
Categories
(Toolkit :: Add-ons Manager, enhancement)
Toolkit
Add-ons Manager
Tracking
()
RESOLVED
FIXED
mozilla62
Tracking | Status | |
---|---|---|
firefox62 | --- | fixed |
People
(Reporter: kmag, Assigned: kmag)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
We have directory enumeration code duplicated in a few places, along with the unused (or unnecessary) logic for sorting the directory entries. Let's just have one helper that returns an iterator and is used everywhere. Note: In the future, we should make this an async iterator using OS.File, but that has complications for the couple of places we sometimes need to do synchronous scans at startup, so we may need separate sync and async implementations eventually.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 3•6 years ago
|
||
mozreview-review |
Comment on attachment 8976727 [details] Bug 1462483: Part 1 - Explicitly return a nsIDirectoryEnumerator from nsIFile::GetDirectoryEntries. https://reviewboard.mozilla.org/r/244814/#review250898 Do we need to file a followup for fixing C++ callers as well?
Attachment #8976727 -
Flags: review?(nfroyd) → review+
Assignee | ||
Comment 4•6 years ago
|
||
(In reply to Nathan Froyd [:froydnj] from comment #3) > Do we need to file a followup for fixing C++ callers as well? It would probably be a good idea. Most of the existing C++ callers seem to use nsISimpleEnumerator rather than QIing to nsIDirectoryEnumerator, but switching them to the latter would save an unnecessary QI for each file they enumerate over, so it would be nice.
Comment 5•6 years ago
|
||
mozreview-review |
Comment on attachment 8976728 [details] Bug 1462483: Part 2 - Cleanup directory iteration code. https://reviewboard.mozilla.org/r/244816/#review251120 ::: toolkit/mozapps/extensions/internal/XPIInstall.jsm:2817 (Diff revision 1) > - let dirEntries = dir.directoryEntries.QueryInterface(Ci.nsIDirectoryEnumerator); > - try { > + // eslint-disable-next-line no-unused-vars > + for (let file of iterDirectory(dir)) > - if (dirEntries.nextFile) > - return; > + return; surely there is a more straightforward way to do this?
Attachment #8976728 -
Flags: review?(aswan) → review+
Assignee | ||
Comment 6•6 years ago
|
||
mozreview-review-reply |
Comment on attachment 8976728 [details] Bug 1462483: Part 2 - Cleanup directory iteration code. https://reviewboard.mozilla.org/r/244816/#review251120 > surely there is a more straightforward way to do this? Not really.
Assignee | ||
Comment 7•6 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/8b49c4e339aeec0eb6ec4ad238dbd43adf958062 Bug 1462483: Part 1 - Explicitly return a nsIDirectoryEnumerator from nsIFile::GetDirectoryEntries. r=froydnj https://hg.mozilla.org/integration/mozilla-inbound/rev/50e011c40415a2d3420afa686f1d2ba5b7bcbb1c Bug 1462483: Part 2 - Cleanup directory iteration code. r=aswan
Comment 8•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/8b49c4e339ae https://hg.mozilla.org/mozilla-central/rev/50e011c40415
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
Updated•6 years ago
|
Flags: qe-verify-
You need to log in
before you can comment on or make changes to this bug.
Description
•