Closed Bug 1665172 Opened 2 years ago Closed 2 years ago

Clean up IOUtils

Categories

(Toolkit :: OS.File, task)

task

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: barret, Assigned: barret)

References

Details

Attachments

(14 files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

There are a few minor cleanups to be done on the IOUtils code.

This utility is not used and can be removed.

Depends on D95254

As part of cleaning up IOUtils, we can construct nsLocalFiles in
IOUtils::Read{,UTF8}, which has the benefit of doing more checks up front,
instead of waiting until we have passed work off to the background thread.

Once all methods pass nsIFile instances through to the background thread,
we can remove our own absolute path checking code.

Depends on D96134

Some other clean ups have been made, like using nsIFile::Exists() instead of
opening a file to see if it exists.

Depends on D96135

We no longer normalize the paths in CopyOrMoveSync and instead rely on
nsIFile::{Copy,Move}ToFollowingLinks to provide path normalization.

Depends on D96137

CreateDirectorySync has also been renamed to MakeDirectorySync to mirror
all other Fn vs FnSync methods in IOUtils.

Depends on D96139

nsFileInputStream does most of the same work we were doing manually to read
files and determine their size in ReadSync.

Depends on D96143

The nsFileOutputStream does all the error checking we were doing in WriteSync,
which we can now remove. PR_CloseDelete and all usages of raw PR file
descriptors can be also now be removed.

Additionally, the mode we were using for writing included PR_WRONLY | PR_TRUNCATE | PR_APPEND, which makes the PR_APPEND redundant.

Depends on D96145

Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/35729964b449
Remove ToMozPromise from IOUtils r=emalysz
https://hg.mozilla.org/integration/autoland/rev/6f67e1fdbb34
Pass nsIFile through IOUtils::Read{,UT8}Sync for paths instead of strings r=emalysz
https://hg.mozilla.org/integration/autoland/rev/6ca8089d00e3
Pass nsIFile through IOUtils::WriteAtomic{,UT8}Sync for paths instead of strings r=emalysz
https://hg.mozilla.org/integration/autoland/rev/c03cb8e8d84a
Add nsIFile::MoveToFollowingLinks{,Native} methods r=nika
https://hg.mozilla.org/integration/autoland/rev/9ce96274cd43
Pass nsIFile through IOUtils::{Copy,Move}Sync for paths instead of strings r=Gijs
https://hg.mozilla.org/integration/autoland/rev/b8dd57b72a05
Pass nsIFile through IOUtils::RemoveSync for paths instead of strings r=emalysz
https://hg.mozilla.org/integration/autoland/rev/14a6de7d3adf
Pass nsIFile through IOUtils::MakeDirectorySync for paths instead of strings r=Gijs
https://hg.mozilla.org/integration/autoland/rev/caf75fed0764
Pass nsIFile through IOUtils::StatSync for paths instead of strings r=emalysz
https://hg.mozilla.org/integration/autoland/rev/be537370928e
Pass nsIFile through IOUtils::TouchSync for paths instead of strings r=emalysz
https://hg.mozilla.org/integration/autoland/rev/98e31bd40f8e
Pass nsIFile through IOUtils::GetChildrenSync for paths instead of strings r=Gijs
https://hg.mozilla.org/integration/autoland/rev/7eb3ffe23c14
Use nsFileInputStream for IOUtils::ReadSync r=Gijs
https://hg.mozilla.org/integration/autoland/rev/8f76a3bc1006
Use nsCOMPtr for nsI* interface pointers r=emalysz
https://hg.mozilla.org/integration/autoland/rev/e63cb11a9669
Use nsFileOutputStream for writing in IOUtils r=emalysz
https://hg.mozilla.org/integration/autoland/rev/8d8eeffbcdea
IOError::WithMessage should accept nsCString argument as const ref r=Gijs
Blocks: 1677000
You need to log in before you can comment on or make changes to this bug.