Closed Bug 1741548 Opened 2 months ago Closed 2 months ago

Add ignoreAbsent option to `IOUtils.getChildren` method

Categories

(Toolkit :: OS.File, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: mathew.hodson, Assigned: mathew.hodson)

Details

Attachments

(1 file)

Code sometimes checks if a directory exists before iterating over it. The equivalent call with IOUtils would be with IOUtils.exists. We could avoid the accompanying IO in those cases with a new ignoreAbsent option for IOUtils.getChildren similar to the one for IOUtils.remove.

Examples:
https://searchfox.org/mozilla-central/rev/6deb8b6af57a8b5b6b1bcb143ea498e566475d8d/toolkit/mozapps/extensions/internal/XPIInstall.jsm#3480
https://searchfox.org/mozilla-central/rev/6deb8b6af57a8b5b6b1bcb143ea498e566475d8d/browser/components/sessionstore/SessionWorker.js#381

Remove an incorrect comment.

Assignee: nobody → mathew.hodson
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/95498b2c7460
Add ignoreAbsent option to `IOUtils.getChildren` method. r=barret
Status: UNCONFIRMED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
You need to log in before you can comment on or make changes to this bug.