Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getPackageDirectoryEntry in service workers #471

Open
dotproto opened this issue Oct 18, 2023 · 6 comments
Open

getPackageDirectoryEntry in service workers #471

dotproto opened this issue Oct 18, 2023 · 6 comments
Labels
inconsistency Inconsistent behavior across browsers topic: service worker Related to service worker background scripts

Comments

@dotproto
Copy link
Member

dotproto commented Oct 18, 2023

Issue mdn/content#2986 notes that the MDN documentation for runtime.getPackageDirectoryEntry() isn't accurate. In order to help resolve that documentation issue, I'd like to ask the Chrome team for clarification on a couple of questions.

  1. In the future will runtime.getPackageDirectoryEntry() return a promise in Chrome?

  2. Does Chrome plan to support this method in service workers?

  3. I assume that Chrome didn't expose getPackageDirectoryEntry() in service workers because the DirectoryEntry interface isn't exposed in that context. If true, does Chrome have plans to enable extensions to access similar capabilities or data using an alternative API?

@dotproto dotproto added inconsistency Inconsistent behavior across browsers topic: service worker Related to service worker background scripts follow-up: chrome Needs a response from a Chrome representative labels Oct 18, 2023
@tophf
Copy link

tophf commented Oct 19, 2023

It might be possible to "re-base" it on the new File System Access API, which AFAIK uses a very similar API for File and Directory entries that are allowed in a service worker. As for the missing stuff that will need to be emulated or dropped, someone should look at the old FileSystem API and list them.

@jpmedley
Copy link

@jpmedley
Copy link

One other thing:

One note with that particular API though is that it's not exposed to service workers, but is available in other contexts (extension popup, web pages inside the extension, etc.).

@tophf
Copy link

tophf commented Dec 13, 2023

That commit is unrelated and won't help because service workers don't have DOM, which is required by this API.

@jpmedley
Copy link

Sorry about that. I'm playing catchup, so moving a bit fast. Too fast, clearly.

@rdcronin
Copy link
Contributor

In the future will runtime.getPackageDirectoryEntry() return a promise in Chrome?

Yes. This is done.

Does Chrome plan to support this method in service workers?

Not at any point in the near future.

I assume that Chrome didn't expose getPackageDirectoryEntry() in service workers because the DirectoryEntry interface isn't exposed in that context. If true, does Chrome have plans to enable extensions to access similar capabilities or data using an alternative API?

We're unlikely to add anything specifically for this. Depending on the use case, alternatives exist (e.g., if you just need file content, you can fetch() it).

This is a pretty old API that we've talked about removing in the past, but it has non-trivial usage.

@oliverdunk oliverdunk removed the follow-up: chrome Needs a response from a Chrome representative label Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inconsistency Inconsistent behavior across browsers topic: service worker Related to service worker background scripts
Projects
None yet
Development

No branches or pull requests

5 participants