Closed Bug 1318713 Opened 8 years ago Closed 2 years ago

StorageEstimate.usage doesn't seem to include localStorage

Categories

(Core :: Storage: StorageManager, defect, P3)

51 Branch
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: sheppy, Unassigned)

References

Details

Attachments

(1 file)

I've been working on docs for the navigator.storage.estimate() and the related content, and while trying to make a simple example, I used code like this on a page with a decent amount of content:

for (var i=0; i<1000; i++) {
  localStorage.setKey("key" + i.toString(), document.documentElement.innerHTML);
}

The goal was to add some stuff to localStorage and then fetch the usage to show that it'd changed. But it doesn't. It stays 0 the entire time.

According to the Storage Standard spec, localStorage should apply to this figure, and the code seems to reference localStorage, so I'm confused why this doesn't work. Maybe I've got something wrong but I've done a similar test using indexedDB and that works fine.
Eric, thanks for the documentation and thanks for reporting this issue. :) No, you didn't misunderstand anything; this is a known issue that we plan to integrate localstorage to quotamanager/storage later.

Shawn, please feel free to chime in if you have more to share, thanks.
Priority: -- → P3
See Also: → 742822, 960707
Depends on: 1286798
Component: DOM → DOM: Core & HTML

Moving this to storage, but I assume this is fixed if the pref to LSNG is enabled?

Component: DOM: Core & HTML → Storage: StorageManager

I don't think it is fixed. Chrome performs in the same way BTW. Should this be considered working as intended?

Flags: needinfo?(ttung)

(In reply to zerolxy from comment #3)

I don't think it is fixed. Chrome performs in the same way BTW. Should this be considered working as intended?

Could you elaborate more on why you don't think it's fixed? Are you saying that you enable the dom.storage.next_gen in "about:config" and find out that the size of storage in local storage isn't included?

We are working on turning that pref by default on all channels. At the moment, it's enabled by default on EARLY_BETA_OR_EARLIER (which means Nightly and early Beta)

You can track the status of enabling the pref by default on Release on Bug 1599979.

Flags: needinfo?(ttung) → needinfo?(zerolxy)

Sorry, my bad. Verified it was working after turning on dom.storage.next_gen.

BTW, what other features does dom.storage.next_gen provide? Is there a doc?

Flags: needinfo?(zerolxy)

(In reply to zerolxy from comment #5)

BTW, what other features does dom.storage.next_gen provide? Is there a doc?

Good question! The dom.storage.next_gen provides many features and I think there are some documentations for that.

Jens, do you happen to know the links for the docs that what features does dom.storage.next_gen provide for users and developers?

Flags: needinfo?(jstutte)

You can also check dependent bugs in bug 1286798 and bug 1504142.

Flags: needinfo?(jstutte)

LSNG is now enabled by default.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: