Skip to content

queryPermission() shouldn't return "prompt" when a handle retrieved from idb no longer exists on drive #313

@ZYinMD

Description

@ZYinMD

In my app, the user grants permission to a folder, then I store the handle in idb. On the next launch, I retrieve the handle and call requestPermission() to ask for permission again.

Goal:
I want to avoid showing the folder picker window. Since the folder location probably didn't change, showing the folder picker is an unnecessary step, and negatively affects user experience if the user don't remember to previous location they used.

Problem:
If the folder has been deleted / renamed / moved, the page will still prompt for permission to the old location. If the user clicks "agree", the subsequent read / write will fail, only then will I know the folder is gone, and show a picker again. This is confusing to the user.

Solution:
After a handle is retrieved from idb, there should be a way to test if it still exists on drive, and browser should be able to test that without requiring user permission. If the old location is still there, then I can request user permission. If the the old location is gone, I'll display a picker.

(This may open doors to certain ways of abuse, but we can devise some restrictions)

Proposal
If the handle no longer exist on drive, maybe let queryPermission() return 'denied'?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions