From ecceb0ac2e472e27f0fc0c9ec3e5f718654b5de9 Mon Sep 17 00:00:00 2001 From: Jarryd Goodman Date: Mon, 22 Apr 2019 14:07:11 -0700 Subject: [PATCH] Add UsageDetails dictionary. squash 47187f6 Address style nits from domenic. squash 0fd3b44 Explicitly define each storage system's usage. --- storage.bs | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/storage.bs b/storage.bs index 79497f6..82b3526 100644 --- a/storage.bs +++ b/storage.bs @@ -18,7 +18,7 @@ these APIs by defining:

Traditionally, as the user runs out of storage space on their device, the data stored with these @@ -178,7 +178,21 @@ larger site storage quota. Factors such as navigation frequency, recency bookmarking, and permission for {{"persistent-storage"}} can be used as indications of "popularity". +The application cache site storage usage for an origin +origin is a rough estimate of the amount of bytes used in Application +Cache in origin's site storage unit. [[HTML#appcache]] +The caches site storage usage for an origin +origin is a rough estimate of the amount of bytes used in Cache API +in origin's site storage unit. [[SERVICE-WORKERS#cache-objects]] + +The indexedDB site storage usage for an origin +origin is a rough estimate of the amount of bytes used in IndexedDB +in origin's site storage unit. [[!IndexedDB]] + +The service worker registration site storage usage for an +origin origin is a rough estimate of the amount of bytes +used in service worker registrations in origin's site storage unit. [[!SERVICE-WORKERS]]

User Interface Guidelines

@@ -234,7 +248,16 @@ interface StorageManager { dictionary StorageEstimate { unsigned long long usage; unsigned long long quota; + StorageUsageDetails usageDetails; +}; + +dictionary StorageUsageDetails { + unsigned long long applicationCache; + unsigned long long caches; + unsigned long long indexedDB; + unsigned long long serviceWorkerRegistrations; }; + The persisted() method, when invoked, must run @@ -331,11 +354,40 @@ must run these steps:
  • Let quota be site storage quota for origin. -

  • Let dictionary be a new {{StorageEstimate}} dictionary whose {{usage}} member - is usage and {{quota}} member is quota. +

  • Let applicationCache be application cache site storage usage + for origin. + +

  • Let indexedDB be indexedDB site storage usage for origin. + +

  • Let caches be caches site storage usage for origin. + +

  • Let serviceWorkerRegistrations be service worker registration + site storage usage for origin. + +

  • Let usageDetails be a new {{StorageUsageDetails}} dictionary. + +

  • If applicationCache is greater than 0, set the + {{StorageUsageDetails/applicationCache}} member of usageDetails to + applicationCache. + +

  • If indexedDB is greater than 0, set the + {{StorageUsageDetails/indexedDB}} member of usageDetails to + indexedDB. + +

  • If caches is greater than 0, set the + {{StorageUsageDetails/caches}} member of usageDetails to + caches. + +

  • If serviceWorkerRegistrations is greater than 0, set the + {{StorageUsageDetails/serviceWorkerRegistrations}} member of usageDetails to + serviceWorkerRegistrations. + +

  • Let dictionary be a new {{StorageEstimate}} dictionary whose {{StorageEstimate/usage}} member + is usage, {{StorageEstimate/quota}} member is quota and {{StorageEstimate/usageDetails}} + member is usageDetails.

  • -

    If there was an internal error while obtaining usage and quota, then +

    If there was an internal error while obtaining any of the above, then queue a task to reject promise with a {{TypeError}}.

    Internal errors are supposed to be extremely rare and indicate some kind of