RESOLVED FIXED 273906
`navigator.storage.getDirectory()` fails in service workers with an `NotSupportedError: The operation is not supported`
https://bugs.webkit.org/show_bug.cgi?id=273906
Summary `navigator.storage.getDirectory()` fails in service workers with an `NotSuppo...
Jiwen Cai
Reported 2024-05-08 15:19:09 PDT
Attachments
Jiwen Cai
Comment 1 2024-05-08 16:17:38 PDT
To reproduce: 1. Go to https://opfs-in-service-worker.glitch.me/ in Chrome or Firefox. 2. Open the Console. 3. Note how calls to `navigator.storage.getDirectory()` succeed in the service worker. 4. Go to https://opfs-in-service-worker.glitch.me/ in Safari. 5. Open the Console. 6. Note how calls to `navigator.storage.getDirectory()` succeed in the main thread, web worker, but fail in a service worker with an `NotSupportedError`.
Ahmad Saleem
Comment 2 2024-05-08 17:18:07 PDT
@Jiwen - is it recent regression and use to work earlier?
Radar WebKit Bug Importer
Comment 3 2024-05-08 17:18:17 PDT
Jiwen Cai
Comment 4 2024-05-08 17:21:15 PDT
Hi @Ahmad, this is the first time we attempted to use this. Not sure it's a regression.
Karl Dubost
Comment 5 2024-05-08 22:25:37 PDT
Probably Youenn might know about it.
youenn fablet
Comment 6 2024-05-13 07:01:12 PDT
We are exposing StorageManager to service workers but are not setting the service worker StorageProvider. We should probably set the StorageProvider or alternatively disable StorageManager in service worker contexts.
Jiwen Cai
Comment 7 2024-05-28 15:52:21 PDT
Hey folks, thanks for taking a look at this. Supporting OPFS in service worker helps a lot for us to better managing large file caching using local storage. It's quite useful feature overall.
youenn fablet
Comment 8 2024-06-07 03:03:17 PDT
youenn fablet
Comment 9 2024-06-11 05:44:24 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/46690
EWS
Comment 10 2024-06-11 06:54:28 PDT
Committed 279908@main (c47f4cabd53d): <https://commits.webkit.org/279908@main> Reviewed commits have been landed. Closing PR #29615 and removing active labels.
Jiwen Cai
Comment 11 2024-06-23 19:54:23 PDT
Thanks for fixing this. Do we know which Safari version can be expect this to land?
Note You need to log in before you can comment on or make changes to this bug.