1
0
Fork 0
firefox/dom/fs/test/crashtests/sw1844619.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

21 lines
660 B
JavaScript

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')
})()