Open Bug 1509443 Opened 10 months ago Updated 10 months ago

Browser storage limit is 2 GB instead of 50% of free disk space

Categories

(Core :: DOM: Quota Manager, defect, P2)

60 Branch
defect

Tracking

()

ASSIGNED

People

(Reporter: xewem, Assigned: tt, NeedInfo)

References

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0

Steps to reproduce:

According to https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Browser_storage_limits_and_eviction_criteria#Storage_limits
quota should be 50% of free disk space but quota in every Firefox profile is constant
2147483648 only 2GB is being assigned.



Actual results:

navigator.storage.estimate().then(console.log)
Object { quota: 2147483648, usage: 2147483648 }


Expected results:

quota should be 250GB when I've 500GB of free disk space but only 2GB is being assigned.
Some addons use unlimitedStorage and 2GB of quota is assigned. When quota is exceeded IndexedDB write throws the QuotaExceededError.
This isn't a problem with chrome, quota is assigned exactly 50% of free disk space.
Could this be modified such that Firefox has Quota with 50% of free disk space?
Component: Untriaged → DOM: Quota Manager
Product: Firefox → Core
Summary: Browser storage limits → Browser storage limit is 2 GB instead of 50% of free disk space
Tom, can you take a look when you're back next week?
Flags: needinfo?(shes050117)
Priority: -- → P2
Hi Ryan,

Did you persisted the origin before calling |storage.estimate()|?
Or, could you check whether the unlimitedStorage permission is turned on for that origin?

The presenting quota from |storage.estimate()| should still be 2GB in your case, but you shouldn't get QuotaExceededError if your Firefox hasn't used more than 248GB.

There a few things might confuse you. I put them below for your information:

1. Firefox currently has two types of origins. One is temporary/best-effort and the other is persistent. Firefox bounds the former one by the group limit and global limit, and bounds the latter one by the only global limit. The default persistence type of an origin is temporary/best-effort, and the |storage.estimate()| should show the site storage limit [1], so the result of |storage.estimate()| shows group limit only.

2. The "50% of free disk space" in [2] refers to the global limit rather the group limit.

3. Limitation for quota in Firefox:
  QuotaManager has two types of limitation for Firefox's quota. One is the global limit and the other is the group limit. While the global limit is used to prevent overall usage of Firefox from being too large, the group limit is used to limit the usage for each site (consisting of a few origins). You can find more explanation for the "site/group" in [2].

Note: For the unlimitedStorage permission, it integrates |navigator.storage| in Firefox 65 [3]. Before that, it's using persistent indexedDB. So, only indexedDB storage for that origin is persisted before this version for unlimitedStorage.

[1] https://storage.spec.whatwg.org/#dom-storagemanager-estimate
[2] https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Browser_storage_limits_and_eviction_criteria#Storage_limits
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=1496801
Assignee: nobody → shes050117
Flags: needinfo?(shes050117) → needinfo?(xewem)
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Hi Tom,
Store Data in Persistent Storage is allowed for the origin.
Flags: needinfo?(xewem)
I get QuotaExceededError when my navigator.storage is full, though I have 500GB of free disk space.
This is the result of estimate() when QuotaExceededError is thrown.
navigator.storage.estimate().then(console.log)
Object { quota: 2147483648, usage: 2147483648 }
See Also: → 1212985
Hi Ryan,

Thanks for the reply!
So, your "Store Data in Persistent Storage" is allowed for the origin. It's a permission for allowing navigator.storage.persist. I guess I need more information to confirm the issue:

- Did you add an option when you open the IndexedDB database? (e.g. indexedDB.open(DB_NAME, { version: DB_VERSION, storage: "persistent" }), "persistent" is the option here) If so, what kind of persistence type do you use for indexedDB?
- Could you check whether the result of |navigator.storage.persisted()| is true or not for that origin?
- When did you call the |navigator.storage.persist()|? If it was called after you got the QuotaExceededError, could you try it again after restarting your browser?
Flags: needinfo?(xewem)
(In reply to Tom Tung [:tt, :ttung] from comment #6)
> Thanks for the reply!
> So, your "Store Data in Persistent Storage" is allowed for the origin. It's
> a permission for allowing navigator.storage.persist. I guess I need more

To elaborate a bit more, once the origin get persist(), the usage of the origin won't be counted as a part of the group usage. That means if there is no any other origin in that group, the usage should be zero.
You need to log in before you can comment on or make changes to this bug.