Skip to content

Commit

Permalink
[NativeFS] Update permissions API following spec change.
Browse files Browse the repository at this point in the history
This implements the changes from WICG/file-system-access#201.

Change-Id: I9702f9888c4f0fff2084143ac6077b8484dfce16
  • Loading branch information
mkruisselbrink authored and chromium-wpt-export-bot committed Jul 21, 2020
1 parent 3140f97 commit 003e743
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions native-file-system/resources/messaging-serialize-helpers.js
Expand Up @@ -31,10 +31,10 @@ async function serialize_handle(handle) {
// FileSystemDirectoryHandle.
async function serialize_file_system_handle(handle) {
const read_permission =
await handle.queryPermission({ writable: false });
await handle.queryPermission({ mode: 'read' });

const write_permission =
await handle.queryPermission({ writable: true })
await handle.queryPermission({ mode: 'readwrite' })

return {
kind: handle.kind,
Expand Down
6 changes: 3 additions & 3 deletions native-file-system/resources/native-fs-test-helpers.js
Expand Up @@ -41,14 +41,14 @@ function directory_test(func, description) {
}

directory_test(async (t, dir) => {
assert_equals(await dir.queryPermission({writable: false}), 'granted');
assert_equals(await dir.queryPermission({mode: 'read'}), 'granted');
}, 'User succesfully selected an empty directory.');

directory_test(async (t, dir) => {
const status = await dir.queryPermission({writable: true});
const status = await dir.queryPermission({mode: 'readwrite'});
if (status == 'granted')
return;

await window.test_driver.bless('ask for write permission');
assert_equals(await dir.requestPermission({writable: true}), 'granted');
assert_equals(await dir.requestPermission({mode: 'readwrite'}), 'granted');
}, 'User granted write access.');
2 changes: 1 addition & 1 deletion native-file-system/showSaveFilePicker-manual.https.html
Expand Up @@ -26,7 +26,7 @@

promise_test(async t => {
assert_equals(await file.queryPermission(), 'granted');
assert_equals(await file.queryPermission({ writable: true }), 'granted');
assert_equals(await file.queryPermission({ mode: 'readwrite' }), 'granted');
}, 'showSaveFilePicker returns correct permissions');
}, 'showSaveFilePicker works');

Expand Down

0 comments on commit 003e743

Please sign in to comment.