[Webkit-unassigned] [Bug 250495] Data written via FileSystemSyncAccessHandle disappears after creating new FileSystemFileHandle

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 12 11:26:36 PST 2023


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

Sihui Liu <sihui_liu at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|FileSystemSyncAccessHandle  |Data written via
                   |does not flush data         |FileSystemSyncAccessHandle
                   |                            |disappears after creating
                   |                            |new FileSystemFileHandle

--- Comment #2 from Sihui Liu <sihui_liu at apple.com> ---
(In reply to Alex Titarenko from comment #1)
> 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/b5a0de6c/attachment.htm>


More information about the webkit-unassigned mailing list