Open Bug 1669578 Opened 4 years ago

Create/document additional testing helper to augment or replace existing File.createFromNsIFile

Categories

(Core :: DOM: File, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: asuth, Unassigned)

Details

We have a bunch of test logic that uses File.createFromNsIFile. These tests frequently either reference an existing file from the profile (frequently prefs.js, which is dangerous because of the "brand" the spec calls for and prefs.js can change frequently), or synchronously write contents to disk from the main thread.

It would be helpful to have a helper that could eliminate this boilerplate and concerns about sync I/O and failing to clean up temporary test files. It would also be invaluable to make sure that the file has known contents, either provided by the test, or a reasonable set of canned / generated data files such as full range binary data, valid UTF8 text, invalid UTF8 text. I believe we've had bugs in the past that tests didn't catch due to a lack of coverage of all of the permutations of: zero length, small size, large (multi-buffer) size.

We need not address all of these concerns on File.webidl, but if createFromNSIFile continues to exist it should have adjacent documentation to point to potentially better fixes. That could be in SpecialPowers or ChromeUtils or wherever.

You need to log in before you can comment on or make changes to this bug.