Closed Bug 1791332 Opened 3 months ago Closed 2 months ago

Fix OPFS WPT WritableFileStream tests to ensure cleanups are done in the correct order

Categories

(Core :: DOM: File, defect, P2)

defect

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: jesup, Assigned: jesup)

References

Details

Attachments

(1 file)

WritableFileStream (and SyncAccessHandles) take locks on files. If we need to clean them up after a test failure (call close()), we need to make sure the cleanups are done in the correct order, synchronously, in order to not hit problems with locks being held when we try to delete files.

I.e. if we createEmptyFile() (which adds a cleanup to delete the file, and then CreateWritable() (which adds a cleanup to close the writable, and takes a shared lock), we need to ensure that if cleanups run, the writable is cleaned up before we try to delete the file (which takes an exclusive lock on the file).

The default test.add_cleanup() code from testharness.js in wpt executes the cleanups in parallel, and even if it wasn't in parallel it would be in FIFO order (the wrong order).

This adds an OPFS-specific cleanup queue called once from the test cleanup list, and we process the list synchronously in LIFO order.

The default test.add_cleanup() code from testharness.js in wpt executes the
cleanups in parallel, and even if it wasn't in parallel it would be in FIFO
order (the wrong order).

This adds an OPFS-specific cleanup queue called once from the test cleanup
list, and we process the list synchronously in LIFO order.

Severity: -- → S3
Priority: -- → P2
Pushed by rjesup@wgate.com:
https://hg.mozilla.org/integration/autoland/rev/388419886525
Add an OPFS-specific synchronous ordered cleanup queue r=asuth,dom-storage-reviewers
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/36182 for changes under testing/web-platform/tests
Upstream PR was closed without merging
Blocks: 1804614
No longer blocks: 1804614
You need to log in before you can comment on or make changes to this bug.