Issue metadata
Sign in to add a comment
|
Storage API: quota estimate() method |
||||||||||||||||||||||||||||||||||||||||||||
Issue description
(See http://www.chromium.org/blink#launch-process for an overview)
Change description:
Add estimate() method to navigator.storage to retrieve quota.
Changes to API surface:
navigator.storage.estimate() - returns Promise, which yields {usage, quota}
Links:
Public standards discussion: https://storage.spec.whatwg.org/
Support in other browsers:
Internet Explorer: no
Firefox: pending
Safari: no
,
May 3 2016
It's in experimentally, i.e. run chrome with --enable-experimental-web-platform-features. Feedback appreciated!
,
May 4 2016
Thanks, navigator.storage is now available to page and (more importantly to me) SW - will do some experiments.
,
May 16 2016
Hi,
I've done some experimenting and things work mostly as I had expected, thanks. I have three questions:
1. It seems a SW can't ask for a "box" to be persisted, is that correct according to the spec (I think so, want to verify)?
2. If the page asks to persist there is no prompt or anything - the UA just rejects. Should it be this way?
3. I've seen somewhere that you should be able to check the "persist state" by using navigator.permissions.query({name: "persistent-storage"}), but that does not seem to work. Have I got that part wrong?
Thanks,
Stefan
,
May 16 2016
These questions are more for the "durable storage" part rather than the "quota" part - e.g. stuff covered in the launch process under issue 502373 (for historical reasons we refer to the implementation of a "persistent storage permission" as "durable storage" in Chrome) 1. A SW should be able to call navigator.storage.persist() - if not, please file a bug! 2. Whether or not the UA shows UI is up to the UA. Chrome uses heuristics instead of a prompt. But it should resolve with "false" rather than rejecting if denied. 3. The navigator.permissions API is a bit in flux so we have no integrated the two yet. That's noted in the spec - "We will eventually integrate with the Permissions API... but since that specification is not in great shape at the moment that has not happened yet."
,
May 19 2016
Thanks for the response, I realised after hitting the "Save changes" button that my questions belonged elsewhere. I'll check again on 1. and file a bug if appropriate.
,
May 19 2016
navigator.storage.persist().then(() => {console.log("persist succ");}).catch(() => {console.log("persist fail");});
works fine in the browser console, but outputs
Uncaught TypeError: navigator.storage.persist is not a function(…)
in the SW console.
Where should I file the bug?
(Sorry to still be a bit off topic for this particular bug)
,
May 19 2016
Ah, sorry, no - persist() is not exposed in SW contexts, since some UAs may show a permission prompt and we (browser vendors) have not solved the "show a permission prompt from a SW" problem yet.
,
May 19 2016
To be clear, my comment in c#5 was wrong, sorry!
,
May 20 2016
Np, when I read the spec ('[Exposed=Window] Promise<boolean> persist();') that is what I expected.
,
Feb 10 2017
,
Apr 6 2017
Mozilla is apparently targeting FF57: https://wiki.mozilla.org/TPE_DOM/Storage#Roadmap
,
May 26 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/ce390470c7c40222140f1897f7405bc475d2f1a7 commit ce390470c7c40222140f1897f7405bc475d2f1a7 Author: jsbell <jsbell@chromium.org> Date: Fri May 26 16:46:01 2017 Enable navigator.storage.estimate() in stable Intent to Ship: https://groups.google.com/a/chromium.org/d/topic/blink-dev/frMdM1H8jJ8/discussion Spec: https://storage.spec.whatwg.org Status: https://www.chromestatus.com/feature/5630353511284736 BUG= 603992 Review-Url: https://codereview.chromium.org/2894953004 Cr-Commit-Position: refs/heads/master@{#475032} [modify] https://crrev.com/ce390470c7c40222140f1897f7405bc475d2f1a7/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt [modify] https://crrev.com/ce390470c7c40222140f1897f7405bc475d2f1a7/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt [modify] https://crrev.com/ce390470c7c40222140f1897f7405bc475d2f1a7/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt [modify] https://crrev.com/ce390470c7c40222140f1897f7405bc475d2f1a7/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt [modify] https://crrev.com/ce390470c7c40222140f1897f7405bc475d2f1a7/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt [modify] https://crrev.com/ce390470c7c40222140f1897f7405bc475d2f1a7/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt [modify] https://crrev.com/ce390470c7c40222140f1897f7405bc475d2f1a7/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt [modify] https://crrev.com/ce390470c7c40222140f1897f7405bc475d2f1a7/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt [modify] https://crrev.com/ce390470c7c40222140f1897f7405bc475d2f1a7/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5
,
May 30 2017
,
Jun 2 2017
|
|||||||||||||||||||||||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||||||||||||||||||||||
Comment 1 by stef...@gmail.com
, May 3 2016