RESOLVED FIXED 232067
FileSystemSyncAccessHandle should close platform file handle on close()
https://bugs.webkit.org/show_bug.cgi?id=232067
Summary FileSystemSyncAccessHandle should close platform file handle on close()
Sihui Liu
Reported 2021-10-21 01:05:28 PDT
...
Attachments
Patch (12.61 KB, patch)
2021-10-21 01:08 PDT, Sihui Liu
no flags
Patch (18.35 KB, patch)
2021-10-21 08:27 PDT, Sihui Liu
no flags
Patch (19.99 KB, patch)
2021-10-21 12:00 PDT, Sihui Liu
no flags
Sihui Liu
Comment 1 2021-10-21 01:08:48 PDT
Sihui Liu
Comment 2 2021-10-21 08:27:17 PDT
youenn fablet
Comment 3 2021-10-21 09:17:52 PDT
Comment on attachment 442028 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=442028&action=review > Source/WebCore/Modules/filesystemaccess/FileSystemSyncAccessHandle.cpp:53 > m_source->close(m_identifier, [](auto) { }); We should probably also make sure we close also if ScriptExecutionContext is stopped. Normally there should be no issue but it does not hurt to close sooner rather than later. > Source/WebCore/Modules/filesystemaccess/FileSystemSyncAccessHandle.cpp:100 > + if (m_state == State::Closing) Why do we need the Closing state? It seems only useful for the promise rejection message. I am not sure this is worth the effort. > Source/WebCore/Modules/filesystemaccess/FileSystemSyncAccessHandle.cpp:130 > + return Exception { InvalidStateError, "AccessHandle is being closed or closed"_s }; I would write it as "AccessHandle is closing or closed" or "AccessHandle is not active". > LayoutTests/imported/w3c/web-platform-tests/file-system-access/sandboxed_FileSystemSyncAccessHandle-close.https.tentative.worker-expected.txt:4 > +FAIL SyncAccessHandle.read fails after SyncAccessHandle.close settles promise_test: Unhandled rejection with value: object "InvalidStateError: AccessHandle is closed" Why are we failing those tests? Are we missing something to be able to run properly sync_access_handle_test. It would seem worthwhile to make sure we run these tests properly.
Sihui Liu
Comment 4 2021-10-21 09:32:34 PDT
(In reply to youenn fablet from comment #3) > Comment on attachment 442028 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=442028&action=review > > > Source/WebCore/Modules/filesystemaccess/FileSystemSyncAccessHandle.cpp:53 > > m_source->close(m_identifier, [](auto) { }); > > We should probably also make sure we close also if ScriptExecutionContext is > stopped. Normally there should be no issue but it does not hurt to close > sooner rather than later. Yeah I will follow up in a separate bugs, filed https://bugs.webkit.org/show_bug.cgi?id=231250 before. > > > Source/WebCore/Modules/filesystemaccess/FileSystemSyncAccessHandle.cpp:100 > > + if (m_state == State::Closing) > > Why do we need the Closing state? > It seems only useful for the promise rejection message. > I am not sure this is worth the effort. Will remove. > > > Source/WebCore/Modules/filesystemaccess/FileSystemSyncAccessHandle.cpp:130 > > + return Exception { InvalidStateError, "AccessHandle is being closed or closed"_s }; > > I would write it as "AccessHandle is closing or closed" or "AccessHandle is > not active". Sure. > > > LayoutTests/imported/w3c/web-platform-tests/file-system-access/sandboxed_FileSystemSyncAccessHandle-close.https.tentative.worker-expected.txt:4 > > +FAIL SyncAccessHandle.read fails after SyncAccessHandle.close settles promise_test: Unhandled rejection with value: object "InvalidStateError: AccessHandle is closed" > > Why are we failing those tests? Are we missing something to be able to run > properly sync_access_handle_test. > It would seem worthwhile to make sure we run these tests properly. I don't think we are missing things for this test. I will adjust the implementation to match the test expectation.
Radar WebKit Bug Importer
Comment 5 2021-10-21 11:47:41 PDT
Sihui Liu
Comment 6 2021-10-21 12:00:54 PDT
EWS
Comment 7 2021-10-21 16:13:10 PDT
Committed r284652 (243372@main): <https://commits.webkit.org/243372@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 442055 [details].
Note You need to log in before you can comment on or make changes to this bug.