Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web storage in extensions: quota, eviction and unlimitedStorage #388

Open
hanguokai opened this issue May 8, 2023 · 1 comment
Open
Labels
follow-up: safari Needs a response from a Safari representative topic: storage Issues related to persisting data. Topics include browser.storage, web storage, and new APIs.

Comments

@hanguokai
Copy link
Member

hanguokai commented May 8, 2023

Peter Coles asked a question1 in Chrome extension forum. I rearrange it and post it here.

Here I use "Web Storage" to represent all standards web storages, including Local Storage, Cache Storage, IndexedDB, OPFS, etc.

Quota and Eviction

Web Storage has the limitation of quotas and eviction and related API like StorageManager.persist() and StorageManager.estimate().

Should Web Storage in extensions be protected? Ideally, it should be treated as unlimited and not be evicted by default, i.e. navigator.storage.persisted() return true, like PWA installed Web apps.

Browsers Current Status Future Plan
Chrome not persistent persistent?23
Firefox not persistent ?
Safari ? ?

"unlimitedStorage" permission

Another orthogonal issue is "unlimitedStorage" extension permission.

Browsers current meaning Only applied to browser.storage.local? cover web storage in the future?
Chrome remove 10MB limit No, both extension and web -
Firefox more than web storage limit4 Yes ?
Safari remove 5MB limit5 Yes ?

Footnotes

  1. Web storage eviction question by Peter Coles

  2. Chromium issue 680392.

  3. Chromium issue 1209236.

  4. MDN storage.local

  5. Safari unlimitedStorage

@xeenon xeenon added follow-up: safari Needs a response from a Safari representative and removed needs-triage labels May 11, 2023
@dotproto dotproto added the topic: storage Issues related to persisting data. Topics include browser.storage, web storage, and new APIs. label May 25, 2023
@hanguokai
Copy link
Member Author

Here is a new article from Chrome about this topic: Storage and cookies in extensions. The article states that:

By default, extensions are subject to the normal quota restrictions on storage, which can be checked by calling navigator.storage.estimate(). Storage can also be evicted under heavy memory pressure, although this is rare. To avoid this:

  • Request the "unlimitedStorage" permission, which affects both extension and web storage APIs and exempts extensions from both quota restrictions and eviction.
  • Call navigator.storage.persist() for protection against eviction.

I will update my original table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
follow-up: safari Needs a response from a Safari representative topic: storage Issues related to persisting data. Topics include browser.storage, web storage, and new APIs.
Projects
None yet
Development

No branches or pull requests

3 participants