opfs-shapool error in Safari and Firefox private mode
Closed this issue · 3 comments
See the top section of https://sqlite.org/wasm/doc/trunk/persistence.md.
@sgbeal Thank you for pointing me to the docs, and I am sorry I didn't read it carefully.
Private mode can't be detected reliably except Evolu can detect it via SQLite WASM throwing errors and in that case (which can be caused by other things like obsolete browser etc.), I think the best Evolu can do is to provide in-memory SQLite restricted to one tab. Do you think that could work? Thank you for your insight.
You don't strictly need to catch any exceptions to notice the lack of OPFS. The two simplest ways to detect the "opfs" VFS are:
- See if
sqlite3.capi.sqlite3_vfs_find("opfs")returns a truthy value. - Check for the existence of
sqlite3.oo1.OpfsDb.
If either of those are truthy, the "opfs" VFS is available.
For "opfs-sahpool", sqlite3.installOpfsSAHPoolVfs() will exist only if that VFS is available.
Assuming you don't need your data to be persistent, falling back to the default DB storage (in-memory via Emscripten's transparent POSIX I/O proxying) is perfectly reasonable.
That said... it is also possible that incognito mode will expose OPFS but will not make it persistent, or will limit its capacity severely, or place any number of other restrictions. We have no way to automatically detect if that's the case. You can attempt to look closely at exceptions to guess if such restrictions are in place, but that sounds fragile.

