From 4c0c4e0ca21f965dadb6c6299264316d1586a8cd Mon Sep 17 00:00:00 2001 From: Emanuel Krivoy Date: Thu, 7 Apr 2022 19:17:52 +0000 Subject: [PATCH] Bug 1763185 [wpt PR 33516] - Revert "Add options parameter to createSyncAccessHandle()", a=testonly Automatic update from web-platform-tests Revert "Add options parameter to createSyncAccessHandle()" This reverts commit ca2d8b837fca8a7bd3bd0ba1562c7cc090108374. Reason for revert: To avoid compatibility issues with Safari (that has already shipped this API without the options param) and leave the design of the object fully open, we decided to remove the parameter. Further context in https://github.com/whatwg/fs/issues/19. Original change's description: > Add options parameter to createSyncAccessHandle() > > For now the only accepted (and required) option is "mode: 'in-place'". > Having this parameter allows us to later define a more appropriate > default behavior for access handles than the one we currently implement. > This is specially useful in the context of expanding access handle usage > outside of OPFS. > > For more details check: > https://github.com/WICG/file-system-access/blob/main/AccessHandle.md#exposing-accesshandles-on-all-filesystems > > Bug: 1218431 > Change-Id: I50d0a4acfd81874e17b6b28d1c2bf446b0397a4d > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3110487 > Reviewed-by: Marijn Kruisselbrink > Commit-Queue: Emanuel Krivoy > Cr-Commit-Position: refs/heads/main@{#982209} Bug: 1218431 Change-Id: I11dd5044b59e1fec8444242869628129efa5cf17 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3572141 Reviewed-by: Austin Sullivan Commit-Queue: Emanuel Krivoy Cr-Commit-Position: refs/heads/main@{#989350} -- wpt-commits: 9082234ee4b01d20a4e9eec0297155e2e5f6838f wpt-pr: 33516 --- .../resources/message-target.js | 3 +-- .../resources/sync-access-handle-test.js | 3 +-- ...le-writable-lock.https.tentative.worker.js | 26 +++++++++---------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/testing/web-platform/tests/file-system-access/resources/message-target.js b/testing/web-platform/tests/file-system-access/resources/message-target.js index 175d139c604e8..211caeb6cca2f 100644 --- a/testing/web-platform/tests/file-system-access/resources/message-target.js +++ b/testing/web-platform/tests/file-system-access/resources/message-target.js @@ -108,8 +108,7 @@ function add_message_event_handlers(receiver, target, target_origin) { // success to the sender. let success = true; try { - const access_handle = await message_data.file_handle - .createSyncAccessHandle({mode: "in-place"}); + const access_handle = await message_data.file_handle.createSyncAccessHandle(); await access_handle.close(); } catch (error) { success = false; diff --git a/testing/web-platform/tests/file-system-access/resources/sync-access-handle-test.js b/testing/web-platform/tests/file-system-access/resources/sync-access-handle-test.js index 489eeb8e2fe4e..ec13ff9a06bc6 100644 --- a/testing/web-platform/tests/file-system-access/resources/sync-access-handle-test.js +++ b/testing/web-platform/tests/file-system-access/resources/sync-access-handle-test.js @@ -10,8 +10,7 @@ function sync_access_handle_test(test, description) { await cleanupSandboxedFileSystem(); const dir = await navigator.storage.getDirectory(); const fileHandle = await dir.getFileHandle('OPFS.test', {create: true}); - const syncHandle = await fileHandle - .createSyncAccessHandle({mode: "in-place"}); + const syncHandle = await fileHandle.createSyncAccessHandle(); await test(t, syncHandle); await syncHandle.close(); }, description); diff --git a/testing/web-platform/tests/file-system-access/sandboxed_FileSystemFileHandle-sync-access-handle-writable-lock.https.tentative.worker.js b/testing/web-platform/tests/file-system-access/sandboxed_FileSystemFileHandle-sync-access-handle-writable-lock.https.tentative.worker.js index 51e7f63d12f04..a2ed99db1d538 100644 --- a/testing/web-platform/tests/file-system-access/sandboxed_FileSystemFileHandle-sync-access-handle-writable-lock.https.tentative.worker.js +++ b/testing/web-platform/tests/file-system-access/sandboxed_FileSystemFileHandle-sync-access-handle-writable-lock.https.tentative.worker.js @@ -6,12 +6,12 @@ importScripts('resources/sandboxed-fs-test-helpers.js'); directory_test(async (t, root_dir) => { const fileHandle = await root_dir.getFileHandle('OPFS.test', {create: true}); - const syncHandle1 = await fileHandle.createSyncAccessHandle({mode: "in-place"}); + const syncHandle1 = await fileHandle.createSyncAccessHandle(); await promise_rejects_dom( - t, 'InvalidStateError', fileHandle.createSyncAccessHandle({mode: "in-place"})); + t, 'InvalidStateError', fileHandle.createSyncAccessHandle()); await syncHandle1.close(); - const syncHandle2 = await fileHandle.createSyncAccessHandle({mode: "in-place"}); + const syncHandle2 = await fileHandle.createSyncAccessHandle(); await syncHandle2.close(); }, 'There can only be one open access handle at any given time'); @@ -19,15 +19,15 @@ directory_test(async (t, root_dir) => { const fooFileHandle = await root_dir.getFileHandle('foo.test', {create: true}); const barFileHandle = await root_dir.getFileHandle('bar.test', {create: true}); - const fooSyncHandle = await fooFileHandle.createSyncAccessHandle({mode: "in-place"}); + const fooSyncHandle = await fooFileHandle.createSyncAccessHandle(); t.add_cleanup(() => fooSyncHandle.close()); - const barSyncHandle1 = await barFileHandle.createSyncAccessHandle({mode: "in-place"}); + const barSyncHandle1 = await barFileHandle.createSyncAccessHandle(); await promise_rejects_dom( - t, 'InvalidStateError', barFileHandle.createSyncAccessHandle({mode: "in-place"})); + t, 'InvalidStateError', barFileHandle.createSyncAccessHandle()); await barSyncHandle1.close(); - const barSyncHandle2 = await barFileHandle.createSyncAccessHandle({mode: "in-place"}); + const barSyncHandle2 = await barFileHandle.createSyncAccessHandle(); await barSyncHandle2.close(); }, 'An access handle from one file does not interfere with the creation of an' + ' access handle on another file'); @@ -39,7 +39,7 @@ directory_test(async (t, root_dir) => { const fooWritable = await fooFileHandle.createWritable(); t.add_cleanup(() => fooWritable.close()); - const barSyncHandle = await barFileHandle.createSyncAccessHandle({mode: "in-place"}); + const barSyncHandle = await barFileHandle.createSyncAccessHandle(); t.add_cleanup(() => barSyncHandle.close()); }, 'A writable stream from one file does not interfere with the creation of an' + ' access handle on another file'); @@ -48,7 +48,7 @@ directory_test(async (t, root_dir) => { const fooFileHandle = await root_dir.getFileHandle('foo.test', {create: true}); const barFileHandle = await root_dir.getFileHandle('bar.test', {create: true}); - const fooSyncHandle = await fooFileHandle.createSyncAccessHandle({mode: "in-place"}); + const fooSyncHandle = await fooFileHandle.createSyncAccessHandle(); t.add_cleanup(() => fooSyncHandle.close()); const barWritable = await barFileHandle.createWritable(); @@ -59,7 +59,7 @@ directory_test(async (t, root_dir) => { directory_test(async (t, root_dir) => { const fileHandle = await root_dir.getFileHandle('OPFS.test', {create: true}); - const syncHandle = await fileHandle.createSyncAccessHandle({mode: "in-place"}); + const syncHandle = await fileHandle.createSyncAccessHandle(); await promise_rejects_dom( t, 'InvalidStateError', fileHandle.createWritable()); @@ -74,14 +74,14 @@ directory_test(async (t, root_dir) => { const writable1 = await fileHandle.createWritable(); const writable2 = await fileHandle.createWritable(); await promise_rejects_dom( - t, 'InvalidStateError', fileHandle.createSyncAccessHandle({mode: "in-place"})); + t, 'InvalidStateError', fileHandle.createSyncAccessHandle()); await writable1.close(); await promise_rejects_dom( - t, 'InvalidStateError', fileHandle.createSyncAccessHandle({mode: "in-place"})); + t, 'InvalidStateError', fileHandle.createSyncAccessHandle()); await writable2.close(); - const syncHandle = await fileHandle.createSyncAccessHandle({mode: "in-place"}); + const syncHandle = await fileHandle.createSyncAccessHandle(); await syncHandle.close(); }, 'Access handles cannot be created if there are open Writable streams');