[Webkit-unassigned] [Bug 250495] FileSystemSyncAccessHandle does not flush data

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jan 11 20:22:13 PST 2023


https://bugs.webkit.org/show_bug.cgi?id=250495

--- Comment #1 from Alex Titarenko <03_placid_daft at icloud.com> ---
More clear information on how to reproduce:

In file:
https://github.com/WebKit/WebKit/blob/main/LayoutTests/storage/filesystemaccess/resources/file-handle-getfile.js

replace test function with:

```
async function test() 
{
    try {
        var rootHandle = await navigator.storage.getDirectory();
        // Create a new file for this test.
        await rootHandle.removeEntry("file-handle-getfile.txt").then(() => { }, () => { });
        fileHandle = await rootHandle.getFileHandle("file-handle-getfile.txt", { "create" : true });
        fileContent = "";

        // Write file content in worker.
        if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
            console.log('hello from WebWorker')
            accessHandle = await fileHandle.createSyncAccessHandle();
            const encoder = new TextEncoder();
            fileContent = "This is a test.";
            writeBuffer = encoder.encode(fileContent);
            writeSize = accessHandle.write(writeBuffer, { "at" : 0 });
            shouldBe("writeSize", "writeBuffer.byteLength");
            accessHandle.flush(); // This is a new line
            accessHandle.close();
        }

        fileHandle = await rootHandle.getFileHandle("file-handle-getfile.txt"); // This is a new line
        fileObject = await fileHandle.getFile();
        readText = await read(fileObject);
        shouldBe("readText", "fileContent");

        finishTest();
    } catch (error) {
        finishTest(error.toString());
    }
}
```

Then run LayoutTest:
https://github.com/WebKit/WebKit/blob/main/LayoutTests/storage/filesystemaccess/file-handle-getfile-worker.html

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230112/d312f8f1/attachment.htm>


More information about the webkit-unassigned mailing list