Intent to Prototype: OriginPrivateFileSystem

171 views
Skip to first unread message

Randell Jesup

unread,
Aug 18, 2022, 9:32:57 PM8/18/22
to dev-pl...@mozilla.org
Summary: OriginPrivateFileSystem API (WHATWG File System Standard)
Platform Coverage: all
Preference: dom.fs.enabled
Other Browsers:
- Chrome: Shipping (without a flag in 102+)
- Safari: Shipping (https://webkit.org/blog/12257/the-file-system-access-api-with-origin-private-file-system/ -- MacOS 12.2 and above, iOS 15.2 and above )

Note: This only includes support for the OriginPrivateFileSystem, not for the general File System Access API (https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API)

Context:

The Origin Private File System (OPFS) allows origins to store data consistent with the https://storage.spec.whatwg.org/ Storage Living Standard in browser-managed storage that is explicitly separate from the rest of the user’s filesystem or data stored by other origins.  The stored “site data” is reported and cleared by existing privacy and data management UI as covered by https://support.mozilla.org/en-US/kb/clear-cookies-and-site-data-firefox.

There are other proposed APIs that relate to allowing origins access to the user’s file system through explicit semi-durable grants, but we are not implementing or considering implementing those APIs at this time due to concerns about how to safely provide users with informed consent about providing origins with ongoing access to their file system.

OPFS is an important step forward in exposing storage primitives to the web that can be reasonably standardized while allowing the web platform to do powerful things more efficiently to reduce resource usage by the browser.  For example, https://github.com/simonw/datasette-lite is a tool built on top of SQLite running in the browser using WebAssembly.  SQLite compiled to WASM already works in the browser today, but is limited in efficiency by IndexedDB and the Cache API only providing immutable Blob/File/Response abstractions.

By providing primitives that allow efficient use of SQLite in the browser, we’re fulfilling the dream of Web SQL Database (https://en.wikipedia.org/wiki/Web_SQL_Database) which was impossible to standardize because it was just exposing the SQLite implementation to the web.  (It was also not a great idea from a security perspective, and indeed resulted in a number of security bugs, as SQLite was never meant to be exposed to adversarial code.)

OPFS will also enable other resource intensive web applications such as image editors, video editors, etc.
--
Randell Jesup, Mozilla

Nicolas Chevobbe

unread,
Aug 22, 2022, 2:54:16 AM8/22/22
to dev-pl...@mozilla.org, Randell Jesup
Should we file a DevTools bug for this?
I guess it would be useful for developers to be able to explore OPFS data easily
Reply all
Reply to author
Forward
0 new messages