Skip to content

Commit

Permalink
Remove queryPermission() usage from wpt/fs helper function.
Browse files Browse the repository at this point in the history
Permission is not required in OPFS.
whatwg/fs#42

Bug: 1362626
Change-Id: I2c75c0374c9f5a9c323a03950f7bd3bdd4a93750
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3923838
Commit-Queue: Daseul Lee <dslee@chromium.org>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1054413}
  • Loading branch information
dslee414 authored and chromium-wpt-export-bot committed Oct 3, 2022
1 parent 783b6d8 commit 3a64a7f
Showing 1 changed file with 3 additions and 28 deletions.
31 changes: 3 additions & 28 deletions fs/resources/messaging-serialize-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,9 @@ async function serialize_handle(handle) {
// serialized properties shared by both FileSystemFileHandle and
// FileSystemDirectoryHandle.
async function serialize_file_system_handle(handle) {
let read_permission = "granted";
let write_permission = "granted";
// query-permission is part of the File System Acecss API
// https://wicg.github.io/file-system-access, which may not be supported
if ("queryPermission" in FileSystemHandle.prototype) {
read_permission =
await handle.queryPermission({ mode: 'read' });

write_permission =
await handle.queryPermission({ mode: 'readwrite' })
}
return {
kind: handle.kind,
name: handle.name,
read_permission,
write_permission
name: handle.name
};
}

Expand All @@ -54,9 +41,7 @@ async function serialize_file_system_handle(handle) {
// dictionary. Example output:
// {
// kind: "file",
// name: "example-file-name"
// read_permission: "granted",
// write_permission: "granted",
// name: "example-file-name",
// contents: "example-file-contents"
// }
async function serialize_file_system_file_handle(file_handle) {
Expand All @@ -72,9 +57,7 @@ async function serialize_file_system_file_handle(file_handle) {
// Example output:
// {
// kind: "directory",
// name: "example-directory-name"
// read_permission: "granted",
// write_permission: "granted",
// name: "example-directory-name",
// files: [<first serialized file>, ...]
// directories: [<first serialized subdirectory>, ...]
// }
Expand Down Expand Up @@ -161,14 +144,6 @@ function assert_equals_serialized_file_system_handle(left, right) {
assert_equals(left.name, right.name,
'Each FileSystemHandle instance must use the expected "name" ' +
' property.');

assert_equals(left.read_permission, right.read_permission,
'Each FileSystemHandle instance must have the expected read ' +
' permission.');

assert_equals(left.write_permission, right.write_permission,
'Each FileSystemHandle instance must have the expected write ' +
' permission.');
}

// Compares the output of serialize_file_system_file_handle()
Expand Down

0 comments on commit 3a64a7f

Please sign in to comment.