Intent to Implement: Storage Quota Estimation API

397 views
Skip to first unread message

Joshua Bell

unread,
Apr 15, 2016, 7:37:10 PM4/15/16
to blink-dev


Contact emails

jsb...@chromium.org,dk...@chromium.org


Spec

https://storage.spec.whatwg.org


Summary

Introduce navigator.storage.estimate(). Returns a Promise resolving to {usage, quota} values in bytes.


Motivation

Web apps using storage for offline or caching purposes need to answer questions like:


* Do I have enough storage available to let the user save this media file for for offline use?

* How many documents should I attempt to transparently cache for offline use?

* How many items should I cache for quick display on slow connections?


Notably, they want to do this from Service Workers.


Chrome has two (!) other equivalent quota APIs implemented:


navigator.webkitTemporaryStorage.queryUsageAndQuota()
navigator.storageQuota.queryInfo(type)
Both are predicated on a "temporary vs. persistent bucket" concept that has been abandoned in favor of a whole-origin persistent permission (see https://groups.google.com/a/chromium.org/d/msg/blink-dev/C-VcxpqInow/GiRFMFlsrRoJ for I2I for that.)

This is effectively the latest attempt at getting this API right and (assuming we get positive feedback from developers) would supplant the previous methods.


Interoperability and Compatibility Risk

  • Edge currently has a very different model for quota - rather than a whole-origin limit, each storage type (indexed db, local storage, etc) has its own limit.
  • Firefox has expressed intent to start implementation here soon.

Ongoing technical constraints

The proposed implementation (https://codereview.chromium.org/1855623002) reuses most of the existing plumbing and just skins it with a new API, so this does not e.g. introduce new IPC plumbing. Assuming this eventually ships we can back out at least some of the other quota API code.


This lives on a new navigator.storage object added as part of the Durable Storage work, which has not yet shipped. If these don't ship at the same time we'll need to rejigger the flags.


Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes or no. If no, explain why certain platforms will not be included in your implementation.


OWP launch tracking bug

https://crbug.com/603992


Link to entry on the feature dashboard

https://www.chromestatus.com/feature/5630353511284736


Requesting approval to ship?

No.


Joshua Bell

unread,
Apr 15, 2016, 7:47:18 PM4/15/16
to blink-dev

Yes.

Reply all
Reply to author
Forward
0 new messages