RESOLVED FIXED Bug 255458
`navigator.storage.getDirectory()` fails in nested workers with an `InvalidStateError`
https://bugs.webkit.org/show_bug.cgi?id=255458
Summary `navigator.storage.getDirectory()` fails in nested workers with an `InvalidSt...
Thomas Steiner
Reported 2023-04-14 08:57:07 PDT
Created attachment 465914 [details] Safari 1. Go to https://opfs-in-subworker.glitch.me/ in Chrome or Firefox. 2. Open the Console. 3. Note how calls to `navigator.storage.getDirectory()` succeed in the main thread, a worker, and a subworker. 4. Go to https://opfs-in-subworker.glitch.me/ in Safari. 5. Open the Console. 6. Note how calls to `navigator.storage.getDirectory()` succeed in the main thread, a worker, but fail in a subworker with an `InvalidStateError`. ## Console dump from Safari: [Log] Succeeded in main thread (script.js, line 4) FileSystemDirectoryHandle kind: "directory" name: "" FileSystemDirectoryHandle Prototype [Log] Succeeded in worker.js (worker.js, line 4) FileSystemDirectoryHandle kind: "directory" name: "" FileSystemDirectoryHandle Prototype [Log] Message from subworker.js: (worker.js, line 12) Object error: InvalidStateError: The object is in an invalid state. code: 11 message: "The object is in an invalid state." name: "InvalidStateError" Error Prototype message: "Failed in subworker.js InvalidStateError: The object is in an invalid state." Object Prototype I believe the problem lies somewhere here: https://github.com/WebKit/WebKit/blob/9da2b02e31a2ba79c73354b04dc59aea0d04bb88/Source/WebCore/Modules/storage/StorageManager.cpp#L138-L141.
Attachments
Safari (203.39 KB, image/png)
2023-04-14 08:57 PDT, Thomas Steiner
no flags
Chrome (117.54 KB, image/png)
2023-04-14 08:59 PDT, Thomas Steiner
no flags
Thomas Steiner
Comment 1 2023-04-14 08:59:19 PDT
Created attachment 465915 [details] Chrome For comparison, the Console output in Chrome.
Thomas Steiner
Comment 2 2023-04-14 09:01:55 PDT
(Note that due to https://bugs.webkit.org/show_bug.cgi?id=255402 I had to `postMessage()` any logs from subworker.js to worker.js to see anything.)
Radar WebKit Bug Importer
Comment 4 2023-04-14 15:52:26 PDT
Sihui Liu
Comment 5 2023-04-17 16:50:56 PDT
EWS
Comment 6 2023-04-18 08:52:15 PDT
Committed 263075@main (808b1c7f159a): <https://commits.webkit.org/263075@main> Reviewed commits have been landed. Closing PR #12833 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.