Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Starred by 8 users
Status: Fixed
Owner:
Closed: Jun 2
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Launch-OWP
Launch-Accessibility: ----
Launch-Legal: ----
Launch-M-Approved: ----
Launch-M-Target: 61-Stable-Exp
Launch-Privacy: ----
Launch-Security: ----
Launch-Status: ----
Launch-Test: ----
Launch-UI: ----
Product-Review: ----

Blocked on:
issue 690720



Sign in to add a comment
Storage API: quota estimate() method
Project Member Reported by jsb...@chromium.org, Apr 15 2016 Back to list
(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

 
Comment 1 by stef...@gmail.com, May 3 2016
Any update on this?
It's in experimentally, i.e. run chrome with --enable-experimental-web-platform-features. Feedback appreciated!

Comment 3 by stef...@gmail.com, May 4 2016
Thanks, navigator.storage is now available to page and (more importantly to me) SW - will do some experiments.
Comment 4 by stef...@gmail.com, 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
Comment 5 by jsb...@chromium.org, 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."

Comment 6 by stef...@gmail.com, 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.
Comment 7 by stef...@gmail.com, 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)
Comment 8 Deleted
Comment 9 by jsb...@chromium.org, 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.

To be clear, my comment in c#5 was wrong, sorry!
Comment 11 by stef...@gmail.com, May 20 2016
Np, when I read the spec ('[Exposed=Window] Promise<boolean> persist();') that is what I expected.
Blockedon: 690720
Mozilla is apparently targeting FF57:

https://wiki.mozilla.org/TPE_DOM/Storage#Roadmap


Project Member Comment 14 by bugdroid1@chromium.org, May 26
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

Labels: Launch-M-Target-61-Stable-Exp
Status: Fixed
Sign in to add a comment