diff --git a/dom/fs/parent/datamodel/FileSystemDatabaseManagerVersion001.cpp b/dom/fs/parent/datamodel/FileSystemDatabaseManagerVersion001.cpp index 6f396378c0b3..c65bf0150836 100644 --- a/dom/fs/parent/datamodel/FileSystemDatabaseManagerVersion001.cpp +++ b/dom/fs/parent/datamodel/FileSystemDatabaseManagerVersion001.cpp @@ -806,10 +806,9 @@ Result FileSystemDatabaseManagerVersion001::RemoveDirectory( QM_TRY_UNWRAP(DebugOnly removedUsage, mFileManager->RemoveFiles(descendants, failedRemovals)); - // We only check the most common case. This can fail spuriously if an external - // application writes to the file, or OS reports zero size due to corruption. + // Usage is for the current main file but we remove temporary files too. MOZ_ASSERT_IF(failedRemovals.IsEmpty() && (0 == mFilesOfUnknownUsage), - usage == removedUsage); + usage <= removedUsage); TryRemoveDuringIdleMaintenance(failedRemovals); diff --git a/dom/fs/test/crashtests/1844619.html b/dom/fs/test/crashtests/1844619.html new file mode 100644 index 000000000000..43a85e94d940 --- /dev/null +++ b/dom/fs/test/crashtests/1844619.html @@ -0,0 +1,11 @@ + + + + + + diff --git a/dom/fs/test/crashtests/crashtests.list b/dom/fs/test/crashtests/crashtests.list index 050ebca7269b..f098400544af 100644 --- a/dom/fs/test/crashtests/crashtests.list +++ b/dom/fs/test/crashtests/crashtests.list @@ -6,3 +6,5 @@ load 1800470.html load 1809759.html load 1816710.html load 1841702.html +HTTP load 1844619.html + diff --git a/dom/fs/test/crashtests/sw1844619.js b/dom/fs/test/crashtests/sw1844619.js new file mode 100644 index 000000000000..dd221844f24a --- /dev/null +++ b/dom/fs/test/crashtests/sw1844619.js @@ -0,0 +1,21 @@ +async function timeout (cmd) { + const timer = new Promise((resolve, reject) => { + const id = setTimeout(() => { + clearTimeout(id) + reject(new Error('Promise timed out!')) + }, 750) + }) + return Promise.race([cmd, timer]) +} + +(async () => { + const root = await navigator.storage.getDirectory() + const blob = new Blob(['A']) + const sub = await root.getDirectoryHandle('a', { 'create': true }) + const file = await root.getFileHandle('b', { 'create': true }) + await file.move(sub) + const stream = await file.createWritable({}) + await stream.write(blob) + const sub2 = await root.getDirectoryHandle('a', {}) + await sub2.move(root, 'X') +})()