From cc1e80e5a204d08eeba36a2bd29f206f3d7f8948 Mon Sep 17 00:00:00 2001 From: Austin Sullivan Date: Wed, 18 May 2022 21:02:27 -0700 Subject: [PATCH] FSA: Reject with NoModificationAllowedError if AccessHandle is locked Spec PR: https://github.com/whatwg/fs/pull/21 Comment: https://github.com/whatwg/fs/pull/21/files#r876204287 Updates the implementation to match the spec and to match other cases where we reject a promise because of a locked file. Bug: N/A Change-Id: I201fa40a866ecace62c6fe77ad70cffce57c2553 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3653903 Reviewed-by: Marijn Kruisselbrink Auto-Submit: Austin Sullivan Commit-Queue: Marijn Kruisselbrink Cr-Commit-Position: refs/heads/main@{#1005103} --- ...cess-handle-writable-lock.https.tentative.worker.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/FileSystemFileHandle-sync-access-handle-writable-lock.https.tentative.worker.js b/fs/FileSystemFileHandle-sync-access-handle-writable-lock.https.tentative.worker.js index a2ed99db1d538a..4fe120b21fb103 100644 --- a/fs/FileSystemFileHandle-sync-access-handle-writable-lock.https.tentative.worker.js +++ b/fs/FileSystemFileHandle-sync-access-handle-writable-lock.https.tentative.worker.js @@ -8,7 +8,7 @@ directory_test(async (t, root_dir) => { const syncHandle1 = await fileHandle.createSyncAccessHandle(); await promise_rejects_dom( - t, 'InvalidStateError', fileHandle.createSyncAccessHandle()); + t, 'NoModificationAllowedError', fileHandle.createSyncAccessHandle()); await syncHandle1.close(); const syncHandle2 = await fileHandle.createSyncAccessHandle(); @@ -24,7 +24,7 @@ directory_test(async (t, root_dir) => { const barSyncHandle1 = await barFileHandle.createSyncAccessHandle(); await promise_rejects_dom( - t, 'InvalidStateError', barFileHandle.createSyncAccessHandle()); + t, 'NoModificationAllowedError', barFileHandle.createSyncAccessHandle()); await barSyncHandle1.close(); const barSyncHandle2 = await barFileHandle.createSyncAccessHandle(); @@ -61,7 +61,7 @@ directory_test(async (t, root_dir) => { const syncHandle = await fileHandle.createSyncAccessHandle(); await promise_rejects_dom( - t, 'InvalidStateError', fileHandle.createWritable()); + t, 'NoModificationAllowedError', fileHandle.createWritable()); await syncHandle.close(); const writable = await fileHandle.createWritable(); @@ -74,11 +74,11 @@ directory_test(async (t, root_dir) => { const writable1 = await fileHandle.createWritable(); const writable2 = await fileHandle.createWritable(); await promise_rejects_dom( - t, 'InvalidStateError', fileHandle.createSyncAccessHandle()); + t, 'NoModificationAllowedError', fileHandle.createSyncAccessHandle()); await writable1.close(); await promise_rejects_dom( - t, 'InvalidStateError', fileHandle.createSyncAccessHandle()); + t, 'NoModificationAllowedError', fileHandle.createSyncAccessHandle()); await writable2.close(); const syncHandle = await fileHandle.createSyncAccessHandle();